Segment REST API
Customer data platform API for collecting and routing data
Segment is a customer data platform that collects, cleans, and routes user event data to analytics tools and data warehouses. The API allows developers to send tracking events, identify users, manage workspaces and sources, and control data pipelines programmatically. It's widely used for implementing unified customer data infrastructure across web, mobile, and server-side applications.
https://api.segment.io/v1
API Endpoints
| Method | Endpoint | Description |
|---|---|---|
| POST | /track | Track user actions and events with custom properties |
| POST | /identify | Identify users by userId or anonymousId and record their traits as key-value pairs |
| POST | /page | Record page views with associated properties |
| POST | /screen | Record mobile screen views with name and optional properties for app analytics |
| POST | /group | Associate individual users with a group or account |
| POST | /alias | Merge user identities by linking a new userId to a previous identifier or anonymousId |
| POST | /batch | Send multiple events in a single API call |
| GET | /workspaces | List all workspaces in your account, returning workspace IDs and names |
| GET | /workspaces/{workspace_id}/sources | List all sources in a workspace, requires workspace_id in the path |
| POST | /workspaces/{workspace_id}/sources | Create a new source in a workspace, requires workspace_id and source metadata |
| GET | /workspaces/{workspace_id}/destinations | List all destinations connected to a workspace, requires workspace_id in path |
| PUT | /workspaces/{workspace_id}/destinations/{destination_id} | Update destination configuration and settings |
| GET | /catalog/sources | Get the catalog of available source types with integration metadata and capabilities |
| GET | /catalog/destinations | Get the catalog of available destination types with supported features and configuration options |
| GET | /tracking-plans/{tracking_plan_id} | Retrieve a specific tracking plan and its schema |
Sponsor this page
AvailableReach developers actively building with Segment. See live pageview data and self-serve checkout — your slot goes live in minutes.
View inventory & pricing →Code Examples
curl -X POST https://api.segment.io/v1/track \
-u YOUR_WRITE_KEY: \
-H 'Content-Type: application/json' \
-d '{
"userId": "user123",
"event": "Product Purchased",
"properties": {
"product_id": "prod_abc123",
"price": 49.99,
"currency": "USD"
},
"context": {
"ip": "8.8.8.8"
},
"timestamp": "2024-01-15T10:30:00Z"
}'
Use Segment from Claude / Cursor / ChatGPT
Get a hosted MCP endpoint for Segment. Paste your Segment API key, copy back one URL, drop it into Claude Desktop, Cursor, or any AI client that supports remote MCP. Your AI calls Segment directly with your credentials — no local install, works on mobile.
track_event
Track user events with custom properties for analytics and data routing
identify_user
Identify users and update their traits across all connected destinations
batch_events
Send multiple tracking events in a single batch for efficiency
manage_sources
List, create, and configure data sources in Segment workspaces
query_destinations
Retrieve and manage destination configurations and data flow settings
Connect in 60 seconds
Paste your Segment key → get an MCP URL → paste into Claude/Cursor. Hosted by IOX, encrypted at rest.
Connect Segment to your AI →