/conversation/connectOpen a session for an agent. Server-side; uses your API key directly.
Connect
Starts a WebRTC session for the given agent. You get back a session_id and an ice_config. Pass the ice_config.iceServers directly into new RTCPeerConnection({ iceServers }) on the browser side.The session_id is the same UUID as the underlying conversation and call records, so you can use it later for GET /conversations/{id}/transcript and GET /recordings/{id}/audio once the call ends.Each call creates persistent records; do not invoke in a tight retry loop. Public agents: if the agent has public_access on, a browser or app can call this endpoint with only the agent_id and no API key. Restrict which sites may embed it with the agent's allowed_origins.
Request body
2agent_idstring (UUID)requiredThe agent UUID to start the session with. Must belong to the calling account.
dynamic_variablesobjectoptionalValues for the agent's
{{variable}}placeholders, for this session only — nothing is saved back to the agent. Same shape asPOST /calls/trigger: a flat object of strings, numbers or booleans. Values you send override the agent's stored defaults; a placeholder with neither is left as written. Keys may not start withsystem__— those are filled in for you, andsystem__caller_id/system__called_numberare empty on a browser call because there is no phone leg. UnlikePOST /calls/trigger, an unsupportedsystem__placeholder is left as written rather than rejected. Ignored when the session itself is keyless — a public agent reached without an API key, or a call token — because those credentials live in the browser; those sessions use the agent's own defaults. Reaching that same public agent with your API key personalizes normally: what decides is the credential, not the agent.
Errors
7Missing or invalid API key.
Send a valid X-API-Key header or bearer token.
API key lacks the calls:write scope.
Use a key with the required scope.
Account is hard-blocked: subscription canceled past the grace window, or balance is zero with no payment method on file.
Re-subscribe, add a payment method, or top up credits, then retry.
The agent_id does not exist or does not belong to this account.
Verify via GET /api/v1/agents.
agent_id missing or not a valid UUID, or invalid dynamic_variables — not a flat object of strings, numbers and booleans, or a key using the reserved system__ prefix.
Send a JSON body with a valid agent_id. If you send dynamic_variables, keep it a flat object of scalar values and drop any system__ key.
The account or shared backend has no free slot. Response body includes retry_after; response carries a Retry-After header.
Honor the Retry-After header and retry.
No backend slot can be reserved at all.
Retry shortly. If persistent, contact our team at [email protected].
