Config API Overview

On this page


The Config API enables you to programmatically manage Segment workspaces, sources, destinations and more. With the API you can:

  • List all your workspace Sources and Destinations to see how data flows through Segment
  • Create new Destinations - or delete them - with a few lines of code
  • Create new users and assign them to scoped roles
  • Configure, disable, or view Sources and manage connected Destinations
  • Get a complete view of all the Sources and Destinations available in Segment’s catalog
  • Configure a Tracking Plan to see how data conforms to your expected schema
  • Query Event Delivery metrics to build custom dashboards and alerts to monitor delivery of your events to destinations
  • Filter entire events or individual fields from reaching specific destinations

The Config API is a set of REST services under segmentapis.com:

Service Description
Access Tokens Manage access tokens
Source Catalog Get info about all event and cloud sources
Destination Catalog Get info about all destinations
Workspaces Get info about workspaces
Sources Manage workspace sources
Destinations Manage workspace destinations
Tracking Plans Manage workspace tracking plans
Event Delivery Metrics Get event delivery metrics for cloud-mode destinations
Destination Filters Manage destination filters
IAM Manage workspace users and roles

To see all the API methods and models see the Segment Config API Reference.

At this time there are no language-specific clients. However the API Reference also contains example code snippets for cURL, Go, Node, Python and more.

Quick Start

You can interact with the API from the command line. First install the curl tool.

$ brew install curl

Access Tokens

You can use the Config API with an access token to programmatically access Segment resources that the token can access. Access tokens are created by workspace owners using the Access Management page, and can only access resources that the token has permission to.

These are currently only suitable for first party, trusted applications, such as your personal local scripts and server side programs. Partners should not prompt Segment users for their username and password and save an access token as a way to delegate access. See the Authentication doc for more information.

When you create an access token, you’ll give it a description, a workspace, and determine whether it has workspace owner or member access.

Secret Token

You can not retrieve the plain-text token later, so you should save it in a secret manager. If you lose the token you can generate a new one.

Note: All Personal Access Tokens will be deprecated on August 3rd, 2019.

API Requests

Now that you have an access token, you can use this token to access the rest of the Config API by setting it in the Authorization header of your requests, for example:

$ ACCESS_TOKEN=qiTgISif4zprgBb_5j4hXfp3qhDbxrntWwwOaHgAMr8.gg9ok4Bk7sWlP67rFyXeH3ABBsXyWqNuoXbXZPv1y2g

$ curl \
  -X GET \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  https://platform.segmentapis.com/v1beta/workspaces

Example response:

{
  "workspaces": [
    {
      "name": "workspaces/myworkspace",
      "display_name": "My Space",
      "id": "e5bdb0902b",
      "create_time": "2018-08-08T13:24:02.651Z"
    }
  ],
  "next_page_token": ""
}

Reference

For an overview of the API’s common design patterns and important information about versioning and compatibility, see the API Design document.

To see all the API methods and models see the Segment Config API Reference.

This page was last modified: 08 Apr 2020


Get started with Segment

Segment is the easiest way to integrate your websites & mobile apps data to over 300 analytics and growth tools.
or
Create free account