Calls and results
Start a call
An outbound call needs a published agent and a number assigned to it for outbound calls (Phone numbers).
202means the call was admitted and the dial was requested once. It is not a connected call.- The call runs the agent’s live published version, and the answer names it. The request carries no agent configuration. A call keeps its version even if a later publish or rollback changes the live one.
- With
expected_version_id, a different live version is refused with409 conflict,reason: live_version_mismatchanddetails.current_live_version_id. Nothing is dialled. It cannot select an older version. - The call dials from the agent’s only outbound number, or from
from_number_id. With no number the answer is409 number_not_outbound; with several and no choice it is409 conflict,reason: outbound_number_ambiguous. dynamic_variablesholds at most 64 keys, 4096 characters per value and 16 KiB in total.metadatais for your own correlation: at most 16 keys (^[a-z][a-z0-9_]{0,63}$), string values of at most 512 characters, at most 4 KiB. It is returned on call reads and can be filtered on. It never routes the call and must not hold credentials.- A paused or archived agent is refused with
agent_not_live(details.state).
Retrying a call start
-
After a lost answer, send the identical request with the same key. You get the same call with
Idempotent-Replayed: true, and the number is never dialled twice. A different body under the same key is409 idempotency_key_reused. A duplicate sent while the first is still being admitted answers409 idempotency_in_progresswithRetry-After. -
The stored answer is the accepted call (IDs, version, state, poll hint). It never holds the number you dialled, the variables or the metadata, so a replay returns exactly the original body.
-
503 at_capacityand429 quota_exceededcarryRetry-After. After that delay, send the identical request with the same key: it is admitted afresh. Every other refusal replays as itself for the key’s 24 hours. -
503 unavailablenames what was unavailable indetails.dependency(call_servingfor call start). WaitRetry-Afterand send the identical request with the same key.
Run an agent on a call leg you already own
Use POST /agent-sessions (createAgentSession) when your own switch, carrier, dialer or
application already holds the call. Rasen places, answers and routes no telephone call and needs no
phone number. You get a media WebSocket for the call, and the agent talks on it.
- The smallest request is
{"agent_id": "agent_…"}.mediathen isbinary,pcm16, 8000 Hz. media.transport:binarysends raw audio in binary frames;jsonsends base64 media events in text frames.media.encoding:pcm16(signed 16-bit little-endian mono) ormulaw(G.711, 8000 Hz only).media.sample_rateis 8000 or 16000 and is the same in both directions.- Unknown fields are refused. A
to, caller ID, number or provider field is400 invalid_request. - Connect to
websocket_urlexactly as returned and send audio beforeexpires_at, 120 seconds after admission. The agent’s audio comes back on the same socket. The call becomes active when the first audio frame arrives. One socket per call. - The URL is a credential: do not log it.
- A socket that does not connect in time frees the reserved capacity, and the call ends with
end_reasonnever_connected. directionis a label for call reads and filters. Without it, the live version’scall_directionsetting is used, elseoutbound.expected_version_id,dynamic_variablesandmetadatafollow the same rules as Start a call.metadatais returned on call reads.- The answer’s
call_idworks with every call operation below: read, end, transcript stream, recording and results. - The same key and body answer the same call,
websocket_urlandexpires_at. A replay never extends the deadline.503 at_capacityand429 quota_exceededcarryRetry-After: send the identical request with the same key after it, and it is admitted afresh. Every other refusal replays as itself for the key’s 24 hours. - Call starts and agent sessions share the call-start rate limit (Rate limits) and the workspace’s concurrent-call quota. Capacity is reserved at admission, so a session counts until it ends or its connect window passes.
End a call
A live call answers {"terminal": false, "end_requested": true}: the stop is requested and the call
ends shortly. A call that already ended answers its final state with end_requested: false; so does a
call in evidence_pending, whose conversation is over while its record is being finished. Ending
twice is safe. 503 call_orchestrator_unavailable means no worker holds the call yet: retry with the
same key.
Read a call
The call carries its state, terminal, the readiness of each result (transcript_state,
extraction_state, summary_state), your metadata, and effective_variables:
the variable values the call ran with, classified. A public or internal variable shows its value;
a pii or confidential one is redacted; an undeclared one is withheld_unclassified; a secret
never appears. Follow poll_after_seconds; when it is null, nothing will change.
A call placed by a carrier dial also says what the carrier reported. dial_outcome is dialing
until the carrier reports, then its latest report, for example answered, no_answer, busy,
voicemail, rejected, invalid_number or failed. dial_sip_code is the SIP response code
when the carrier gave one (for example 480 or 486). A call that never connected
(end_reason: never_connected) says why here. Both are null for calls no carrier dialled: inbound,
browser and test calls. Both fields also appear on call list items.
dial_outcome is an open vocabulary. Preserve a value you do not recognise, and never treat it as
success.
List and search calls
Lists carry no variables, transcripts or result bodies.
Unless you send start and end, GET /calls, POST /calls/search and a metadata lookup read only
the last 30 days. An older call is simply not in the answer: nothing says it was left out. One request
spans at most 93 days, so to look further back, repeat the request over consecutive windows (start
and end inside filter in the POST form).
For large ID sets, use the POST form (up to 1000 ID and metadata values, 128 KiB). It answers the same page as the GET form (Filters and limits):
Each item’s id is the call ID. metadata_key and metadata_value go together; a key alone is
invalid_request. A metadata value may be empty ("tag": ""), so metadata_value= (GET) or
"metadata_value": [""] (POST) finds the calls that stored an empty value. Every other empty filter
value is refused.
Keep a copy in sync
Scan for changes with updated_since. Items come oldest change first. A call’s updated_at moves
when the call, its transcript, one of its results or one of its tool outcomes changes. The last page
carries scanned_through: start the next scan there.
A scan never ends past a change that was still being written when it ran, so a change committed
while you read is picked up by the next scan rather than skipped. A long-running write can hold
scanned_through back for a while; it never makes a scan skip anything. A tracked call that shows
no change for five minutes should still be read directly once (GET /calls/{call_id}): do not infer
completion from silence.
Changes scan availability
A changes scan (updated_since, on GET /calls or POST /calls/search) can answer
503 unavailable with details.dependency = "call_changes". Keep your saved checkpoint unchanged,
wait Retry-After, and retry the scan. A creation-order list does not use the changes checkpoint;
it is not a substitute for a complete changes scan. Continue reading known calls directly when
needed, and do not infer completion from an unavailable scan.
- In changes mode,
startandendboundupdated_at, notcreated_at. If you sendstarttoo, it must equalupdated_since.endis optional and capped at the visibility watermark. - Timestamps without a time zone are refused, and so is an empty range.
Results
Every result read returns what is stored and never starts work. A result that is not stored yet is
pending (follow poll_after_seconds); one that will not be produced is unavailable,
not_requested or failed, with no invented empty value.
- A transcript page is bound to the transcript it came from. If a newer transcript replaces it, the
old cursor answers
invalid_requestwithfield: cursor: start again without it. - Extraction fields are typed by the definitions the call ran with; a field the call did not yield
is
not_found. - Tool outcomes show the tool, its kind, a state (
pending,succeeded,failedorindeterminate) and a registeredreason, never arguments, results or credentials. Built-in tools (end_call,transfer) have notool_id. indeterminatemeans the effect is unknown: it may or may not have happened. Any outcome the platform cannot confirm reads this way. Check the system the tool acts on before doing anything again; never rerun it automatically.- A tool call refused because its credential version was revoked shows
credential_unavailableas its reason (Secrets and rotation).
Download a recording
The authenticated endpoint streams the selected immutable recording without exposing a storage URI
or signed URL and without converting the audio. A whole object answers 200; one satisfiable range
answers 206. An out-of-bounds range answers 416 with the size in Content-Range, while malformed
or multiple ranges are 400 invalid_request. Unknown or foreign calls, calls without servable
recording evidence, and contradictory stored metadata all answer the same 404 not_found.
Export campaign evidence
Use the campaign ID returned by creation or listing with these read-only exports. See Campaigns to create, start and manage campaigns.
The result CSV contains recipient and attempt identities, safe outcome fields, only the last four destination digits and a SHA-256 value. It never contains a full destination, recording URL, transcript, secret or diagnostic payload.
Transcript export is paged in CSV responses rather than JSON. Each page holds at most 500 attempts.
Follow X-Next-Cursor with the same limit until the header is absent. The first request fixes an
upper watermark, so attempts added later do not enter the download. Every row states whether the
transcript is ready, pending, absent or unavailable; inaccessible calls reveal neither a
call ID nor content. If an HTTP transfer breaks, discard that page and request it again with the same
cursor (or without a cursor for the first page).
Stream transcript events
GET /calls/{call_id}/transcript/stream returns read-only Server-Sent Events for the selected
verified transcript layer. It requires calls.read. The stream reports readiness and public
transcript segments; reading it does not start transcription work.
Save the opaque event ID and send it in Last-Event-ID when reconnecting to this call. IDs bind
the workspace, call and selected generation. A replacement emits transcript.restart and closes;
discard the previous resume position and reconnect for the new generation.