Start a browser call
Create a call that runs in your user’s browser instead of on a phone line. Send channel web and no to; the answer carries the audio socket and the live event stream.
"channel": "web", and no to. Sending to with channel: "web"
returns 400 invalid_request, because nothing is dialled.
Call it from your server, where your key lives. The 202 gives you two links
for this one call. Hand them to the page, and the page never sees your key:
The audio socket
The page opensws_url with new WebSocket(ws_url). Audio is binary in both
directions: raw PCM, 16-bit signed little-endian, mono, 48,000 Hz, with no
header. Send 20 ms frames (1,920 bytes) continuously, and send zeros to mute
rather than stopping. When the user interrupts, the server sends the text
message {"event":"clear"}: drop any agent audio you have queued but not yet
played. Closing the socket ends the call.
The call stays queued until the page connects, then moves to in_progress.
If no audio connects before ws_url expires, the call ends failed with
ended_reason: "no-media" and costs nothing.
The live event stream
agent.state (listening, processing, speaking, ended),
transcript.turn (one per finished turn, for both speakers) and call.ended,
which is always last. Your server can read the same stream with its key at
Stream live events.
While it runs and after
- Steer or end it from your server with
Send a live control: an
instructionthe agent follows from its next reply, or aclosewith a goodbye line. - Results arrive as webhooks to
webhook_url, the same as a phone call. Withfinal_results: trueyou also get onecall.processedcarrying the finished transcript. See Webhooks. - Billing starts when audio goes live and follows the same per-minute rate as a phone call.
Authorizations
Headers
Body
The agent that runs the call. Required for channel phone and web. Optional for channel realtime: without it the session starts with an empty prompt, no tools, no greeting, the default voice and automatic language, and the Realtime client's session.update configures it. A realtime session never plays the agent's first_message; the client's first response.create starts the conversation.
1The only tools of the agent that may run on this call, by name. Every other tool is turned off for this call in every phase (pre_call, on_call and post_call, builtins included), exactly as if the agent had turned it off; the builtin end_call always stays as the agent configured it, so the agent can still hang up. [] turns every tool off. Omitted or null: every tool the agent has on runs, as before. A name that is not one of the agent's tools is ignored, not refused, and a tool the agent has turned off stays off. At most 64 names of up to 64 characters, no repeats (400 invalid_request). Echoed as allowed_tools on the 202 and the call object when sent. Not accepted for channel realtime (400 invalid_request).
641 - 64This call's voice and languages, each key over the agent's (and, later, under a pre_call tool's call_settings). voice.voice_id is the older spelling of call_settings.voice_id; both with different values is 400 invalid_request. An unknown key, an unknown voice or language is 400 invalid_request naming the allowed values. The effective values and their sources are on the call object as call_settings.
phone dials to; the answer adds events_url (live events). web is a browser session: no to, no route; the answer adds ws_url and events_url. realtime is an OpenAI Realtime-compatible session with the same rules, answer and per-minute price as web, except that it is refused (429 concurrency_limit) rather than queued when no voice slot is free; first_message, system_prompt, timing, allowed_tools, test and flow agents are not accepted on it.
phone, web, realtime Replaces the agent's system prompt for this call only; the agent, its revision and every other setting stay the agent's. {{var}} placeholders are filled from this call's variables and validated like the agent's system_prompt (with an input_schema, each must be a declared input, a system variable or a pre-call tool output). Stored with the call but never returned on the call object or in webhooks. Not accepted for channel realtime (400 invalid_request) or for a flow agent (409 flow_system_prompt_unsupported). A sync pre_call tool may set the call's prompt instead (a top-level system_prompt string in its result, up to 48000 characters); one sent here wins over the tool's.
1 - 16000The agent's inputs for this call, checked against its input_schema (without one, string values only). Each value, as text (an object or array as its JSON), is at most 512 characters, except an input the agent's input_schema declares as an object, an array or a string with maxLength above 512, which may be up to 49152 characters. At most 65536 bytes in all. An over-long value is 400 invalid_request naming the key and its limit.
Response
Accepted, not dialled yet
202 response of POST /v2/calls. Web calls and realtime sessions add the session credentials (ws_url and events_url); a phone call adds events_url. Both are paths the public edge makes absolute. transport names the channel of a web call or realtime session.