# List Agents

`GET /api/cc/agents`

Return every call-center agent on the authenticated account, including inactive and unapproved ones. Use `id` as `agent_id` when minting an SDK token (`POST /api/sdk/token`). Token minting still rejects inactive or unapproved agents.

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.

## Request Example

```bash
curl -X GET https://api.awajdigital.com/api/cc/agents \
  -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/agents', {
  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 listAgents() {
  try {
    const response = await axios.get('https://api.awajdigital.com/api/cc/agents', {
      headers: {
        'Authorization': 'Bearer your_api_token_here',
        'Accept': 'application/json'
      }
    });

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

listAgents();
```

```python
# Python with requests
import requests

def list_agents():
    url = 'https://api.awajdigital.com/api/cc/agents'
    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_agents()
```

```php
<?php
// PHP with cURL
$url = 'https://api.awajdigital.com/api/cc/agents';
$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
{
  "data": [
    {
      "id": 42,
      "full_name": "Nadia Rahman",
      "email": "nadia@example.com",
      "extension": "200",
      "presence": "online",
      "status": "active",
      "approval_status": "approved",
      "sender": "01712345678"
    }
  ]
}
```

| Field | Type | Description |
| --- | --- | --- |
| data[] | array | Agents on this account, ordered by `id` ascending. Empty array if none. |
| id | integer | `cc_agents.id` — pass this as `agent_id` to [Mint SDK Token](/api-docs/sdk/token) and [List Agent Calls](/api-docs/call-center/calls). |
| full_name | string\|null | Agent display name. |
| email | string | Agent login email. |
| extension | string | SIP extension. |
| presence | string | `offline`, `online`, `on_call`, `on_break`, or `wrap_up`. May be briefly stale; do not poll for live presence. |
| status | string | `active`, `inactive`, or `banned`. |
| approval_status | string | `pending`, `approved`, or `rejected`. |
| sender | string\|null | Caller ID from the agent's live sender assignment; `null` if none or the number was released. |

## Error Responses

| Status | Code | Description |
| --- | --- | --- |
| 401 | — | Missing or invalid access token |
| 403 | — | Account does not have the call-center permission |
| 429 | — | Rate limit exceeded (60 requests/minute) |