# Segment

Twilio Segment is a customer data platform that helps businesses collect, clean, and control their customer data.

- **Category:** analytics
- **Auth:** API_KEY
- **Composio Managed App Available?** N/A
- **Tools:** 17
- **Triggers:** 0
- **Slug:** `SEGMENT`
- **Version:** 20260227_00

## Tools

### Add Labels to Source

**Slug:** `SEGMENT_ADD_LABELS_TO_SOURCE`

Tool to add existing labels to a Source. Use when you have the source ID and want to tag it with metadata labels.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `labels` | array | Yes | List of labels to associate with the Source. Must include at least one label. |
| `sourceId` | string | Yes | ID of the Source (1-255 characters) |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Segment Alias

**Slug:** `SEGMENT_ALIAS`

Tool to alias a previous user ID to a new user ID. Use when merging anonymous and known identities.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `userId` | string | No | New known unique identifier for the user. |
| `context` | object | No | Additional context (e.g., ip, locale). |
| `timestamp` | string | No | ISO-8601 timestamp for the event; server time used if omitted. |
| `previousId` | string | Yes | Previous unique identifier for the user. |
| `anonymousId` | string | No | Anonymous identifier for the user. |
| `integrations` | object | No | Per-destination enable/disable controls. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Batch Segment Analytics Events

**Slug:** `SEGMENT_BATCH`

Tool to send multiple analytics calls in a single batch request. Use when you want to reduce HTTP overhead by batching Identify/Track/Page/Screen/Group calls into one request.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `batch` | array | Yes | Array of analytics calls (identify, track, page, screen, or group). Each item must include 'type' and required fields per call type. |
| `context` | object | No | Optional top-level context merged into each call's context. |
| `writeKey` | string | No | Segment write key; required when using Bearer authentication. |
| `integrations` | object | No | Optional top-level integrations merged into each call's integrations. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Delete Source

**Slug:** `SEGMENT_DELETE_SOURCE`

Tool to delete a Segment Source. Use when you need to permanently remove a Source by its ID after confirmation.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `sourceId` | string | Yes | The Source ID. Length 1–255 characters. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Get Daily Per Source API Calls Usage

**Slug:** `SEGMENT_GET_DAILY_PER_SOURCE_API_CALLS_USAGE`

Tool to fetch daily API call counts per source for a given period. Use when you need daily breakdown of API usage by source after determining the reporting period.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `period` | string | Yes | Start of the usage period in ISO-8601 format (YYYY-MM-DD), e.g. '2021-02-01'. |
| `pagination` | object | No | Pagination parameters for querying source daily API calls usage. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Get Destination

**Slug:** `SEGMENT_GET_DESTINATION`

Tool to retrieve a Destination by ID. Use when you need to fetch the full configuration of a Segment Destination instance by its unique identifier. Falls back US→EU public API and legacy app endpoint; returns minimal envelope on legacy HTML or parse errors.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `destinationId` | string | Yes | The destination’s unique ID. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Segment Group

**Slug:** `SEGMENT_GROUP`

Tool to associate an identified user with a group via Segment HTTP Tracking API. Use when grouping users with traits.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `traits` | object | No | Free-form dictionary of group traits (e.g., name, industry, employees). |
| `userId` | string | No | Unique user identifier. Exactly one of 'userId' or 'anonymousId' must be provided. |
| `context` | object | No | Additional contextual information (e.g., ip, locale, device). |
| `groupId` | string | Yes | Unique identifier for the group. |
| `writeKey` | string | No | Write key for authentication if not using OAuth Bearer token. |
| `timestamp` | string | No | ISO-8601 timestamp when the event occurred; if omitted, server time is used. |
| `anonymousId` | string | No | Pseudo-unique ID for anonymous users. Exactly one of 'userId' or 'anonymousId' must be provided. |
| `integrations` | object | No | Per-destination enable/disable controls (case-sensitive keys). |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Segment Identify

**Slug:** `SEGMENT_IDENTIFY`

Tool to identify a user and set/update traits via Segment HTTP Tracking API.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `traits` | object | No | Free-form dictionary of user traits (e.g., email, name, plan). |
| `userId` | string | No | Unique user identifier. Exactly one of 'userId' or 'anonymousId' must be provided. |
| `context` | object | No | Additional contextual information (e.g., ip, locale, device). |
| `writeKey` | string | No | Write key for authentication if not using Basic or OAuth headers. |
| `messageId` | string | No | Unique id for deduplication; Segment auto-generates one if omitted. |
| `timestamp` | string | No | ISO-8601 timestamp when the identification occurred; if omitted, server time is used. |
| `anonymousId` | string | No | Pseudo-unique ID for anonymous users. Exactly one of 'userId' or 'anonymousId' must be provided. |
| `integrations` | object | No | Per-destination enable/disable controls (case-sensitive keys). |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Import Historical Data

**Slug:** `SEGMENT_IMPORT_HISTORICAL_DATA`

Tool to import historical data in bulk with support for historical timestamps. Use when you need to backfill or import past events with their original timestamps into Segment.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `batch` | array | Yes | Array of event objects to import. Each event should contain: type (track/identify/page/screen/group), userId or anonymousId, timestamp (ISO 8601 format for historical data), and event-specific properties. |
| `context` | object | No | Optional top-level context merged into each call's context. |
| `integrations` | object | No | Optional top-level integrations merged into each call's integrations. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### List Connected Warehouses From Source

