Documentation menu

API reference

Stream token

A single endpoint that authenticates the realtime event stream WebSocket — mint it on your backend, hand it to the browser.

POST/stream/token

Mint a short-lived token for the realtime event stream WebSocket. Call it from your backend, then hand the token to the browser. Returns { token: string, ttl_seconds: integer }.

curl https://sauti-pbx.services.co.ke/api/stream/token \
  -H "Authorization: Bearer sk_live_..."

// → 200 OK
{ "token": "eyJhbGc...", "ttl_seconds": 60 }

The token only lasts long enough to open the socket, so mint it right before connecting rather than caching it. See Connecting for the full WebSocket handshake.