When
AUTH_REQUIRED=true, all endpoints below require a bearer token in the Authorization header.Why Sayna wraps LiveKit
- Prevents exposing LiveKit API keys or admin endpoints to client applications.
- Enforces Sayna authentication and authorization for every management call.
- Keeps multi-tenant isolation consistent across REST and WebSocket flows.
Room ownership and access control
Room access is controlled via themetadata.auth_id field stored in room metadata. When authentication is enabled:
- Room creation: When you request a token for a room that doesn’t exist, Sayna creates it and sets
metadata.auth_idto your tenant ID. - Room access: All room-scoped operations verify that
room.metadata.auth_idmatches your authenticatedauth.id. - Access denied: Unauthorized access returns
404 Not Found(masked for security) or403 Forbiddendepending on the operation.
Room names are no longer modified or prefixed. You send and receive clean room names exactly as specified.
Backward compatibility
Whenauth.id is absent (unauthenticated mode), all rooms are accessible. This maintains compatibility with deployments that don’t require authentication.
Endpoint overview
| Endpoint | Use case |
|---|---|
POST /livekit/token | Mint participant tokens and create rooms. API reference |
GET /livekit/rooms | List rooms for the current tenant. API reference |
GET /livekit/rooms/{room_name} | Inspect room details and participants. API reference |
DELETE /livekit/participant | Remove a participant from a room. API reference |
POST /livekit/participant/mute | Mute or unmute a participant track. API reference |
POST /sip/call | Initiate an outbound SIP call. API reference |
POST /sip/transfer | Transfer a SIP participant to a new destination. API reference |
Typical flow
Create a room and get a token
Call
POST /livekit/token with your room name. If the room doesn’t exist, Sayna creates it and sets metadata.auth_id to your tenant ID before returning the token.List rooms
Call
GET /livekit/rooms to discover active rooms. Only rooms with matching metadata.auth_id are returned.Moderate participants
Disconnect a participant with
DELETE /livekit/participant or mute a track with POST /livekit/participant/mute.Error handling
Room-scoped operations return specific errors for access control:| Status | Meaning |
|---|---|
403 Forbidden | Room exists with a different tenant’s auth_id (token endpoint only). |
404 Not Found | Room not found or access denied (masked for security on other endpoints). |
500 Internal Server Error | LiveKit not configured or operation failed. |