Create an HTTP API source in the Segment workspace and copy the Write Key from the source's Overview tab.
Authenticate requests using HTTP Basic Authentication with the Write Key as the username and an empty string as the password.
Send individual events to https://api.segment.io/v1/track or /v1/identify with a JSON body containing userId (or anonymousId), event name, and properties.
For higher throughput, batch multiple events into a single POST to https://api.segment.io/v1/batch — the batch endpoint accepts up to 500 KB per request and up to 2,500 events; each individual event must be under 32 KB.
Check the HTTP response code: 200 indicates acceptance into the pipeline; inspect for error messages in the response body if a non-2xx code is returned.
Known gotchas
The /v1/batch endpoint enforces a 500 KB per-request body limit and a 32 KB per-event limit — payloads exceeding these will be rejected.
Segment's Tracking API accepts events asynchronously; a 200 response means the event was received, not that it has been delivered to all connected destinations.
Including a messageId in each event payload enables idempotent delivery; without it, retried requests may result in duplicate events in downstream destinations.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp