POST /api/v1/conversations gives you a conversation id and a token; the token authorizes the audio connection and the answer poll for that one conversation.
Before you start
You need the agent ID of a published agent.GET /api/v1/agents/{agent_id}/public returns the agent’s title, questions list, and agent_speaks_first flag. Use it to render your form UI before the call starts.
curl
agent_speaks_first tells you whether to show a “waiting for agent” state or a push-to-talk prompt on connect.
Run the call
1
Create the conversation
The server generates the conversation id and returns the token with it.The token expires after 12 hours and works only for this conversation.
javascript
2
Open the audio connection
POST /offer starts the WebRTC handshake. This path sits at the bare root of the server, not under /api/v1.Send a JSON body with these fields:The response is a WebRTC SDP answer. To exchange ICE candidates after the initial handshake, send them with
PATCH /offer.javascript
3
Read answers as they arrive
Poll
GET /api/v1/data/{agent_id}/{conversation_id} every two seconds or so, sending the token as X-Conversation-Token.The response has form_data (answers keyed by question name) and form_status (per-question: empty, skipped, or answered). When the call ends, ended_at appears.javascript
Next steps
Poll for calls
Read
form_data and form_status after a call endsAgent config schema
See the full shape of an agent’s JSON config