API reference

Relay and backend API

HTTP and WebSocket endpoints behind live streams.

stream-watch-ticket

POST https://clahbbkqdskkhymymoge.supabase.co/functions/v1/stream-watch-ticket. Call it from your backend, with x-api-key set to the auth part of your API key (before the .).

ResponseMeaning
200{ ticket, expiresIn: 120, stream }
400 bad_stream_idstreamId is missing or not a UUID.
401 missing_api_keyNo x-api-key header.
401 invalid_api_keyUnknown key.
403 revoked_api_keyThe key was revoked.
403 stream_not_watchableThe stream does not exist, or the key’s holder may not watch it: only their own personal streams, public streams, or streams of a project they can view (a project key: only its own project).
500 ticket_signing_unavailableThe operator has not configured WATCH_TICKET_SECRET.

stream-token

POST https://clahbbkqdskkhymymoge.supabase.co/functions/v1/stream-token with x-api-key (the auth part) returns { token, userId, expiresIn: 900, maxRateHz, relayUrl }. The token is a pt. publisher token accepted only by stream-publisher (register, heartbeat, delete, resolve_org), which returns the pp. tickets the relay accepts for publishing. See Publishing streams. A key whose project is archived gets 403 project_archived: unarchive the project or use another key.

Relay WebSocket

HTTP
GET wss://<relay>/v1/streams/<streamId>/watch      (viewers: session JWT or wt. ticket)
GET wss://<relay>/v1/streams/<streamId>/publish    (publishers: pp. ticket only)
Sec-WebSocket-Protocol: kymoscope-live.v1, bearer.<credential>
StatusMeaning
101Connected.
400The stream id is not a UUID.
401Missing, invalid or expired credential; also any ticket on the publish route.
403The credential is valid but not for this stream.
426Not a WebSocket upgrade.
429Too many connection attempts from this address.
close 4401The credential expired on an open socket. Renew it in-band before expiry with {"type":"auth","token":…}.
502The relay could not reach the authorisation service.