Skip to main content
POST
Creates a LiveKit room, dispatches the agent into it and returns a short-lived participant token for the caller. The Voice SDK calls this endpoint for you. There are two authentication modes. Both send Authorization: Bearer <credential>. For a publishable key, responses to an allowed origin carry CORS headers. So do invalid_key and origin_not_allowed whenever the request has a valid Origin, so the browser can read the error.
string
required
Bearer pk_live_... for a publishable key, or Bearer <access_token> for a secret key
string (UUID)
required
The agent to talk to
string
Display name of the caller in the room. Up to 80 characters. Defaults to Guest.
object
Secret key only; ignored with a publishable key. Identifies your end user to the agent.
object
Background data about the caller, passed to the agent. String values only, at most 4096 bytes of JSON. This is data, never instructions.
integer
default:"900"
Participant token lifetime, from 60 up to 900 with a publishable key or 3600 with a secret key.

Response

string
Session identifier, vs_ followed by 24 characters
object
The agent: id and name
object
Connection details: url (the wss:// LiveKit server), room, and token (the participant JWT)
string (date-time)
When the participant token expires
The response is sent with Cache-Control: no-store.

Errors

Errors use one shape: { "error": "<code>", "error_description": "<message>" }.

CORS preflight

OPTIONS /v1/voice/sessions answers 204. CORS headers echo the Origin only when the preflight can proceed for it. Browsers send no Authorization header on a preflight, so the key and origin are checked for real on the POST.