Skip to contentSkip to navigationSkip to topbar
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
authorizationstring
required
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

filtersobject
required

The configurable filters for SendGrid to destination email event forwarding.


propertiesobject
required

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


labelstring

Optional

The nickname for the Integration.

Default: Untitled IntegrationExample: My New Segment Integration!
201400403500

Successful Operation

SchemaExample
Property nameTypeRequiredDescriptionChild properties
integrationIdstring

Optional

The unique ID of an Integration.

Example: 12345

userIdstring

Optional

Your Twilio SendGrid account ID.

Example: 123456

filtersobject

Optional

The configurable filters for SendGrid to destination email event forwarding.


propertiesobject

Optional

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


labelstring

Optional

The nickname for the Integration.

Default: Untitled IntegrationExample: My New Segment Integration!

destinationenum<string>

Optional

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

Possible values:
Segment
Create an IntegrationLink to code sample: Create an Integration
1
const client = require("@sendgrid/client");
2
client.setApiKey(process.env.SENDGRID_API_KEY);
3
4
const data = {
5
filters: {
6
email_events: ["click", "drop", "open", "processed", "delivered"],
7
},
8
destination: "Segment",
9
label: "optional label",
10
properties: {
11
destination_region: "US",
12
write_key: "a123456",
13
},
14
};
15
16
const request = {
17
url: `/v3/marketing/integrations`,
18
method: "POST",
19
body: data,
20
};
21
22
client
23
.request(request)
24
.then(([response, body]) => {
25
console.log(response.statusCode);
26
console.log(response.body);
27
})
28
.catch((error) => {
29
console.error(error);
30
});