# Call Results

`GET /api/cc/campaigns/:id/calls`

One row per call attempt, oldest first — a number called three times has three rows. Read new rows with `after_id`; re-read rows that are not `final` yet with `ids`.

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

Rate limit: 60 requests per minute per account, shared by all Campaign API endpoints.

## Query Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| after_id | integer | No | Return rows with `id` greater than this. Default 0. Up to 100 rows per request. |
| ids | string | No | Instead of `after_id`: comma-separated row ids to read again (up to 100), e.g. `ids=901,905`. |

## How to poll

1. Start with `after_id=0`.
2. Save `meta.next_after_id` and pass it as `after_id` next time. While `meta.has_more` is `true`, ask again straight away.
3. A row's charge and recording arrive after the call ends — the charge within about a minute, the recording within a few minutes. So a row can first appear with `final: false`. Re-read those rows with `ids=` until `final` is `true`; after that the row never changes.

## Request Example

```bash
curl -X GET https://api.awajdigital.com/api/cc/campaigns/42/calls?after_id=0 \
  -H "Authorization: Bearer your_api_token_here" \
  -H "Accept: application/json"
```

```javascript
// Browser JavaScript (Fetch API)
const response = await fetch('https://api.awajdigital.com/api/cc/campaigns/42/calls?after_id=0', {
  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 listCalls() {
  try {
    const response = await axios.get('https://api.awajdigital.com/api/cc/campaigns/42/calls?after_id=0', {
      headers: {
        'Authorization': 'Bearer your_api_token_here',
        'Accept': 'application/json'
      }
    });

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

listCalls();
```

```python
# Python with requests
import requests

def list_calls():
    url = 'https://api.awajdigital.com/api/cc/campaigns/42/calls?after_id=0'
    headers = {
        'Authorization': 'Bearer your_api_token_here',
        'Accept': 'application/json'
    }

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

list_calls()
```

```php
<?php
// PHP with cURL
$url = 'https://api.awajdigital.com/api/cc/campaigns/42/calls?after_id=0';
$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": {
    "has_more": false,
    "next_after_id": 902
  },
  "data": [
    {
      "id": 901,
      "phone_number": "01712345678",
      "attempt": 1,
      "outcome": "answered",
      "agent_id": 15,
      "agent_extension": "205",
      "customer_answered_at": "2026-10-21T10:00:00.000+06:00",
      "joined_at": "2026-10-21T10:00:04.000+06:00",
      "ended_at": "2026-10-21T10:01:04.000+06:00",
      "customer_wait_seconds": 4,
      "billsec": 64,
      "billing_status": "billed",
      "charge": 0.75,
      "recording": "https://cdn.example.com/recordings/call.wav",
      "recording_status": "uploaded",
      "final": true,
      "created_at": "2026-10-21T10:00:00.000+06:00"
    },
    {
      "id": 902,
      "phone_number": "01812345678",
      "attempt": 1,
      "outcome": "not_answered",
      "agent_id": null,
      "agent_extension": null,
      "customer_answered_at": null,
      "joined_at": null,
      "ended_at": "2026-10-21T10:00:30.000+06:00",
      "customer_wait_seconds": null,
      "billsec": 0,
      "billing_status": "pending",
      "charge": null,
      "recording": null,
      "recording_status": "pending",
      "final": false,
      "created_at": "2026-10-21T10:00:00.000+06:00"
    }
  ]
}
```

| Field | Type | Description |
| --- | --- | --- |
| meta.has_more | boolean | More rows are waiting; ask again with `next_after_id`. Always `false` with `ids`. |
| meta.next_after_id | integer\|null | Pass as `after_id` next time. `null` with `ids`. |
| id | integer | Row id. Upsert on it. |
| phone_number | string | The number called |
| attempt | integer | 1 for the first call to this number, 2 and 3 for retries |
| outcome | string | `answered` (connected to an agent), `no_agent` (answered, but no agent picked up in time), `not_answered`, `busy`, `rejected`, `failed` |
| agent_id | integer\|null | The agent who took the call, as `id` in [List Agents](/api-docs/call-center/agents); `null` if none or the agent was deleted |
| agent_extension | string\|null | That agent's extension |
| customer_answered_at | string\|null | When the customer answered |
| joined_at | string\|null | When the customer and the agent were connected |
| ended_at | string\|null | When the call ended |
| customer_wait_seconds | integer\|null | How long the answered customer waited for the agent |
| billsec | integer\|null | Seconds the customer was on the line |
| billing_status | string | `pending`, `billed`, `no_charge`, or `pulse_not_found` (not charged; contact support) |
| charge | number\|null | Taka charged for this attempt; `null` while `billing_status` is `pending` |
| recording | string\|null | Recording URL once `recording_status` is `uploaded` |
| recording_status | string | `pending`, `uploaded` or `no_recording` |
| final | boolean | `true` once billing and recording are settled |
| created_at | string | When the attempt was recorded |

## Error Responses

| Status | Code | Description |
| --- | --- | --- |
| 401 | — | Missing or invalid access token |
| 403 | — | Account does not have the call-center permission |
| 404 | `campaign_not_found` | Unknown campaign, or not on your account |
| 422 | — | Invalid `after_id` or `ids` |
| 429 | — | Rate limit exceeded (60 requests/minute) |