Server
Token API
Mint a room token and user token with POST /api/v1/token.
Mints a token to join a room, and creates the room if it doesn't exist. The kits call this for you, so you only need this page if you mint from your backend or use the media client.
POST https://stream.zavryn.online/api/v1/tokenAuthenticate
Send X-App-Id, plus one of these:
X-App-Key: from an app. See Credentials and auth.X-App-Secret: from your backend. The Server Secret must never ship in an app.
Request
| Field | Required | Description |
|---|---|---|
identity | Yes | A unique user id, up to 200 characters |
room_name | Yes | The room. Letters, numbers and _ - : ., up to 200 characters. |
type | Yes | audio_room or live_stream. It must be enabled on the project. |
name | No | The user's display name |
role | No | host, admin, guest, audience or visitor. The default is audience. |
metadata | No | Custom data attached to the participant, up to 10 KB |
display_name | No | The room's display name, used when it's created |
room_owner_id | No | The owner's identity. This user always joins as host. |
seat_count | No | Seats to create with the room, from 1 to 100. Default 9. Ignored for live_stream. |
seat_mode | No | free or request. Default free. Ignored for live_stream. |
host_seat | No | A seat reserved for identity when the room is created. Ignored for live_stream. |
mode_id | No | Your own identifier for the room's mode |
device_id | No | A device id, used so a user has one active session |
In a live_stream room, only the verified owner becomes host. Everyone else becomes audience, whatever role they send. See Stage and roles.
Response
{
"token": "eyJhbGciOiJIUzI1NiIs...",
"url": "wss://...",
"room_name": "my-room",
"user_token": "eyJzdWIiOi...",
"ws_url": "wss://stream.zavryn.online/ws"
}| Field | Description |
|---|---|
token | Connects to the room's media |
url | The media server to connect to. Always use this value, and don't save it. |
user_token | The bearer for in-room requests, bound to this identity |
ws_url | The signaling endpoint |
room_messaging | Only when your project uses room messaging: url and batch_ms |
A token is valid for one hour to join. Once connected, a user can stay with no time limit.
Errors
| Status | Message |
|---|---|
422 | identity and room_name are required |
422 | type must be one of: audio_call, video_call, live_stream, audio_room |
422 | identity must be a string of max 200 characters |
422 | room_name must be alphanumeric (with _ - : .) and max 200 characters |
422 | role must be one of: host, admin, guest, audience, visitor |
403 | Type '<type>' is not enabled for this project |
403 | User is banned |
403 | Project is suspended |
429 | Maximum concurrent rooms reached |
500 | Failed to generate token |