- Public API (workspace management, everything except
tracking.*): a Public API token, created by a Workspace Owner under Settings > Workspace settings > Access Management > Tokens (choose the Public API type, not the legacy Config API). Segment offers the Public API on the Team and Business plans only; on the Free plan these calls answer 403. - Tracking API (
tracking.identify,track,page,screen,group,alias,batch): the write key of a source (the source’s Settings > API Keys). Store it as the account’swrite_key, or pass thewriteKeyoption. On the Free plan, connect the write key itself as the key: tracking works and the Public API calls do not.
- Region. An EU workspace lives on
eu1.api.segmentapis.comand takes events onevents.eu1.segmentapis.com: set the account’sregiontoeu(or pass theregionoption). The US hosts answer an EU token with 403. - Tracking answers 200 for almost everything. Segment accepts any call it can parse, then may drop it (a wrong write key, a payload over 32 KB). A 200 means received, not delivered: check the source’s debugger. Events go on to every destination connected to the source and cannot be taken back except through a regulation.
- Regulations permanently delete data.
regulations.createstarts a deletion or suppression run over the subject ids you pass; it cannot be cancelled. Pollregulations.getuntiloverallStatusisFINISHED,PARTIAL_SUCCESSorFAILED. - Write keys are secrets. Sources embed their
writeKeys;sources.createWriteKeymints one andsources.removeWriteKeycuts off every sender using it. - Paging. List routes take
pagination: { count, cursor }(count up to 200 on most) and returnpagination.next; pass it back ascursor. The plugin sends a page size when you pass none. - Versions. Each operation is pinned to the newest stable version Segment documents for it (v1 on most; v2 for warehouses; alpha or beta where nothing else exists): alpha routes can change.
- Webhooks. To receive events, add a Webhooks destination to a source, point it at your Corsair webhook URL and set a Shared Secret. Segment signs each request with an HMAC-SHA1
X-Signature, and the plugin checks it against the same secret: store it as the account’s webhook signing secret (webhook_signature), or pass thewebhookSecretoption. Requests without a valid signature are refused. Segment signs only the first event of a batched delivery, so keep batching off in the destination: a batch is accepted (asevents.batch) only when the signature covers the whole body.
- 207 typed API operations
- 8 incoming webhook event types
Setup
1
Install
2
Add the plugin
corsair.ts
multiTenancy: true, scope calls with corsair.withTenant(id). See Quick start for KEK + Hub keys, and Multi-tenancy for account isolation.3
Choose authentication
- API Key (Recommended)
Store the Segment API key before the first call: More: API Key
pnpm corsair setup --plugin=segment --tenant=acme api_key=<your-key> (leave out --tenant without multiTenancy), or pass it as key in the plugin options. With Hub, each tenant enters their own key on the connect page. See API key auth.4
Connect a tenant
Mint a connect link and send the tenant to it. Hub hosts the page and delivers the result to your app — see Connect / OAuth.
Example API calls
List the workspace sourcesWebhooks
This plugin registers 8 webhook event types. Configure the provider to POST to your Corsair HTTP handler, then usewebhookHooks on the plugin factory.
See Webhooks for every event path and payload shape, and Webhooks concept for routing.
What’s next
API reference
Every
segment.api.* operation with input and output types.Webhooks
Event paths, payloads, and
webhookHooks examples.Connect / OAuth
createLink, Hub delivery, and tenant connect flows.
Use with agents
Expose this plugin’s operations as MCP tools.