Create Session

Beta
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

agent_idstringRequired

Agent id (prefixed external id, agent_...).

Headers

Speechify-VersionstringOptional

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 headers

X-Request-IDstring
Unique identifier for this request, present on every response (2xx and non-2xx alike). If the caller sends an `X-Request-ID` request header the server echoes it back (sanitized and length-capped) so one logical request can be traced end-to-end; otherwise the server generates a fresh value. Log it on every response and quote it in support requests - it is the stable handle that ties your observation to Speechify's server-side logs, and it matches the `request_id` field in the error envelope.
RateLimit-Limit-Callsinteger

Active-call concurrency budget: the per-workspace cap on simultaneously-active voice calls (the voice analog of a token axis). Sent on successful call-start responses (web session, outbound call).

RateLimit-Remaining-Callsinteger

Active-call concurrency budget: free active-call slots after this call reserved one. 0 on a 429 that rejected for concurrency exhaustion (concurrency_limit_reached).

Response

The created session with its realtime token + URL.

conversationobject
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