Skip to main content

Overview

The edge is the data plane: SDKs download snapshots, send events, and open realtime streams here. The TypeScript SDK calls these routes for you; use this page when you write your own client or debug traffic.

Authentication

Only SDK keys work on the edge. Each key is bound to one organization, project, and environment, and carries explicit data-plane scopes: A missing scope returns 403. A management API key, service account token, or any other credential returns the same generic 401 as an invalid SDK key. Authenticated traffic is limited per key by Cloudflare’s distributed rate limiter. The edge usage rollup sends only key ids (never secrets) to the control plane and updates each key’s lastUsedAt at most once per minute. See SDK keys, management API keys, and service account tokens.

GET /sdk/v1/snapshot

Returns the current snapshot for the key’s environment.
string
required
Bearer followed by an SDK key with snapshot:read.
string
The ETag from the previous response. The edge returns 304 if the snapshot has not changed.
Responses Client SDK keys also receive X-Shipd-Auto-Traits on 200 and 304 when geolocation is available: country, region, city, and timezone from Cloudflare geolocation. The raw IP address is never included.
Example 200 body
The example is abbreviated. See Snapshots for the full envelope. Errors Related: Snapshots · Local evaluation

POST /sdk/v1/events

Accepts a batch of evaluation, diagnostic, and identify events.
string
required
Must be application/json.
string
ISO-8601 time the batch was sent. Optional. When present it must be an ISO-8601 timestamp. The TypeScript SDK always sends it.
Event[]
required
1–100 events. The whole body must be 256 KiB or smaller.
Every event has a type and an ISO ts. Evaluation, error, unregistered-flag, identify, and timing events also carry snapshotVersion, which may be null before a snapshot is available.
Example request body
Responses Evaluation analytics are stored only for production environments when analytics is configured; non-production evaluation events are never stored. Client SDK identify events also pick up country, region, city, and timezone from the request; explicit traits win. Server SDK keys are not enriched. Disable events in the SDK with events: false. Errors Related: Identify users · Usage and limits

POST /sdk/v1/stream-ticket

Mints a short-lived HMAC ticket for authenticating the WebSocket stream. Browsers cannot set Authorization on a WebSocket, so the SDK mints a ticket with the Bearer header first.
string
required
Bearer followed by the same SDK key you use for snapshot fetches. Requires stream:connect.
Responses
Example 200 body
Errors Related: WS /sdk/v1/stream (below)

GET /sdk/v1/identity

Returns the stored trait overlay for an identified user to server SDK keys with identity:read. Client SDK keys receive 403. Current server SDKs do not fetch the overlay automatically; pass traits in the evaluation context. Browser clients cannot load it with their client SDK key.
string
required
The user id passed to identify().
string
required
Bearer followed by a server SDK key with identity:read.
Responses
Example 200 body
Errors Related: Identify users · SDK

WS /sdk/v1/stream

Pushes snapshot invalidations for one environment. The channel never carries snapshots or analytics payloads; after an invalidation, you fetch the snapshot over HTTP.
string
required
A ticket from POST /sdk/v1/stream-ticket.
1

Mint a ticket

Call POST /sdk/v1/stream-ticket with your SDK key. The TypeScript SDK does this before each connect.
2

Connect

Open wss://ws.useshipd.com/sdk/v1/stream?ticket=…. The ticket must be valid, unexpired, and bound to the environment of an active SDK key.
3

Receive connected

Wait for connected with connectionId, environmentId, and snapshotVersion. The socket is already bound to that environment’s fanout.
4

Recover gaps (optional)

Send subscribe with the same environmentId and a stale lastKnownVersion only when you need gap recovery, for example when configuration changed between connected and client registration. Subscribing to another environment is rejected.
5

Handle updates

On snapshot.updated or snapshot.resync, fetch the snapshot with GET /sdk/v1/snapshot.
Application ping/pong plus a transport heartbeat keep the socket alive. Errors. Client-facing authentication errors are generic. Revoked keys are disconnected. Revocation. Revoked keys stop authorizing new HTTP calls as revocation propagates. Existing sockets revalidate at least every 60 seconds. The end-to-end revocation target is 120 seconds. Deprecated: ?sdkKey= authentication. Passing the SDK key in the URL is deprecated because URLs can end up in proxy and access logs. Migrate to POST /sdk/v1/stream-ticket and ?ticket=. Legacy authentication is rejected by default. Compatibility support will not be removed before March 1, 2027; migrate clients to tickets before connecting. Related: Architecture · What happens if shipd is down?

Compatibility

The SDK supports snapshot schema 1 and stream protocol 1. It rejects newer schemas and keeps the last good snapshot. Related: SDK · Node.js and server runtimes · Browser · Errors