Create Session

Mint a realtime voice session for the given agent. Widget-friendly counterpart to `createConversation` — same response shape, dual authentication: * **Authenticated (Bearer)**: works for any agent the caller owns. Typical server-to-server flow where the embedding site's backend mints a token and hands it to the browser so the API key never reaches the client. * **Unauthenticated**: works only when `agent.is_public = true` AND the request's `Origin` header matches `agent.allowed_origins` (or that list is empty). When `agent.hostname_allowlist` is non-empty, the `Origin` hostname must additionally be a member of that list. Used directly by the `<speechify-agent>` web component. Responds with the same `CreateConversationResponse` as `createConversation`.

Path parameters

idstringRequired

Request

This endpoint expects an object.
user_identitystringOptional

Opaque identifier for the end-user (e.g. your app’s user ID). Stamped onto the conversation. Optional - defaults to an anonymous per-session ID.

dynamic_variablesmap from strings to anyOptional

Per-session variable overrides that merge on top of the agent’s stored variable defaults for this one session. Keys in the reserved system__ namespace are rejected at this boundary. Values must match the declared type of the corresponding variable definition on the agent (a string type expects a JSON string, number expects a JSON number, etc.).

Response

The created session with its realtime token + URL.

conversationobject
roomstring
tokenstring

Short-lived realtime session access token (JWT).

urlstring

Realtime session wss:// URL to connect to.

Errors

401
Unauthorized Error
403
Forbidden Error
404
Not Found Error