Live Video API
Preview
REST

Tokens & auth

Client join tokens authorize a user to enter a specific room with a defined role and expiry. Mint them with REST Basic Auth on your server; pass only the JWT to the Web SDK or native client.

Scoped JWTs

Each token is bound to one roomId, one identity, and one role — not a global API key.

Configurable TTL

From 60 seconds to 24 hours. Default one hour. Re-issue for long sessions.

Role enforcement

Media plane enforces publish/subscribe rights for host, participant, and viewer.

No REST secrets in clients

Browsers and mobile apps only ever receive join tokens minted by your backend.

Default TTL

3600s

1 hour

Min / max TTL

60–86400

seconds

Roles

3

host · participant · viewer

Identity max

64

characters

POST
/v1/video/rooms/:roomId/tokens
Preview

Mint a short-lived join token for a single identity. The room must be in ready or active status. Issuing a new token for the same identity does not automatically kick an existing connection unless you set session uniqueness policy in the dashboard.

Path parameters

FieldTypeRequiredDescription
roomIdstring
required
Target room (e.g. rm_8f3a2c1b0e9d).

Request body

application/json
JSON
{
"identity": "user_ama",
"role": "participant",
"ttl": 1800
}
FieldTypeRequiredDescription
identitystring
required
Unique user key for this join (max 64 chars).
rolestring
required
host | participant | viewer
ttlintegeroptionalSeconds until token expires. Default 3600.

Response

JSON
{
"success": true,
"code": "VIDEO_TOKEN_ISSUED",
"message": "Join token issued.",
"requestId": "REQ-1782001000400",
"timestamp": "2026-07-12T10:16:00.000Z",
"data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb29tSWQiOiJybV84ZjNhMmMxYjBlOWQiLCJpZGVudGl0eSI6InVzZXJfYW1hIiwicm9sZSI6InBhcnRpY2lwYW50IiwiZXhwIjoxNzIwNzg4MjAwfQ.signature",
"roomId": "rm_8f3a2c1b0e9d",
"identity": "user_ama",
"role": "participant",
"ttl": 1800,
"expiresAt": "2026-07-12T10:46:00.000Z",
"wsUrl": "wss://video.sendexa.co/rtc"
}
}

Code examples

Bash
curl -X POST 'https://api.sendexa.co/v1/video/rooms/rm_8f3a2c1b0e9d/tokens' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic YOUR_DASHBOARD_BASE64_TOKEN' \
-d '{
"identity": "user_ama",
"role": "participant",
"ttl": 1800
}'

Roles in depth

host

Full publish (camera, mic, screen) and subscribe.

  • Can request mute / remove via client host APIs (when enabled)
  • Typical: agent, teacher, interviewer, clinician
  • Usually 1 host; multiple hosts allowed if you issue them
participant

Publish and subscribe like a normal meeting guest.

  • Camera / mic / screen share (self-managed)
  • Cannot end room from client privilege alone
  • Typical: customer, student, candidate
viewer

Subscribe only — no uplink A/V publish.

  • Ideal for webinars and silent observers
  • Still counts toward maxParticipants
  • Publish attempts are rejected by the SFU
TTL guidance
Use caseSuggested TTLNotes
OTP / KYC video check300–900Short window reduces leak risk if token is logged
Support / telehealth1800–3600Re-issue mid-call if session may run long
Classroom / webinar7200–14400Or refresh tokens every hour from your app
Scheduled future joinDo not pre-mint early; create token when the user opens the join page

Using the token in the client

JavaScript
// After your backend returns { roomId, token }
import { Room } from '@sendexa/video-client';
const room = new Room({
roomId: session.roomId,
token: session.token,
media: { audio: true, video: true },
});
try {
await room.connect();
} catch (e) {
if (e.code === 'TOKEN_EXPIRED') {
// Call your backend to mint a fresh token, then reconnect
const fresh = await fetch('/api/video/refresh', { method: 'POST' }).then((r) => r.json());
room.updateToken(fresh.token);
await room.connect();
}
throw e;
}
Security checklist
  • Authenticate the end user in your app before minting any token
  • Authorize room access (e.g. only assigned agent + customer for that ticket)
  • Map identity to your user ID — never accept client-supplied roles blindly
  • Prefer HTTPS-only delivery of tokens; avoid logging full JWTs
  • Treat leaked tokens as compromised — end the room or wait for TTL expiry

Common errors

HTTPCodeCause
400INVALID_TOKEN_PARAMSMissing identity/role or invalid TTL
400INVALID_IDENTITYidentity empty, too long, or illegal characters
401UNAUTHORIZEDBad Basic Auth on the REST call
404ROOM_NOT_FOUNDroomId unknown or deleted
409ROOM_ALREADY_ENDEDRoom not accepting new tokens
409ROOM_AT_CAPACITYparticipantCount already at maxParticipants
429RATE_LIMIT_EXCEEDEDToo many token mints — back off