Skip to content

Stream tokens ​

API keys must never reach a browser. For browser and agent-desktop access to the realtime stream, your server mints a stream token: short-lived, read-only, and scoped.

ts
const { token, expires_at } = await vi.streamTokens.create({
  call_id: "call_123",                 // optional: restrict to one call
  scopes: ["transcript", "assist"],    // default ["events", "transcript"]
  ttl_sec: 900,                        // default 3600, max 86400
});
python
t = client.stream_tokens.create(call_id="call_123", scopes=["transcript", "assist"], ttl_sec=900)
bash
curl -X POST https://api.kolwire.com/v1/stream-tokens \
  -H "Authorization: Bearer $KOLWIRE_API_KEY" -H "Content-Type: application/json" \
  -d '{"call_id":"call_123","scopes":["transcript","assist"],"ttl_sec":900}'

Claims ​

A token is a signed, opaque string. Its claims:

ClaimMeaning
wsWorkspace id.
callOptional: only events of this call are delivered.
scopesWhat the holder may receive.
expExpiry (Unix seconds). Connections are refused after it.

Scopes ​

ScopeGrants
eventsCall lifecycle, messaging, queue and agent status events.
transcriptcall.transcript.partial / call.transcript.final.
assistcall.assist.suggestion.
audioLive call audio (listen-in).

Guidelines ​

  • Authorize your own user before minting (e.g. "is this rep assigned to this call?").
  • Scope to a call_id whenever the UI is about one call.
  • Keep TTLs short and give the client a function that fetches a fresh token — the SDK StreamClient calls it on every reconnect.