Skip to content
Scalekit Docs
Talk to an Engineer Dashboard

Connect AI agents to Segment

Scalekit connector
Open markdown

The Segment connector lets your AI agent act in each user's Segment account. Each user connects their own Segment access token once, and Scalekit sends it with every call, so your agent never handles credentials. It comes with 104 tools.

Tools
104
What they doRead · write · destructive
60 · 30 · 1460 read30 write14 destructive
Users sign in with

Setup

  1. Install the SDK

    Terminal window
    npm install @scalekit-sdk/node dotenv
  2. Set your credentials

    Add your Scalekit credentials to your .env file. Find values in app.scalekit.com > Developers > API Credentials.

    .env
    SCALEKIT_ENVIRONMENT_URL=<your-environment-url>
    SCALEKIT_CLIENT_ID=<your-client-id>
    SCALEKIT_CLIENT_SECRET=<your-client-secret>
  3. Create the Segment connection

    In AgentKit > Connections, create a Segment connection. The name you give it is the connection_name your code passes. See Configure connections.

  4. Authorize a user and make your first call

    quickstart.mts
    import { ScalekitClient } from '@scalekit-sdk/node'
    import 'dotenv/config'
    import { createInterface } from 'node:readline/promises'
    const scalekit = new ScalekitClient(
    process.env.SCALEKIT_ENVIRONMENT_URL,
    process.env.SCALEKIT_CLIENT_ID,
    process.env.SCALEKIT_CLIENT_SECRET,
    )
    const actions = scalekit.actions
    const connector = 'segment'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
    console.log('Authorize Segment:', link)
    const rl = createInterface({ input: process.stdin, output: process.stdout })
    await rl.question('Press Enter after authorizing...')
    rl.close()
    // Make your first call
    const result = await actions.executeTool({
    connector,
    identifier,
    toolName: 'segment_audit_events_list',
    toolInput: {},
    })
    console.log(result)
    Terminal window
    npx tsx quickstart.mts

    Each user opens the link once and enters their Segment credentials there. See Authorize a user for the full flow and statuses.

Tools

