Connect to AI
Analytics & Data Basic Auth

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.

Base URL https://api.segment.io/v1

API Endpoints

MethodEndpointDescription
POST/trackTrack user actions and events with custom properties
POST/identifyIdentify users by userId or anonymousId and record their traits as key-value pairs
POST/pageRecord page views with associated properties
POST/screenRecord mobile screen views with name and optional properties for app analytics
POST/groupAssociate individual users with a group or account
POST/aliasMerge user identities by linking a new userId to a previous identifier or anonymousId
POST/batchSend multiple events in a single API call
GET/workspacesList all workspaces in your account, returning workspace IDs and names
GET/workspaces/{workspace_id}/sourcesList all sources in a workspace, requires workspace_id in the path
POST/workspaces/{workspace_id}/sourcesCreate a new source in a workspace, requires workspace_id and source metadata
GET/workspaces/{workspace_id}/destinationsList 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/sourcesGet the catalog of available source types with integration metadata and capabilities
GET/catalog/destinationsGet 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

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 →

Related APIs