# List call history for an account

Returns call history for an account, one page at a time.

```http
GET https://api.pozy.ai/v1/whatsapp/calls
```

- Area: WhatsApp / WhatsApp Calling
- Auth: Authorization: Bearer pz_live_...

## Query parameters

- `accountId` (string, required)
- `status` (string): one of ringing, answered, ended, failed
- `direction` (string): one of inbound, outbound
- `since` (string (date-time))
- `until` (string (date-time))
- `before` (string (date-time))
- `limit` (integer)

## Example request

```bash
curl -X GET "https://api.pozy.ai/v1/whatsapp/calls?accountId=696e0b682d0a31188e7a2ba9&limit=1" \
  -H "Authorization: Bearer $POZY_API_KEY"
```

```ts
const res = await fetch("https://api.pozy.ai/v1/whatsapp/calls?accountId=696e0b682d0a31188e7a2ba9&limit=1", {
  headers: { Authorization: `Bearer ${process.env.POZY_API_KEY}` },
});
const data = await res.json();
if (!res.ok) throw new Error(data?.error ?? `Request failed with status ${res.status}`);
console.log(data);
```

```python
import os
import requests

resp = requests.get(
    "https://api.pozy.ai/v1/whatsapp/calls",
    headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
    params={
        "accountId": "696e0b682d0a31188e7a2ba9",
        "limit": 1,
    },
    timeout=30,
)
resp.raise_for_status()
print(resp.json())
```

## Response 200

- `calls`, array of object
  - `_id`, string
  - `direction`, string: One of `inbound`, `outbound`
  - `from`, string
  - `to`, string
  - `status`, string: One of `ringing`, `answered`, `ended`, `failed`
  - `startedAt`, string (date-time)
  - `endedAt`, string (date-time)
  - `durationSeconds`, integer
  - `endReason`, string: One of `hangup`, `no_answer`, `rejected`, `error`
  - `recordingUrl`, string
  - `billing`, object
    - `metaCostUSD`, number
    - `carrierCostUSD`, number
    - `recordingCostUSD`, number
    - `billableCostUSD`, number
    - `totalCostUSD`, number
    - `currency`, string
- `nextCursor`, string (date-time): Can be null

```json
{
  "calls": [
    {
      "_id": "635d87e261ae344ef27fd1df",
      "direction": "inbound",
      "from": "+14155550123",
      "to": "+14155550123",
      "status": "ringing",
      "startedAt": "2026-10-02T09:00:00.000Z",
      "endedAt": "2026-10-02T09:00:00.000Z",
      "durationSeconds": 1,
      "endReason": "hangup",
      "recordingUrl": "https://pozy.ai/media/example-1.jpg",
      "billing": {
        "metaCostUSD": 12.5,
        "carrierCostUSD": 12.5,
        "recordingCostUSD": 12.5,
        "billableCostUSD": 12.5,
        "totalCostUSD": 12.5,
        "currency": "USD"
      }
    }
  ],
  "nextCursor": "2026-10-02T09:00:00.000Z"
}
```
