Destinations receive data from Segment.
In the Segment Public API, you can manipulate Destinations and the connections between Sources and Destinations, as well as list and inspect their relationships.
Like Segment Public API, Config API allows creating, retrieving, updating and deleting Destination objects. See the table below for some key differences:
| Config API | Public API |
|---|---|
| catalogId | Not returned |
| config | settings |
| connectionMode | Not returned |
| createTime | Not returned |
| displayName | name |
| enabled | enabled |
| name | See note on names vs IDs in the migration guide |
| parent | sourceId (prefix removed) |
| updateTime | Not returned |
To migrate, replace any use of the Config API endpoints with the Segment Public API counterparts, using the field mappings in the table above.
Creates a new Destination.
• When called, this endpoint may generate the Integration Created event in the audit trail.
OK
Resource not found
Validation failure
Too many requests
{- "sourceId": "rh5BDZp6QDHvXFCkibm1pR",
- "metadataId": "54521fd525e721e32a72eea2",
- "name": "my destination v1",
- "settings": {
- "siteId": "12345"
}
}{- "data": {
- "destination": {
- "id": "6a429ab64ee46817eac3c7e1",
- "enabled": true,
- "name": "my destination v1",
- "settings": {
- "siteId": "12345"
}, - "metadata": {
- "id": "54521fd525e721e32a72eea2",
- "name": "Clicky",
- "description": "Clicky is a general-purpose, free analytics tool that gives you access to lots of the same features as Google Analytics. It also comes with a real-time dashboard.",
- "slug": "clicky",
- "logos": {
}, - "options": [
- {
- "name": "siteId",
- "type": "string",
- "defaultValue": "",
- "description": "You can find your Site ID under the **Preferences** tab on your [Clicky account](http://clicky.com/100566366).",
- "required": true,
- "label": "Site ID"
}
], - "status": "PUBLIC",
- "categories": [
- "Analytics"
], - "components": [
- {
- "type": "BROWSER"
}
], - "previousNames": [
- "Clicky"
], - "supportedMethods": {
- "track": true,
- "pageview": true,
- "identify": true,
- "group": true,
- "alias": true
}, - "supportedPlatforms": {
- "browser": true,
- "mobile": false,
- "server": false,
- "warehouse": false,
- "cloudAppObject": false,
- "linkedAudiences": false
}, - "supportedFeatures": {
- "cloudModeInstances": "0",
- "deviceModeInstances": "0",
- "replay": false,
- "browserUnbundling": false,
- "browserUnbundlingPublic": true
}, - "actions": [ ],
- "presets": [ ],
- "contacts": [ ],
- "partnerOwned": false,
- "multiInstanceSupportedVersion": "UNSUPPORTED"
}, - "sourceId": "rh5BDZp6QDHvXFCkibm1pR"
}
}
}Returns a list of Destinations.
object (PaginationInput) Required pagination params for the request. This parameter exists in v1. Example: pagination=pagination.count=1 |
OK
Resource not found
Validation failure
Too many requests
import { configureApis, unwrap } from '@segment/public-api-sdk-typescript' const api = configureApis('/* Insert your Public API token here */') try { const result = await unwrap(api.destinations.listDestinations()) console.log(JSON.stringify(result)) } catch (e) { console.log('ERROR:', e) }
{- "data": {
- "destinations": [
- {
- "id": "5GFhvtz8fha42Cm4B9E6L8",
- "enabled": true,
- "name": "",
- "settings": {
- "region": "us-west",
- "roleAddress": "arn::...",
- "secretId": "secrettt",
- "stream": "bla"
}, - "metadata": {
- "id": "57da359580412f644ff33fb9",
- "name": "Amazon Kinesis",
- "description": "Amazon Kinesis Streams enables you to build custom applications that process or analyze streaming data for specialized needs. Amazon Kinesis Streams can continuously capture and store terabytes of data per hour from hundreds of thousands of sources such as website clickstreams, financial transactions, social media feeds, IT logs, and location-tracking events.",
- "slug": "amazon-kinesis",
- "logos": {
}, - "options": [
- {
- "name": "region",
- "type": "string",
- "defaultValue": "us-west-2",
- "description": "The Kinesis Stream's AWS region key",
- "required": true,
- "label": "AWS Kinesis Stream Region"
}, - {
- "name": "roleAddress",
- "type": "string",
- "defaultValue": "",
- "description": "The address of the AWS role that will be writing to Kinesis (ex: arn:aws:iam::874699288871:role/example-role)",
- "required": true,
- "label": "Role Address"
}, - {
- "name": "secretId",
- "type": "string",
- "defaultValue": "#SEGMENT_WORKSPACE_ID",
- "description": "The External ID to your IAM role. This value is read-only. Reach out to support if you wish to change it. This value is also a secret and should be treated as a password.",
- "required": true,
- "label": "Secret ID (Read-Only)"
}, - {
- "name": "stream",
- "type": "string",
- "defaultValue": "",
- "description": "The Kinesis Stream Name",
- "required": true,
- "label": "AWS Kinesis Stream Name"
}, - {
- "name": "useMessageId",
- "type": "boolean",
- "defaultValue": false,
- "description": "You can enable this option if you want to use the Segment generated `messageId` for the **Partition Key**. If you have issues with too many `provisionedthroughputexceededexceptions` errors, this means that your Segment events are not being evenly distributed across your buckets as you do not have even user event distribution (*default partition key is `userId` or `anonymousId`*). This option should provide much more stable and even distribution.",
- "required": false,
- "label": "Use Segment Message ID"
}
], - "status": "PUBLIC",
- "categories": [
- "Analytics",
- "Raw Data"
], - "components": [
- {
- "type": "SERVER"
}
], - "previousNames": [
- "Amazon Kinesis"
], - "supportedMethods": {
- "track": true,
- "pageview": true,
- "identify": true,
- "group": true,
- "alias": true
}, - "supportedPlatforms": {
- "browser": true,
- "mobile": true,
- "server": true,
- "warehouse": false
}, - "supportedFeatures": {
- "cloudModeInstances": "0",
- "deviceModeInstances": "0",
- "replay": true,
- "browserUnbundling": false,
- "browserUnbundlingPublic": true
}, - "actions": [ ],
- "presets": [ ],
- "contacts": [ ],
- "partnerOwned": false
}, - "sourceId": "rh5BDZp6QDHvXFCkibm1pR"
}
], - "pagination": {
- "current": "MA==",
- "next": "MQ==",
- "totalEntries": 2
}
}
}Creates a new Destination subscription.
• This endpoint is in Alpha testing. Please submit any feedback by sending an email to friends@segment.com.
• In order to successfully call this endpoint, the specified Workspace needs to have the Destination Subscriptions feature enabled. Please reach out to your customer success manager for more information.
The rate limit for this endpoint is 5 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See Rate Limiting for more information.
OK
Resource not found
Validation failure
Too many requests
{- "name": "Example Subscription",
- "actionId": "jiMz7MfHNeHmUckzRnUGkU",
- "trigger": "type = \"track\"",
- "enabled": false
}{- "data": {
- "destinationSubscription": {
- "id": "5LMtids98TMVeiir4HKeD3",
- "name": "Example Subscription",
- "actionId": "jiMz7MfHNeHmUckzRnUGkU",
- "actionSlug": "someActionSlug",
- "destinationId": "fP7qoQw2HTWt9WdMr718gn",
- "modelId": "",
- "enabled": false,
- "trigger": "type = \"track\"",
- "settings": { }
}
}
}Lists subscriptions for a Destination.
• This endpoint is in Alpha testing. Please submit any feedback by sending an email to friends@segment.com.
• In order to successfully call this endpoint, the specified Workspace needs to have the Destination Subscriptions feature enabled. Please reach out to your customer success manager for more information.
OK
Resource not found
Validation failure
Too many requests
import { configureApis, unwrap } from '@segment/public-api-sdk-typescript' const api = configureApis('/* Insert your Public API token here */') try { const result = await unwrap(api.destinations.listSubscriptionsFromDestination('fP7qoQw2HTWt9WdMr718gn')) console.log(JSON.stringify(result)) } catch (e) { console.log('ERROR:', e) }
{- "data": {
- "pagination": {
- "current": "MA==",
- "totalEntries": 1
}, - "subscriptions": [
- {
- "id": "eoeXaMeAYcB2XvEApJDrQs",
- "name": "Test Subscription",
- "actionId": "uD9jEQ4DxJZzhzVqppM7UD",
- "actionSlug": "Public API Slug",
- "destinationId": "fP7qoQw2HTWt9WdMr718gn",
- "modelId": "",
- "enabled": true,
- "trigger": "type = \"track\"",
- "settings": { }
}
]
}
}Deletes an existing Destination.
• When called, this endpoint may generate the Integration Deleted event in the audit trail.
Config API omitted fields:
catalogIdOK
Resource not found
Validation failure
Too many requests
import { configureApis, unwrap } from '@segment/public-api-sdk-typescript' const api = configureApis('/* Insert your Public API token here */') try { const result = await unwrap(api.destinations.deleteDestination('65c2bdbede6f2d8297f943db')) console.log(JSON.stringify(result)) } catch (e) { console.log('ERROR:', e) }
{- "data": {
- "status": "SUCCESS"
}
}Returns a Destination by its id.
Config API omitted fields:
catalogIdOK
Resource not found
Validation failure
Too many requests
import { configureApis, unwrap } from '@segment/public-api-sdk-typescript' const api = configureApis('/* Insert your Public API token here */') try { const result = await unwrap(api.destinations.getDestination('qtiZHLLqqsHmpvLXNtP5du')) console.log(JSON.stringify(result)) } catch (e) { console.log('ERROR:', e) }
{- "data": {
- "destination": {
- "id": "qtiZHLLqqsHmpvLXNtP5du",
- "enabled": false,
- "name": "",
- "settings": {
- "apiSecret": "test",
- "firebaseAppId": "test",
- "measurementId": "test"
}, - "metadata": {
- "id": "60ad61f9ff47a16b8fb7b5d9",
- "name": "Google Analytics 4 Cloud",
- "description": "Google Analytics 4 (GA4) is Google’s new Analytics property, which you can use for both websites and apps. Google Analytics 4 has machine learning at its core to automatically surface helpful insights and give you a complete understanding of your customers across devices and platforms. When you have Segment installed, you can make efficient use of your existing tracking implementation by using Segment to fulfill your data collection needs across all your tools that integrate with Segment, including Google Analytics 4.",
- "slug": "actions-google-analytics-4",
- "logos": {
}, - "options": [ ],
- "status": "PUBLIC",
- "categories": [
- "Analytics"
], - "components": [ ],
- "previousNames": [
- "Actions Google Analytic 4",
- "Actions Google Analytics 4",
- "Google Analytics 4",
- "Google Analytics 4 Cloud"
], - "supportedMethods": {
- "track": true,
- "pageview": true,
- "identify": true,
- "group": true,
- "alias": true
}, - "supportedPlatforms": {
- "browser": true,
- "mobile": false,
- "server": true,
- "warehouse": true,
- "cloudAppObject": false
}, - "supportedFeatures": {
- "cloudModeInstances": "0",
- "deviceModeInstances": "0",
- "replay": false,
- "browserUnbundling": false,
- "browserUnbundlingPublic": true
}, - "actions": [
- {
- "id": "aDsztZnvzzRrYsk6fHCF6a",
- "name": "Some Action Name",
- "slug": "someActionSlug",
- "description": "",
- "platform": "CLOUD",
- "hidden": false,
- "defaultTrigger": null,
- "fields": [ ]
}, - {
- "id": "wy1vMhKu669RPM6YR4BfUv",
- "name": "Public API Action",
- "slug": "Public API Slug",
- "description": "",
- "platform": "CLOUD",
- "hidden": false,
- "defaultTrigger": null,
- "fields": [
- {
- "id": "qg1vn4TgrtAMVvtsdGugT2",
- "sortOrder": 0,
- "fieldKey": "some_key",
- "label": "Some Thing",
- "type": "STRING",
- "description": "This is a great thing",
- "required": false,
- "multiple": false,
- "choices": null,
- "dynamic": false,
- "allowNull": false,
- "hidden": false
}
]
}
], - "presets": [ ],
- "contacts": [
- {
- "name": "Contact McDummyData",
- "email": "set@me.org",
- "role": "VP of changing this field",
- "isPrimary": false
}
], - "partnerOwned": false,
- "supportedRegions": [
- "us-west-2",
- "eu-west-1"
], - "regionEndpoints": [
- "US"
]
}, - "sourceId": "rh5BDZp6QDHvXFCkibm1pR"
}
}
}Updates an existing Destination.
Note: if you attempt to update read-only settings for your destination you'll encounter the following behavior:
• When called, this endpoint may generate the Integration Disabled event in the audit trail.
Config API omitted fields:
updateMaskOK
Resource not found
Validation failure
Too many requests
{- "enabled": false
}{- "data": {
- "destination": {
- "id": "qtiZHLLqqsHmpvLXNtP5du",
- "enabled": false,
- "name": "",
- "settings": {
- "apiSecret": "test",
- "firebaseAppId": "test",
- "measurementId": "test"
}, - "metadata": {
- "id": "60ad61f9ff47a16b8fb7b5d9",
- "name": "Google Analytics 4 Cloud",
- "description": "Google Analytics 4 (GA4) is Google’s new Analytics property, which you can use for both websites and apps. Google Analytics 4 has machine learning at its core to automatically surface helpful insights and give you a complete understanding of your customers across devices and platforms. When you have Segment installed, you can make efficient use of your existing tracking implementation by using Segment to fulfill your data collection needs across all your tools that integrate with Segment, including Google Analytics 4.",
- "slug": "actions-google-analytics-4",
- "logos": {
}, - "options": [ ],
- "status": "PUBLIC",
- "categories": [
- "Analytics"
], - "components": [ ],
- "previousNames": [
- "Actions Google Analytic 4",
- "Actions Google Analytics 4",
- "Google Analytics 4",
- "Google Analytics 4 Cloud"
], - "supportedMethods": {
- "track": true,
- "pageview": true,
- "identify": true,
- "group": true,
- "alias": true
}, - "supportedPlatforms": {
- "browser": true,
- "mobile": false,
- "server": true,
- "warehouse": true,
- "cloudAppObject": false
}, - "supportedFeatures": {
- "cloudModeInstances": "0",
- "deviceModeInstances": "0",
- "replay": false,
- "browserUnbundling": false,
- "browserUnbundlingPublic": true
}, - "actions": [
- {
- "id": "aDsztZnvzzRrYsk6fHCF6a",
- "name": "Some Action Name",
- "slug": "someActionSlug",
- "description": "",
- "platform": "CLOUD",
- "hidden": false,
- "defaultTrigger": null,
- "fields": [ ]
}, - {
- "id": "wy1vMhKu669RPM6YR4BfUv",
- "name": "Public API Action",
- "slug": "Public API Slug",
- "description": "",
- "platform": "CLOUD",
- "hidden": false,
- "defaultTrigger": null,
- "fields": [
- {
- "id": "qg1vn4TgrtAMVvtsdGugT2",
- "sortOrder": 0,
- "fieldKey": "some_key",
- "label": "Some Thing",
- "type": "STRING",
- "description": "This is a great thing",
- "required": false,
- "multiple": false,
- "choices": null,
- "dynamic": false,
- "allowNull": false,
- "hidden": false
}
]
}
], - "presets": [ ],
- "contacts": [
- {
- "name": "Contact McDummyData",
- "email": "set@me.org",
- "role": "VP of changing this field",
- "isPrimary": false
}
], - "partnerOwned": false,
- "supportedRegions": [
- "us-west-2",
- "eu-west-1"
], - "regionEndpoints": [
- "US"
]
}, - "sourceId": "rh5BDZp6QDHvXFCkibm1pR"
}
}
}Gets a Destination subscription by id.
• This endpoint is in Alpha testing. Please submit any feedback by sending an email to friends@segment.com.
• In order to successfully call this endpoint, the specified Workspace needs to have the Destination Subscriptions feature enabled. Please reach out to your customer success manager for more information.
OK
Resource not found
Validation failure
Too many requests
import { configureApis, unwrap } from '@segment/public-api-sdk-typescript' const api = configureApis('/* Insert your Public API token here */') try { const result = await unwrap(api.destinations.getSubscriptionFromDestination('fP7qoQw2HTWt9WdMr718gn', 'kyMKN6LUgMvF8dwRMEz3cX')) console.log(JSON.stringify(result)) } catch (e) { console.log('ERROR:', e) }
{- "data": {
- "subscription": {
- "id": "kyMKN6LUgMvF8dwRMEz3cX",
- "name": "Example Subscription",
- "actionId": "jiMz7MfHNeHmUckzRnUGkU",
- "actionSlug": "someActionSlug",
- "destinationId": "fP7qoQw2HTWt9WdMr718gn",
- "modelId": "",
- "enabled": false,
- "trigger": "type = \"track\"",
- "settings": { }
}
}
}Deletes an existing Destination subscription.
• This endpoint is in Alpha testing. Please submit any feedback by sending an email to friends@segment.com.
• In order to successfully call this endpoint, the specified Workspace needs to have the Destination Subscriptions feature enabled. Please reach out to your customer success manager for more information.
The rate limit for this endpoint is 5 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See Rate Limiting for more information.
OK
Resource not found
Validation failure
Too many requests
import { configureApis, unwrap } from '@segment/public-api-sdk-typescript' const api = configureApis('/* Insert your Public API token here */') try { const result = await unwrap(api.destinations.removeSubscriptionFromDestination('fP7qoQw2HTWt9WdMr718gn', 'zXCqmEMHJojkD45GcBAPt')) console.log(JSON.stringify(result)) } catch (e) { console.log('ERROR:', e) }
{- "data": {
- "status": "SUCCESS"
}
}Updates an existing Destination subscription.
• This endpoint is in Alpha testing. Please submit any feedback by sending an email to friends@segment.com.
• In order to successfully call this endpoint, the specified Workspace needs to have the Destination Subscriptions feature enabled. Please reach out to your customer success manager for more information.
The rate limit for this endpoint is 5 requests per minute, which is lower than the default due to access pattern restrictions. Once reached, this endpoint will respond with the 429 HTTP status code with headers indicating the limit parameters. See Rate Limiting for more information.
OK
Resource not found
Validation failure
Too many requests
{- "input": {
- "name": "Updated name"
}
}{- "data": {
- "subscription": {
- "id": "pJtn52LjrcD1TrQcm2ZSwp",
- "name": "Updated name",
- "actionId": "wy1vMhKu669RPM6YR4BfUv",
- "actionSlug": "Public API Slug",
- "destinationId": "qtiZHLLqqsHmpvLXNtP5du",
- "modelId": "",
- "enabled": false,
- "trigger": "type = \"track\"",
- "settings": { }
}
}
}Get an event delivery metrics summary from a Destination.
Based on the granularity chosen, there are restrictions on the time range you can query:
Minute:
Hour:
Day:
OK
Resource not found
Validation failure
Too many requests
import { configureApis, unwrap } from '@segment/public-api-sdk-typescript' const api = configureApis('/* Insert your Public API token here */') try { const result = await unwrap( api.destinations.listDeliveryMetricsSummaryFromDestination('fP7qoQw2HTWt9WdMr718gn', 'rh5BDZp6QDHvXFCkibm1pR') ) console.log(JSON.stringify(result)) } catch (e) { console.log('ERROR:', e) }
{- "data": {
- "deliveryMetricsSummary": {
- "sourceId": "rh5BDZp6QDHvXFCkibm1pR",
- "destinationMetadataId": "destination-id",
- "metrics": [
- {
- "metricName": "successes",
- "total": 120,
- "breakdown": [
- {
- "metricName": "successes_on_first_attempt",
- "value": 60
}, - {
- "metricName": "successes_after_retry",
- "value": 60
}
]
}, - {
- "metricName": "expired",
- "total": 0
}, - {
- "metricName": "discarded",
- "total": 0
}, - {
- "metricName": "retried",
- "total": 0
}, - {
- "metricName": "time_to_success",
- "total": 10,
- "breakdown": [
- {
- "metricName": "time_to_success_average",
- "value": 0
}, - {
- "metricName": "time_to_success_p95",
- "value": 0
}
]
}, - {
- "metricName": "time_to_first_attempt",
- "total": 10,
- "breakdown": [
- {
- "metricName": "time_to_first_attempt_average",
- "value": 0
}, - {
- "metricName": "time_to_first_attempt_p95",
- "value": 0
}
]
}
]
}
}
}