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": "54521fd525e721e32a72ee91",
- "name": "my destination v1",
- "settings": {
- "apiKey": "3cb9b589437d3904f19b2b791c2cdada",
- "retarget": true
}
}
{- "data": {
- "destination": {
- "id": "66be7aeca665bd11f8908630",
- "enabled": true,
- "name": "my destination v1",
- "settings": {
- "apiKey": "••••••••••dada",
- "appendFieldsToEventProps": { },
- "batchEvents": false,
- "deviceIdFromUrlParam": false,
- "enableLocationListening": true,
- "endpoint": "",
- "eventUploadPeriodMillis": 30000,
- "eventUploadThreshold": 30,
- "forceHttps": false,
- "groupTypeTrait": "",
- "groupValueTrait": "",
- "mapQueryParams": { },
- "preferAnonymousIdForDeviceId": false,
- "retarget": true,
- "saveParamsReferrerOncePerSession": true,
- "secretKey": "",
- "sendAlias": false,
- "sendToBatchEndpoint": false,
- "trackAllPages": false,
- "trackAllPagesV2": false,
- "trackCategorizedPages": true,
- "trackGclid": false,
- "trackNamedPages": true,
- "trackProductsOnce": false,
- "trackReferrer": true,
- "trackRevenuePerProduct": false,
- "trackSessionEvents": false,
- "trackUtmProperties": true,
- "traitsToAppend": [ ],
- "traitsToIncrement": [ ],
- "traitsToPrepend": [ ],
- "traitsToSetOnce": [ ],
- "unsetParamsReferrerOnNewSession": false,
- "useAdvertisingIdForDeviceId": false,
- "useAmplitudeReferral": false,
- "useCustomAmplitudeProperties": false,
- "useLogRevenueV2": true,
- "versionName": ""
}, - "metadata": {
- "id": "54521fd525e721e32a72ee91",
- "name": "Amplitude",
- "description": "Amplitude is an event tracking and segmentation platform for your web and mobile apps. By analyzing the actions your users perform, you can gain a better understanding to drive retention, engagement, and conversion.",
- "slug": "amplitude",
- "logos": {
}, - "options": [
- {
- "name": "apiKey",
- "type": "string",
- "defaultValue": "",
- "description": "You can find your API Key on your Amplitude [Settings page](https://amplitude.com/settings).",
- "required": true,
- "label": "API Key"
}, - {
- "name": "appendFieldsToEventProps",
- "type": "text-map",
- "defaultValue": { },
- "description": "Web Device-mode only. Configure event fields to be appended to `event_props` for all track calls. For example, entering `context.page.title` on the left and `pageTitle` on the right will set the value of `context.page.title` at `event_properties.pageTitle`.",
- "required": false,
- "label": "Append Fields To Event Properties"
}, - {
- "name": "batchEvents",
- "type": "boolean",
- "defaultValue": false,
- "description": "If true, events are batched together and uploaded only when the number of unsent events is greater than or equal to `eventUploadThreshold` or after `eventUploadPeriodMillis` milliseconds have passed since the first unsent event was logged.",
- "required": false,
- "label": "Batch Events"
}, - {
- "name": "deviceIdFromUrlParam",
- "type": "boolean",
- "defaultValue": false,
- "description": "If true, the SDK will parse device ID values from url parameter `amp_device_id` if available.",
- "required": false,
- "label": "Set Device ID From URL Parameter amp_device_id"
}, - {
- "name": "enableLocationListening",
- "type": "boolean",
- "defaultValue": true,
- "description": "Mobile Only. If a user has granted your app location permissions, enable this setting so that the SDK will also grab the location of the user. Amplitude will never prompt the user for location permission, so this must be done by your app. ",
- "required": false,
- "label": "Enable Location Listening"
}, - {
- "name": "endpoint",
- "type": "select",
- "defaultValue": "",
- "description": "Cloud-mode Only (will not work in device-mode). Choose the endpoint corresponding to your region.",
- "required": false,
- "label": "Endpoint"
}, - {
- "name": "eventUploadPeriodMillis",
- "type": "number",
- "defaultValue": 30000,
- "description": "Amount of time in milliseconds that the SDK waits before uploading events if `batchEvents` is `true`.",
- "required": false,
- "label": "Event Upload Period Millis (for batching events)"
}, - {
- "name": "eventUploadThreshold",
- "type": "number",
- "defaultValue": 30,
- "description": "Minimum number of events to batch together per request if `batchEvents` is `true`.",
- "required": false,
- "label": "Event Upload Threshold (for batching events)"
}, - {
- "name": "forceHttps",
- "type": "boolean",
- "defaultValue": false,
- "description": "If true, the events will always be uploaded to HTTPS endpoint. Otherwise the SDK will use the embedding site's protocol.",
- "required": false,
- "label": "Force Https"
}, - {
- "name": "groupTypeTrait",
- "type": "string",
- "defaultValue": "",
- "description": "What trait Segment should use as your Amplitude \"group type\" in group calls. If, for example, you set this to be `industry`, then `traits[\"industry\"]` will be sent as `groupType` to Amplitude.",
- "required": false,
- "label": "Group Type Trait"
}, - {
- "name": "groupValueTrait",
- "type": "string",
- "defaultValue": "",
- "description": "What trait Segment should use as your Amplitude \"group value\" in group calls. If, for example, you set this to be `plan`, then `traits[\"plan\"]` will be sent as `groupValue` to Amplitude.",
- "required": false,
- "label": "Group Value Trait"
}, - {
- "name": "mapQueryParams",
- "type": "map",
- "defaultValue": { },
- "description": "When sending data via server side or Cloud Mode, you can send the custom query params that are automatically collected by `analytics.js` (or whatever you manually send under `context.page.search`), by entering a custom property name you would like to map that under on the left hand side. On the right hand side, please choose whether you want the query params to be set on the user profile or event metadata level. Whatever you put on the left hand side we will map the entire query parameters string from the `context.page.search`.",
- "required": false,
- "label": "Map Query Params to Custom Property"
}, - {
- "name": "preferAnonymousIdForDeviceId",
- "type": "boolean",
- "defaultValue": false,
- "description": "By default, Segment will use `context.device.id` as the Amplitude `device_id`, using `anonymousId` if `context.device.id` isn't present.\n\nEnable this setting to flip this behavior; `anonymousId` will be used as the `device_id`, falling back to `context.device.id` if it isn't present.\n\nIn browsers, enabling this setting means the user's anonymous ID, which you can set using `analytics.user().anonymousId('ID_GOES_HERE')`, will be set as the Amplitude device ID. Otherwise, Amplitude's default logic for determining device IDs will be used.",
- "required": false,
- "label": "Prefer Anonymous ID for Device ID"
}, - {
- "name": "saveParamsReferrerOncePerSession",
- "type": "boolean",
- "defaultValue": true,
- "description": "If true then includeGclid, includeReferrer, and includeUtm will only track their respective properties once per session. New values that come in during the middle of the user's session will be ignored. Set to false to always capture new values.",
- "required": false,
- "label": "Save Referrer, URL Params, GCLID Once Per Session"
}, - {
- "name": "secretKey",
- "type": "string",
- "defaultValue": "",
- "description": "Your Amplitude Secret Key (Only needed for user deletion)",
- "required": false,
- "label": "Secret Key"
}, - {
- "name": "sendAlias",
- "type": "boolean",
- "defaultValue": false,
- "description": "Server-Side Only. Enabling this setting allows your Amplitude destination instance to send `alias` events to Amplitude's `usermap` endpoint. By default, Segment's Amplitude integration does not support `alias`, so when this setting is disabled, your Segment Amplitude destination will reject `alias` events as unsupported.",
- "required": false,
- "label": "Enable Alias"
}, - {
- "name": "sendToBatchEndpoint",
- "type": "boolean",
- "defaultValue": false,
- "description": "Server-Side Only. If true, events are sent to Amplitude's `batch` endpoint rather than to their `httpapi` endpoint. Because Amplitude's `batch` endpoint throttles traffic less restrictively than the Amplitude `httpapi` endpoint, enabling this setting may help to reduce 429s - or throttling errors - from Amplitude. Amplitude's `batch` endpoint throttles data only when the rate of events sharing the same `user_id` or `device_id` exceeds an average of 1,000/second over a 30-second period. More information about Amplitude's throttling is available here in their docs: https://developers.amplitude.com/#429s-in-depth.",
- "required": false,
- "label": "Send To Batch Endpoint"
}, - {
- "name": "trackAllPages",
- "type": "boolean",
- "defaultValue": false,
- "description": "This will track **Loaded a Page** events to Amplitude for all [`page` method](https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/#page) calls. We keep this disabled by default, since Amplitude isn't generally used for pageview tracking.",
- "required": false,
- "label": "Track All Pages to Amplitude"
}, - {
- "name": "trackAllPagesV2",
- "type": "boolean",
- "defaultValue": false,
- "description": "Mobile only. Sends a \"Loaded Screen\" event and the screen name as a property to Amplitude. Moving forward, this is the preferred method of tracking screen events in Amplitude.",
- "required": false,
- "label": "Track All Screens"
}, - {
- "name": "trackCategorizedPages",
- "type": "boolean",
- "defaultValue": true,
- "description": "This will track events to Amplitude for [`page` method](https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/#page) calls that have a `category` associated with them. For example `page('Docs', 'Index')` would translate to **Viewed Docs Page**.",
- "required": false,
- "label": "Track Categorized Pages to Amplitude"
}, - {
- "name": "trackGclid",
- "type": "boolean",
- "defaultValue": false,
- "description": "If true, captures the gclid url parameter as well as the user's initial_gclid via a set once operation.",
- "required": false,
- "label": "Track GCLID"
}, - {
- "name": "trackNamedPages",
- "type": "boolean",
- "defaultValue": true,
- "description": "This will track events to Amplitude for [`page` method](https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/#page) calls that have a `name` associated with them. For example `page('Signup')` would translate to **Viewed Signup Page**. Remember that `name` includes `category`, so `page('Conversion', 'Signup')` would translate to a **Viewed Conversion Signup Page** event in Amplitude.",
- "required": false,
- "label": "Track Named Pages to Amplitude"
}, - {
- "name": "trackProductsOnce",
- "type": "boolean",
- "defaultValue": false,
- "description": "*Beta feature* Amplitude recently added support to submit an array of products on \"Order Completed\" events. If this setting is set to true, we will send all the products in one single event to Amplitude.",
- "required": false,
- "label": "Track products once"
}, - {
- "name": "trackReferrer",
- "type": "boolean",
- "defaultValue": true,
- "description": "Client Side Only - Enabling this will send referrer information as a user property to Amplitude when you call Segment's `page` method. ",
- "required": false,
- "label": "Track Referrer to Amplitude"
}, - {
- "name": "trackRevenuePerProduct",
- "type": "boolean",
- "defaultValue": false,
- "description": "Client and server only. This setting allows you to specify whether you would like to track an Amplitude Revenue event per individual product in a user transaction or a single Revenue event for the combined revenue of all products. This setting is only relevant if you are using our eCommerce spec and passing us an Order Completed event with a list of products.",
- "required": false,
- "label": "Track Revenue Per Product"
}, - {
- "name": "trackSessionEvents",
- "type": "boolean",
- "defaultValue": false,
- "description": "(Optional) This enables the sending of start and end session events for mobile products. Amplitude's libraries track sessions automatically and this option is not necessary for session tracking. ",
- "required": false,
- "label": "Track Session Events to Amplitude"
}, - {
- "name": "trackUtmProperties",
- "type": "boolean",
- "defaultValue": true,
- "description": "If Amplitude is connected in device-mode this will send the UTM properties found in the querystring. If Amplitude is connected in cloud-mode this will send the UTM properties found in the `context.campaign` object. (Note: The Analytics.js library [automatically collects](https://segment.com/docs/connections/spec/common/#context-fields-automatically-collected) the `context.campaign` object)",
- "required": false,
- "label": "Track UTM Properties to Amplitude."
}, - {
- "name": "traitsToAppend",
- "type": "array",
- "defaultValue": [ ],
- "description": "Server-Side and Mobile Only. Configure values to be appended to the user property array via identify.traits. ",
- "required": false,
- "label": "Traits to Append"
}, - {
- "name": "traitsToIncrement",
- "type": "array",
- "defaultValue": [ ],
- "description": "Configure `trait` to increment on identify. If the trait is present, it will increment the trait given the numerical value passed in when you call `identify` with the trait.",
- "required": false,
- "label": "Traits To Increment"
}, - {
- "name": "traitsToPrepend",
- "type": "array",
- "defaultValue": [ ],
- "description": "Server-Side and Mobile Only. Configure values to be prepended to the user property array via identify.traits. ",
- "required": false,
- "label": "Traits to Prepend"
}, - {
- "name": "traitsToSetOnce",
- "type": "array",
- "defaultValue": [ ],
- "description": "Server-Side and Mobile Only. Configure values to be set only once via identify.traits. ",
- "required": false,
- "label": "Traits to Set Once"
}, - {
- "name": "unsetParamsReferrerOnNewSession",
- "type": "boolean",
- "defaultValue": false,
- "description": "If false, the existing referrer and `utm_parameter` values will be carried through each new session. If set to true, the referrer and `utm_parameter` user properties, which include `referrer`, `utm_source`, `utm_medium`, `utm_campaign`, `utm_term`, and `utm_content`, will be set to null upon instantiating a new session. **Note**: This only works if Track Referrer or Track UTM Properties to Amplitude are set to true.",
- "required": false,
- "label": "Unset Params Referrer On New Session"
}, - {
- "name": "useAdvertisingIdForDeviceId",
- "type": "boolean",
- "defaultValue": false,
- "description": "Mobile Only (will *not* work in cloud-mode). Allows users to use advertisingIdentifier instead of identifierForVendor as the Device ID.",
- "required": false,
- "label": "Use AdvertisingId for DeviceId"
}, - {
- "name": "useAmplitudeReferral",
- "type": "boolean",
- "defaultValue": false,
- "description": "Let Amplitude handle referral tracking behavior. If the \"Save Referrer, URL Params, GLCID Once Per Session\" setting isn't giving the desired behavior, this setting will fix it. Note: This setting may cause Amplitude to not fully respect the \"Prefer Anonymous ID for Device ID\" setting (Amplitude may set the device ID upon initialization before it gets set to the proper Anonymous ID) if using Analytics.js 1.0. Consider [updating to Analytics.js 2.0] (https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/upgrade-to-ajs2/) ",
- "required": false,
- "label": "Use Amplitude Referral"
}, - {
- "name": "useCustomAmplitudeProperties",
- "type": "boolean",
- "defaultValue": false,
- "description": "Enable this option if you want to send additional 'language' and 'country' parameters inside of event_properties. This is separate from the language and country collected from your user's context. (For example, you want to send the language that a video is played in). You can send these in your properties, for example: `analytics.track('Video Played', {language: 'Japanese'});`",
- "required": false,
- "label": "Send Custom Language and Country Properties"
}, - {
- "name": "useLogRevenueV2",
- "type": "boolean",
- "defaultValue": true,
- "description": "Use Amplitude's logRevenueV2 API, which allows for the tracking of event properties with the revenue event. Track an event with \"price\" and \"quantity\" properties, and it will log total revenue = price * quantity. You may also set a revenueType property to designate the type of revenue (ex: purchase, refund, etc). Negative prices can be used to indicate revenue lost.",
- "required": false,
- "label": "Use Log Revenue V2 API"
}, - {
- "name": "versionName",
- "type": "string",
- "defaultValue": "",
- "description": "Optional. You can assign a version name for your page, and we'll send it to Amplitude for more detailed events.",
- "required": false,
- "label": "Version Name"
}
], - "status": "PUBLIC",
- "categories": [
- "Analytics"
], - "components": [
- {
- "owner": "SEGMENT",
- "type": "BROWSER"
}, - {
- "owner": "SEGMENT",
- "type": "IOS"
}, - {
- "owner": "SEGMENT",
- "type": "ANDROID"
}, - {
- "owner": "SEGMENT",
- "type": "SERVER"
}
], - "previousNames": [
- "Amplitude"
], - "supportedMethods": {
- "track": true,
- "pageview": true,
- "identify": true,
- "group": true,
- "alias": false
}, - "supportedPlatforms": {
- "browser": true,
- "mobile": true,
- "server": true,
- "warehouse": false,
- "cloudAppObject": false
}, - "supportedFeatures": {
- "cloudModeInstances": "0",
- "deviceModeInstances": "0",
- "replay": false,
- "browserUnbundling": true,
- "browserUnbundlingPublic": true
}, - "actions": [ ],
- "presets": [ ],
- "contacts": [
- {
- "name": "Mike Ottavi-Brannon",
- "email": "mike@amplitude.com",
- "role": "Principle Product Manager",
- "isPrimary": true
}, - {
- "name": "Kurt Norwood",
- "email": "kurt@amplitude.com",
- "role": "Software Engineer",
- "isPrimary": false
}
], - "partnerOwned": false,
- "supportedRegions": [
- "eu-west-1",
- "us-west-2"
], - "regionEndpoints": [
- "US",
- "EU"
]
}, - "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:
catalogId
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.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:
catalogId
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.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:
updateMask
OK
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
}
]
}
]
}
}
}