**Slug:** `SEGMENT_LIST_CONNECTED_WAREHOUSES_FROM_SOURCE`

Tool to list warehouses connected to a Source. Use when you need to retrieve warehouses for a given source ID.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `sourceId` | string | Yes | ID of the Source to retrieve warehouses for. |
| `pagination` | object | Yes | Pagination parameters for the request. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### List Delivery Metrics Summary from Destination

**Slug:** `SEGMENT_LIST_DELIVERY_METRICS_SUMMARY_FROM_DESTINATION`

Get an event delivery metrics summary from a Destination. Primary attempt uses Segment Public API; fallback to legacy app host if needed. On HTML fallback responses, returns a minimal valid envelope to maintain contract.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `endTime` | string | No | Filter events that happened before this time (ISO-8601). Defaults to now. |
| `sourceId` | string | Yes | Source id linked to the destination |
| `startTime` | string | No | Filter events that happened after this time (ISO-8601). Defaults depend on granularity. |
| `granularity` | string ("DAY" | "HOUR" | "MINUTE") | No | Granularity of the metrics aggregation |
| `destinationId` | string | Yes | Destination identifier |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### List Schema Settings in Source

**Slug:** `SEGMENT_LIST_SCHEMA_SETTINGS_IN_SOURCE`

Retrieve schema configuration settings for a Source.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `sourceId` | string | Yes | ID of the Source |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Segment Page View

**Slug:** `SEGMENT_PAGE`

Tool to record a page view via Segment HTTP Tracking API. Use when sending page views with optional page name and properties.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `name` | string | No | Name of the page. Optional. |
| `userId` | string | No | Unique user identifier. Exactly one of 'userId' or 'anonymousId' must be provided. |
| `context` | object | No | Additional contextual information (e.g., ip, locale, device). |
| `writeKey` | string | No | Write key for authentication if not using Basic or Bearer auth in headers. |
| `messageId` | string | No | Unique id for deduplication; Segment auto-generates one if omitted. |
| `timestamp` | string | No | ISO-8601 timestamp when the event occurred; if omitted, server time is used. |
| `properties` | object | No | Free-form dictionary of page properties (e.g., path, url). |
| `anonymousId` | string | No | Pseudo-unique ID for anonymous users. Exactly one of 'userId' or 'anonymousId' must be provided. |
| `integrations` | object | No | Per-destination enable/disable controls (case-sensitive keys). |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Remove Source Write Key

**Slug:** `SEGMENT_REMOVE_SOURCE_WRITE_KEY`

Tool to remove a write key from a Source. Use when you need to revoke an existing write key for security or rotation.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `sourceId` | string | Yes | The unique identifier of the Source. |
| `writeKey` | string | Yes | The write key to remove from the Source. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Segment Screen Event

**Slug:** `SEGMENT_SCREEN`

Tool to record a mobile app screen view. Use when tracking screen views in a mobile app via Segment HTTP Tracking API.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `name` | string | No | Name of the screen. |
| `userId` | string | No | Unique user identifier. Exactly one of 'userId' or 'anonymousId' must be provided. |
| `context` | object | No | Additional contextual information (e.g., ip, locale, device). |
| `writeKey` | string | No | Write key for authentication if not using Basic or OAuth headers. |
| `timestamp` | string | No | ISO-8601 timestamp when the screen event occurred; if omitted, server time is used. |
| `properties` | object | No | Free-form dictionary of screen properties. |
| `anonymousId` | string | No | Pseudo-unique ID for anonymous users. Exactly one of 'userId' or 'anonymousId' must be provided. |
| `integrations` | object | No | Per-destination enable/disable controls (case-sensitive keys). |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Segment Track Event

**Slug:** `SEGMENT_TRACK`

Tool to record a custom user event via Segment HTTP Tracking API. Use when sending events to Segment with valid identity.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `event` | string | Yes | Name of the action performed (e.g., 'Item Purchased'). |
| `userId` | string | No | Unique user identifier. Exactly one of 'userId' or 'anonymousId' must be provided. |
| `context` | object | No | Additional contextual information (e.g., ip, locale, device). |
| `writeKey` | string | No | Write key for authentication if not using Basic or OAuth headers. |
| `timestamp` | string | No | ISO-8601 timestamp when the event occurred; if omitted, server time is used. |
| `properties` | object | No | Free-form dictionary of event-specific properties (e.g., revenue). |
| `anonymousId` | string | No | Pseudo-unique ID for anonymous users. Exactly one of 'userId' or 'anonymousId' must be provided. |
| `integrations` | object | No | Per-destination enable/disable controls (case-sensitive keys). |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |

### Update Source

**Slug:** `SEGMENT_UPDATE_SOURCE`

Tool to update a Source's metadata and settings. Use when you need to modify an existing Source after confirming its ID.

#### Input Parameters

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `name` | string | No | Human-readable name for the Source (displayName). |
| `slug` | string | No | Slug that identifies the Source (config name). |
| `enabled` | boolean | No | Whether the Source can send data. |
| `settings` | object | No | Key-value settings specific to the Source type; see Sources catalog for required options. |
| `sourceId` | string | Yes | The Source ID. Length 1–255 characters. |

#### Output

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `data` | string | Yes | Data from the action execution |
| `error` | string | No | Error if any occurred during the execution of the action |
| `successful` | boolean | Yes | Whether or not the action execution was successful or not |
