Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Create an Integration



API Overview

api-overview page anchor

An Integration is a connection from a SendGrid Marketing Campaign to a supported third-party application. Integrations with different external applications allow you to sync data and create a more cohesive cross-product data experience.

Currently, only Segment(link takes you to an external page) Integrations are supported. Segment Integrations allow you to customize and automate email event forwarding to your Segment account.

The Integrations API allows you to create, retrieve, update, and delete your Integrations.


POST/v3/marketing/integrations

Base url: https://api.sendgrid.com (for global users and subusers)

Base url: https://api.eu.sendgrid.com (for EU regional subusers)

This endpoint creates an Integration for email event forwarding. Each Integration has a maximum number of allowed Integration instances per user. For example, users can create up to 10 Segment Integrations.


Authentication

authentication page anchor
Property nameTypeRequiredDescription
Authorizationstringrequired
Default: Bearer <<YOUR_API_KEY_HERE>>
Encoding type:application/json
SchemaExample
Property nameTypeRequiredDescriptionChild properties
destinationenum<string>required

The third-party application you would like to forward your events to.

Possible values:
Segment

filtersobjectrequired

The configurable filters for SendGrid to destination email event forwarding.


propertiesobjectrequired

The properties of an Integration required to send events to a specific third-party application.


labelstringOptional

The nickname for the Integration.

Default: Untitled Integration
201400403500

Successful Operation

SchemaExample
Property nameTypeRequiredDescriptionChild properties
integration_idstring

The unique ID of an Integration.


user_idstring

Your Twilio SendGrid account ID.


filtersobject

The configurable filters for SendGrid to destination email event forwarding.


propertiesobject

The properties of an Integration required to send events to a specific third-party application.


labelstring

The nickname for the Integration.

Default: Untitled Integration

destinationenum<string>

The third-party application you would like to forward your events to.

Possible values:
Segment

Create an Integration

create-an-integration page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
curl

_31
const client = require('@sendgrid/client');
_31
client.setApiKey(process.env.SENDGRID_API_KEY);
_31
_31
const data = {
_31
"destination": "Segment",
_31
"filters": {
_31
"email_events": [
_31
"drop"
_31
]
_31
},
_31
"properties": {
_31
"write_key": "1234-abc",
_31
"destination_region": "EU"
_31
},
_31
"label": "My New Segment Integration!"
_31
};
_31
_31
const request = {
_31
url: `/v3/marketing/integrations`,
_31
method: 'POST',
_31
body: data
_31
}
_31
_31
client.request(request)
_31
.then(([response, body]) => {
_31
console.log(response.statusCode);
_31
console.log(response.body);
_31
})
_31
.catch(error => {
_31
console.error(error);
_31
});


Rate this page: