> ## Documentation Index
> Fetch the complete documentation index at: https://docs.poly.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Get call SIP ladder

> The SIP messages of one call, combined across legs and ordered by capture time.

Returns the Session Initiation Protocol (SIP) messages recorded for a call, grouped into legs (carrier to PolyAI's SIP edge, SIP edge to media server, and any transfer legs) and ordered by capture time. Use it to see why a call failed, how long it rang, who hung up and how a `REFER` transfer went. With `include_sip_details`, each message also carries the cause codes from `Reason` headers and the result of a transfer. For packet loss and jitter on the audio, use [get call audio quality](https://docs.poly.ai/api-reference/telephony/endpoint/get-call-audio-quality.md). See the [overview](https://docs.poly.ai/api-reference/telephony/introduction.md) for how legs, personal data and the time window work.

## Request

### Headers

**X-API-KEY** `string` *required*

Account API key with read access to conversations.

### Path parameters

**conversation\_id** `string` *required*

The call SID.

### Query parameters

**project\_id** `string`

The agent the call belongs to. Optional with an account API key; required with a PAT. A call that belongs to a different agent returns `404`.

**from** `datetime`

Start of the window in which the call is looked up, ISO 8601. Defaults to 14 days ago, the retention limit.

**to** `datetime`

End of the window, ISO 8601. Defaults to now.

**include\_sip\_details** `boolean` (default: false)

Add selected details from each SIP message: `reason_headers` and `refer_status` for any key, and, when the key can read personal data (PII), `sdp`, `refer_to`, `referred_by`, `asserted_identity` and `diversions`.

## Response

**conversation\_id** `string`

**account\_id** `string`

**project\_id** `string`

`null` when you did not pass `project_id`.

**first\_ts** `datetime`

Capture time of the first message, UTC.

**last\_ts** `datetime`

Capture time of the last message, UTC.

**legs** `object[]`

One entry per SIP dialog, ordered by `first_ts`.

**properties**

**call\_id** `string`

The dialog's SIP `Call-ID`. See `call_id` under `messages` for how an unusual `Call-ID` is shown.

**first\_ts** `datetime`

**last\_ts** `datetime`

**src\_ip** `string`

Source of the first message on this leg. Only when the key can read PII; otherwise `null`.

**dst\_ip** `string`

Only when the key can read PII; otherwise `null`.

**from\_user** `string`

SIP user part of the caller (usually the phone number), from the first message. Masked unless the key can read PII.

**to\_user** `string`

SIP user part of the called party (usually the phone number), from the first message. Masked unless the key can read PII.

**message\_count** `integer`

**final\_response** `integer`

First response of `200` or above to any request on this leg, not only to the `INVITE`: a cancelled call shows `200` (the answer to the `CANCEL`) before the `487` that ends the `INVITE`. `null` if the leg never got one.

**messages** `object[]`

The messages of all legs, ordered by capture time.

**properties**

**ts** `datetime`

Capture time, UTC.

**call\_id** `string`

The leg the message belongs to. A `Call-ID` that is not printable ASCII of up to 128 characters is replaced by `invalid-` followed by a hash, so its messages still group into one leg.

**src\_ip** `string`

Only when the key can read PII; otherwise `null`.

**src\_port** `integer`

Only when the key can read PII; otherwise `null`.

**dst\_ip** `string`

Only when the key can read PII; otherwise `null`.

**dst\_port** `integer`

Only when the key can read PII; otherwise `null`.

**method** `string`

The request method (for example `INVITE`, `BYE` or `REFER`), `OTHER` for a method that is not a standard SIP method, or the response code as a string (for example `180` or `200`) for a response.

**response\_code** `integer`

Set for responses only.

**reason** `string`

The standard reason phrase for `response_code` (for example `Busy Here` for `486`), for responses only. The phrase the remote party actually sent is not returned.

**cseq** `string`

The `CSeq` header, for example `1 INVITE`.

**from\_user** `string`

SIP user part of the caller (usually the phone number). Masked unless the key can read PII.

**to\_user** `string`

SIP user part of the called party (usually the phone number). Masked unless the key can read PII.

**user\_agent** `string`

The `User-Agent` header. Only when the key can read PII; otherwise `null`.

**reason\_headers** `object[]`

Causes from the message's `Reason` headers, for example why a `BYE` or `CANCEL` was sent. Only with `include_sip_details`; otherwise empty.

**properties**

**protocol** `string`

`Q.850` or `SIP`. Causes in other namespaces are left out.

**cause** `integer`

The cause code, for example Q.850 `16` (normal call clearing) or SIP `200`.

**refer\_status** `integer`

The status of a transfer, from the `NOTIFY` that reports a `REFER`'s progress: for example `200` when the transfer target answered, or `486` when it was busy. Only with `include_sip_details`; otherwise `null`.

**sdp** `object`

The media offered or answered by the message's first audio stream, when it carries a Session Description Protocol (SDP) body. `null` when there is none, or when the SDP is inside a multipart body. Only with `include_sip_details` and PII access.

**properties**

**media\_ip** `string`

The connection address, when it is an IP address.

**media\_port** `integer`

**transport** `string`

The media transport, for example `RTP/AVP` or `RTP/SAVP`. `null` when it is not a known RTP profile.

**srtp** `boolean`

`true` when the media is encrypted (SRTP), or the stream offers SRTP keys.

**codecs** `string[]`

Codecs in the order offered or answered, for example `PCMU/8000`. An encoding PolyAI does not recognise is shown as `other`.

**direction** `string`

`sendrecv`, `sendonly` (for example when the call is put on hold), `recvonly` or `inactive`.

**ptime** `integer`

Packetization time, in milliseconds.

**refer\_to** `string`

The transfer target from `Refer-To`, when it is a phone number. Only with `include_sip_details` and PII access.

**referred\_by** `string`

The number in `Referred-By`, when it is a phone number. Only with `include_sip_details` and PII access.

**asserted\_identity** `string`

The number in `P-Asserted-Identity`, when it is a phone number. Only with `include_sip_details` and PII access.

**diversions** `object[]`

The call's redirections, from its `Diversion` headers. Only with `include_sip_details` and PII access; otherwise empty.

**properties**

**number** `string`

The number the call was diverted from, when it is a phone number.

**reason** `string`

Why it was diverted, for example `no-answer` or `unconditional`.

**total** `integer`

Number of messages returned. When `truncated` is `true` this is the cap, not the call's real total.

**truncated** `boolean`

`true` when the cap of 2,000 messages was reached and later messages are missing.

## Example

This request uses a key that cannot read PII, so numbers are masked and network details are `null`.

```bash cURL theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl "https://api.us.poly.ai/api/v1/telephony/calls/CA3f2c1e9d6b7a4f8e9c0d1b2a3c4d5e6f/sip?project_id=PROJECT-V258TF29" \
  -H "X-API-KEY: YOUR_API_KEY"
```

```json Response theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "conversation_id": "CA3f2c1e9d6b7a4f8e9c0d1b2a3c4d5e6f",
  "account_id": "ACCOUNT-4F8K2M1P",
  "project_id": "PROJECT-V258TF29",
  "first_ts": "2026-11-10T09:14:02.100000Z",
  "last_ts": "2026-11-10T09:14:47.880000Z",
  "legs": [
    {
      "call_id": "7d3b0e2a-5f41-4c1e-9a8b-2e6f0c1d4a77@203.0.113.10",
      "first_ts": "2026-11-10T09:14:02.100000Z",
      "last_ts": "2026-11-10T09:14:47.870000Z",
      "src_ip": null,
      "dst_ip": null,
      "from_user": "***0142",
      "to_user": "***0199",
      "message_count": 5,
      "final_response": 200
    },
    {
      "call_id": "b1c4e7f2-9a30-4d6e-8c5b-0f2a7d3e1b94",
      "first_ts": "2026-11-10T09:14:02.140000Z",
      "last_ts": "2026-11-10T09:14:47.880000Z",
      "src_ip": null,
      "dst_ip": null,
      "from_user": "***0142",
      "to_user": "***0199",
      "message_count": 4,
      "final_response": 200
    }
  ],
  "messages": [
    {
      "ts": "2026-11-10T09:14:02.100000Z",
      "call_id": "7d3b0e2a-5f41-4c1e-9a8b-2e6f0c1d4a77@203.0.113.10",
      "src_ip": null,
      "src_port": null,
      "dst_ip": null,
      "dst_port": null,
      "method": "INVITE",
      "response_code": null,
      "reason": null,
      "cseq": "1 INVITE",
      "from_user": "***0142",
      "to_user": "***0199",
      "user_agent": null,
      "reason_headers": [],
      "refer_status": null,
      "sdp": null,
      "refer_to": null,
      "referred_by": null,
      "asserted_identity": null,
      "diversions": []
    },
    {
      "ts": "2026-11-10T09:14:02.112000Z",
      "call_id": "7d3b0e2a-5f41-4c1e-9a8b-2e6f0c1d4a77@203.0.113.10",
      "src_ip": null,
      "src_port": null,
      "dst_ip": null,
      "dst_port": null,
      "method": "100",
      "response_code": 100,
      "reason": "Trying",
      "cseq": "1 INVITE",
      "from_user": "***0142",
      "to_user": "***0199",
      "user_agent": null,
      "reason_headers": [],
      "refer_status": null,
      "sdp": null,
      "refer_to": null,
      "referred_by": null,
      "asserted_identity": null,
      "diversions": []
    }
  ],
  "total": 9,
  "truncated": false
}
```

The response is abridged: `legs` shows both legs, `messages` the first two of nine.

### With SIP details and PII access

With `include_sip_details=true` and a key that can read PII, the same call's `INVITE` and the carrier's `BYE` look like this:

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
[
  {
    "ts": "2026-11-10T09:14:02.100000Z",
    "call_id": "7d3b0e2a-5f41-4c1e-9a8b-2e6f0c1d4a77@203.0.113.10",
    "src_ip": "203.0.113.10",
    "src_port": 5060,
    "dst_ip": "198.51.100.20",
    "dst_port": 5060,
    "method": "INVITE",
    "response_code": null,
    "reason": null,
    "cseq": "1 INVITE",
    "from_user": "+442079460142",
    "to_user": "+442079460199",
    "user_agent": "Carrier-SBC/4.2",
    "reason_headers": [],
    "refer_status": null,
    "sdp": {
      "media_ip": "203.0.113.10",
      "media_port": 18004,
      "transport": "RTP/AVP",
      "srtp": false,
      "codecs": ["PCMU/8000", "PCMA/8000", "telephone-event/8000"],
      "direction": "sendrecv",
      "ptime": 20
    },
    "refer_to": null,
    "referred_by": null,
    "asserted_identity": "+442079460142",
    "diversions": []
  },
  {
    "ts": "2026-11-10T09:14:47.850000Z",
    "call_id": "7d3b0e2a-5f41-4c1e-9a8b-2e6f0c1d4a77@203.0.113.10",
    "src_ip": "203.0.113.10",
    "src_port": 5060,
    "dst_ip": "198.51.100.20",
    "dst_port": 5060,
    "method": "BYE",
    "response_code": null,
    "reason": null,
    "cseq": "2 BYE",
    "from_user": "+442079460142",
    "to_user": "+442079460199",
    "user_agent": "Carrier-SBC/4.2",
    "reason_headers": [{ "protocol": "Q.850", "cause": 16 }],
    "refer_status": null,
    "sdp": null,
    "refer_to": null,
    "referred_by": null,
    "asserted_identity": null,
    "diversions": []
  }
]
```

## Errors

| Status | Meaning |
| - | - |
| `400` | `project_id` is required for your credential and was not sent. |
| `401` | Missing or invalid API key. |
| `403` | Authenticated, but the key cannot read conversations. |
| `404` | The call has no telephony data, is older than 14 days, belongs to another account or does not match `project_id`. |
| `422` | A parameter is malformed, for example `from`, `to` or `include_sip_details`. |
| `429` | Too many requests. Wait for the `Retry-After` period, then retry. |
| `502` | The telephony data store did not answer. Retry with backoff. |
