# List Agent Calls

`GET /api/cc/agents/:agent_id/calls`

Outgoing calls for one of your agents on a single calendar day. Re-fetch the same `agent_id` + `date` to pick up status, duration, and recording after hangup billing (typically 1–10 minutes). Poll **today** and **yesterday** for a few hours after midnight; older days do not change.

Requires a Bearer API token (from [Authentication](/api-docs/authentication) / dashboard **API Tokens**) and the **call-center** permission.

Rate limit: 60 requests per hour per account. Page size is fixed at 100.

This endpoint covers outbound and internal calls. Inbound queue calls are not included.

## Path Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| agent_id | integer | Yes | Agent `id` from [List Agents](/api-docs/call-center/agents). Must belong to your account. |

## Query Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| date | string | Yes | Calendar day `YYYY-MM-DD` in `Asia/Dhaka`. The day is call **start** (`created_at`), not hangup time. |
| page | number | No | Page number (default 1). Size is always 100. |

## Request Example

```bash
curl -X GET "https://api.awajdigital.com/api/cc/agents/42/calls?date=2026-09-07&page=1" \
  -H "Authorization: Bearer your_api_token_here" \
  -H "Accept: application/json"
```

```javascript
// Browser JavaScript (Fetch API)
const agentId = 42;
const date = '2026-09-07';
const response = await fetch(
  `https://api.awajdigital.com/api/cc/agents/${agentId}/calls?date=${date}&page=1`,
  {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer your_api_token_here',
      'Accept': 'application/json'
    }
  }
);

const data = await response.json();
console.log(data);
```

```javascript
// Node.js with axios
const axios = require('axios');

async function listAgentCalls(agentId, date, page = 1) {
  try {
    const response = await axios.get(
      `https://api.awajdigital.com/api/cc/agents/${agentId}/calls`,
      {
        params: { date, page },
        headers: {
          'Authorization': 'Bearer your_api_token_here',
          'Accept': 'application/json'
        }
      }
    );

    console.log(response.data);
  } catch (error) {
    console.error('Error:', error.response?.data || error.message);
  }
}

listAgentCalls(42, '2026-09-07');
```

```python
# Python with requests
import requests

def list_agent_calls(agent_id, date, page=1):
    url = f'https://api.awajdigital.com/api/cc/agents/{agent_id}/calls'
    headers = {
        'Authorization': 'Bearer your_api_token_here',
        'Accept': 'application/json'
    }
    params = {
        'date': date,
        'page': page
    }

    try:
        response = requests.get(url, headers=headers, params=params)
        print(response.json())
    except requests.exceptions.RequestException as e:
        print(f'Error: {e}')

list_agent_calls(42, '2026-09-07')
```

```php
<?php
// PHP with cURL
$agentId = 42;
$date = '2026-09-07';
$url = 'https://api.awajdigital.com/api/cc/agents/' . $agentId . '/calls?date=' . urlencode($date) . '&page=1';
$token = 'your_api_token_here';

$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HTTPGET, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ' . $token,
    'Accept: application/json'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);

$result = json_decode($response, true);
print_r($result);
?>
```

## Success Response Example

```json
{
  "meta": {
    "total": 2,
    "per_page": 100,
    "current_page": 1,
    "last_page": 1
  },
  "data": [
    {
      "id": 101,
      "agent_id": 42,
      "uuid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "called_number": "01712345678",
      "caller_number": "200",
      "call_type": "outbound",
      "status": "initiated",
      "duration": null,
      "recording": null,
      "created_at": "2026-09-07T00:30:00.000+06:00"
    },
    {
      "id": 102,
      "agent_id": 42,
      "uuid": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
      "called_number": "01812345678",
      "caller_number": "200",
      "call_type": "outbound",
      "status": "answered",
      "duration": 63,
      "recording": "https://cdn.example.com/recordings/call.wav",
      "created_at": "2026-09-07T10:12:00.000+06:00"
    }
  ]
}
```

| Field | Type | Description |
| --- | --- | --- |
| meta.total | integer | Calls that started on this Dhaka day. |
| meta.per_page | integer | Always 100. |
| meta.current_page | integer | Current page. |
| meta.last_page | integer | Last page. |
| data[] | array | Calls ordered by `created_at` ascending. Empty array if none. |
| id | integer | Call id. Upsert on this when re-fetching the day. |
| agent_id | integer | Agent id. |
| uuid | string | Call UUID. |
| called_number | string | Number the agent dialed. |
| caller_number | string | Caller ID / extension used. |
| call_type | string | `internal` or `outbound`. |
| status | string | `initiated`, `answered`, `failed`, `busy`, `no_answer`, or `cancelled`. |
| duration | integer\|null | Seconds of talk time (`null` until billing finalizes). |
| recording | string\|null | Recording URL once attached (`null` until then). |
| created_at | string | Call start, ISO 8601 with `Asia/Dhaka` offset. |

A call that starts at 23:50 and hangs up after midnight still belongs to yesterday. `initiated` rows are included on purpose so a later fetch of the same day can fill in duration, status, and recording.

## Error Responses

| Status | Code | Description |
| --- | --- | --- |
| 401 | — | Missing or invalid access token |
| 403 | — | Account does not have the call-center permission |
| 404 | `agent_not_found` | Agent does not exist or belongs to another account |
| 422 | — | Missing or invalid `date` (`YYYY-MM-DD`) or `page` |
| 429 | — | Rate limit exceeded (60 requests/hour) |

```json
{
  "error": "agent not found",
  "code": "agent_not_found"
}
```