Pass the exact name to execute_tool
Try in PlaygroundRequest a tool
  • segment_audience_getGet one Audience in an Engage Space.Read-only

    Get Audience

    Get one Audience in an Engage Space. Returns the Audience's name, key, description, definition, options, enabled flag and status. Use it for a known audience id. Use segment_audiences_list to find ids. Requires Engage with the Audiences feature; get space_id from segment_spaces_list.

    Inputs

    audience_idstringrequired
    ID of the Audience. Get it from segment_audiences_list. Example: aud_0ujsszwN8NRY24YaXiTIE2VWDTS.
    space_idstringrequired
    ID of the Engage (Unify) Space. Get it from segment_spaces_list. Example: spa_9aQ1Lj62S4bomZKLF4DPqW.
    includestring
    Set to schedules to include the Audience's run schedules in the response. Example: schedules.one of schedules
  • segment_audiences_listList the Audiences in an Engage Space, optionally searched by name, key or definition.Read-only

    List Audiences

    List the Audiences in an Engage Space, optionally searched by name, key or definition. Returns each Audience's id, name, key, definition, enabled flag and status, plus a pagination cursor. Use segment_audiences_list to browse or search. Use segment_audience_get for one Audience. Requires Engage with the Audiences feature; get space_id from segment_spaces_list. Rate limit: 60 requests per minute.

    Inputs

    space_idstringrequired
    ID of the Engage (Unify) Space. Get it from segment_spaces_list. Example: spa_9aQ1Lj62S4bomZKLF4DPqW.
    includestring
    Set to schedules to include each Audience's run schedules in the response. Example: schedules.one of schedules
    pagination_countinteger
    Number of items per page, between 1 and 1000. Defaults to 200. Example: 50.default 200
    pagination_cursorstring
    Page cursor from a previous response's pagination object (its next or previous value). Leave it out for the first page. Example: MA==.
    search_querystring
    Text to search for in the field chosen by search_type. Example: purchasers.
    search_typestring
    Field to search on: NAME, KEY or DEFINITION. Use together with search_query. Example: DEFINITION.one of DEFINITIONKEYNAME
  • segment_audit_events_listList Audit Trail events for the workspace, newest first.Read-only

    List Audit Events

    List Audit Trail events for the workspace, newest first. Returns each event's id, type, timestamp, actor and affected resource, plus a pagination cursor. Use it to see who changed what, optionally filtered by time window or resource.

    Inputs

    end_timestring
    Only return events before this time (ISO 8601). Defaults to now, or to the end time carried in the pagination cursor. Example: 2026-10-14T00:00:00Z.
    pagination_countinteger
    Number of items per page, between 1 and 1000. Defaults to 200. Example: 50.default 200
    pagination_cursorstring
    Page cursor from a previous response's pagination object (its next or previous value). Leave it out for the first page. Example: MA==.
    resource_idstring
    Only return events that affect this resource, for example one Source's id. Example: 9aQ1Lj62S4bomZKLF4DPqW.
    resource_typestring
    Only return events that affect this resource type, for example Source, Warehouse or Tracking Plan. Example: Source.
    start_timestring
    Only return events after this time (ISO 8601). Example: 2026-10-01T00:00:00Z.
  • segment_catalog_destination_getGet one Destination type from Segment's catalog.Read-only

    Get Destination Metadata

    Get one Destination type from Segment's catalog. Returns its name, slug, settings (required and advanced), supported methods and Actions definitions. Use it to see the settings segment_destination_create needs and the action ids subscriptions use.

    Inputs

    destination_metadata_idstringrequired
    ID of the Destination catalog entry. Get it from segment_catalog_destinations_list. Example: 54521fd525e721e32a72ee91.
  • segment_catalog_destinations_listList the Destination types available in Segment's catalog.Read-only

    Get Destinations Catalog

    List the Destination types available in Segment's catalog. Returns each catalog entry's id, name, slug, categories, supported methods and settings, plus a pagination cursor. Use it to find a metadata_id for segment_destination_create. Use segment_catalog_destination_get for one entry.

    Inputs

    pagination_countinteger
    Number of items per page, between 1 and 1000. Defaults to 200. Example: 50.default 200
    pagination_cursorstring
    Page cursor from a previous response's pagination object (its next or previous value). Leave it out for the first page. Example: MA==.
  • segment_catalog_source_getGet one Source type from Segment's catalog.Read-only

    Get Source Metadata

    Get one Source type from Segment's catalog. Returns its name, slug, categories, logos and the settings options it accepts. Use it to see what settings segment_source_create needs for that type.

    Inputs

    source_metadata_idstringrequired
    ID of the Source catalog entry. Get it from segment_catalog_sources_list. Example: 1bow82lmk.
  • segment_catalog_sources_listList the Source types available in Segment's catalog.Read-only

    Get Sources Catalog

    List the Source types available in Segment's catalog. Returns each catalog entry's id, name, slug, categories and settings options, plus a pagination cursor. Use it to find a metadata_id for segment_source_create. Use segment_catalog_source_get for one entry.

    Inputs

    pagination_countinteger
    Number of items per page, between 1 and 1000. Defaults to 200. Example: 50.default 200
    pagination_cursorstring
    Page cursor from a previous response's pagination object (its next or previous value). Leave it out for the first page. Example: MA==.
  • segment_catalog_warehouse_getGet one Warehouse type from Segment's catalog.Read-only

    Get Warehouse Metadata

    Get one Warehouse type from Segment's catalog. Returns its name, slug, logos and the settings options a Warehouse of that type accepts. Use it to see the settings segment_warehouse_update expects.

    Inputs

    warehouse_metadata_idstringrequired
    ID of the Warehouse catalog entry. Get it from segment_catalog_warehouses_list. Example: 55d3d3aea3c.