Skip to main content
POST
/
livekit
/
token
Handler for POST /livekit/token endpoint
curl --request POST \
  --url https://api.sayna.ai/livekit/token \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "participant_identity": "user-alice-456",
  "participant_name": "Alice Smith",
  "room_name": "conversation-room-123"
}
'
{
  "livekit_url": "ws://localhost:7880",
  "participant_identity": "user-alice-456",
  "room_name": "conversation-room-123",
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
Mint LiveKit access tokens for human participants so they can join the room that your WebSocket session announced. Sayna handles the LiveKit signing key; you simply provide room + participant inputs.

Authorizations

Authorization
string
header
required

JWT token obtained from the authentication service. Required when AUTH_REQUIRED is enabled.

Body

application/json

Request body for generating a LiveKit token

Example

{
"room_name": "conversation-room-123",
"participant_name": "Alice Smith",
"participant_identity": "user-alice-456"
}
participant_identity
string
required

Unique identifier for the participant (e.g., "user-123")

Example:

"user-alice-456"

participant_name
string
required

Display name for the participant (e.g., "John Doe")

Example:

"Alice Smith"

room_name
string
required

The LiveKit room name to generate a token for

Example:

"conversation-room-123"

Response

Token generated successfully

Response containing the generated LiveKit token

Example

{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"room_name": "conversation-room-123",
"participant_identity": "user-alice-456",
"livekit_url": "ws://localhost:7880"
}
livekit_url
string
required

The LiveKit server URL to connect to

Example:

"ws://localhost:7880"

participant_identity
string
required

Echo back the participant identity for client confirmation

Example:

"user-alice-456"

room_name
string
required

Echo back the room name for client confirmation

Example:

"conversation-room-123"

token
string
required

The generated JWT token for LiveKit

Example:

"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."