Skip to main content
The Telephony API exposes what PolyAI’s telephony layer recorded for a voice call: the Session Initiation Protocol (SIP) messages exchanged between the carrier and PolyAI, known as the call’s SIP ladder, and the RTP Control Protocol (RTCP) reports that describe packet loss and jitter on the audio. Use it to answer “why did this call fail?”, “how long did it ring?”, “who hung up?” and “was this a network problem or an agent problem?” from your own tooling.
This API is read-only and describes calls that already happened. To connect your own telephony platform to PolyAI, see the SIP Trunking API.

Endpoints

Both endpoints are also available as Data MCP tools: get-call-sip-ladder and get-call-audio-quality.

Base URL and authentication

Send an account API key in the X-API-KEY header (Authorization: Bearer <key> is also accepted). The key needs read access to conversations. Create keys from the API Keys tab in Agent Studio; see API keys. Keys are region-specific. Use the host of the region your account lives in. Both endpoints accept an optional project_id, the Agent ID shown in Agent Studio (PROJECT-xxxxxxxx). Use it to confirm a call belongs to a given agent; a call that does not belong to that agent returns 404. It is required when you authenticate with a personal access token (PAT) instead of an account API key.

Concepts

Call identifier

conversation_id is the call SID: the same conversation_id the Conversations API and the Traces API return for a voice call. A call is visible only to the account it belongs to; any other call returns 404.

Legs

One call usually involves several SIP dialogs, each with its own SIP Call-ID. The SIP endpoint returns every dialog it can link to the call as a leg: the carrier to PolyAI’s SIP edge, PolyAI’s SIP edge to the media server, and any further legs created by a transfer. Messages from all legs come back in one list, ordered by capture time, so you can read the call end to end. A Call-ID is chosen by whoever starts the dialog, so two unrelated calls can occasionally share one. When a dialog’s Call-ID also appears on a call of another account, or of another agent when you pass project_id, that leg is left out, because PolyAI cannot tell whose messages are whose. If no leg remains, the call returns 404.

SIP messages

Each message has a method: the request method (for example INVITE, BYE or REFER), OTHER for a method that is not a standard SIP method, or, for a response, the response code as a string (for example 180 or 200). Responses also carry response_code and reason, the standard phrase for that code; the phrase the remote party sent is not returned. With include_sip_details=true, each message also carries selected details taken from its headers and body: A leg’s final_response is the first response of 200 or above to any request on that leg, not only to the INVITE. When a caller hangs up before the call is answered, the 200 that acknowledges the CANCEL arrives before the 487 that ends the INVITE, so final_response is 200. To see how a leg really ended, read its messages.

Audio quality

Audio quality comes from RTCP reports sent during the call. The API groups them into one stream per leg (call_id), reporting endpoint (ssrc) and source (source_ssrc), with: packets_sent counts what the reporter sent, while the loss and jitter fields describe what it received from source_ssrc. Do not divide one by the other to get a loss rate; use fraction_lost_avg_pct and fraction_lost_max_pct. Loss or jitter that is high on every stream points to the network or the carrier. If the streams are clean but the call still went badly, look at the agent with the Traces API.

Personal data

What the SIP endpoint returns depends on whether the API key can read personal data (PII). Without PII access:
  • Phone numbers in from_user and to_user keep only their last four digits, after ***. A user part counts as a number when it holds a run of at least six digits once separators are ignored, whatever surrounds it, so +442079460142, tel:+44-20-7946-0142 and %2B442079460142 all become ***0142.
  • Other user parts, such as a SIP username, become ***. Placeholders such as anonymous, private, restricted, unavailable, unknown and withheld are returned as they are.
  • Network details (src_ip, src_port, dst_ip, dst_port and user_agent) are null, on messages and on legs.
  • SIP details are limited to reason_headers and refer_status, even with include_sip_details=true.
With PII access, all of these are returned as recorded. The audio quality endpoint returns no personal data.

Time windows

from and to are optional ISO 8601 query parameters that set the window in which PolyAI looks for the call. to defaults to now and from to 14 days before now. Telephony data is kept for 14 days, the retention limit. A from earlier than that is raised to the limit, and a call older than that returns 404. The window only locates the call. The messages and reports returned cover the call’s own time span, from 5 minutes before its first message to about 3 minutes after its last. Messages outside that span, such as those of a transfer leg that continues long after the main leg ends, are not returned, and truncated does not flag them. Responses carry truncated. It is true when the cap of 2,000 SIP messages or 5,000 RTCP reports was reached within that span, and later messages or reports are missing.

Errors

Last modified on December 4, 2026