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

# Classic API

> The CloudTalk Classic API serves the endpoints that have no v1 version, such as Calls and Agents: its hosts, methods, responses, paging, errors and rate limit.

The Classic API is supported and serves the endpoints that have no v1 version: Calls, Agents, Groups, Utilities, and contact notes and activities. It also serves the endpoints marked **LEGACY**, which have v1 replacements. All of them follow the conventions on this page, and your API key works on them unchanged, with HTTP Basic auth:

```bash theme={"system"}
curl -u ACCESS_KEY_ID:ACCESS_KEY_SECRET \
  -H "Accept: application/json" \
  "https://my.cloudtalk.io/api/calls/index.json?limit=10"
```

## API hosts

| Host | What's there |
| - | - |
| `https://my.cloudtalk.io/api` | Calls, Agents, Groups, Utilities, and the legacy Contacts, Contact tags, Bulks, Campaigns, Numbers and SMS endpoints |
| `https://analytics-api.cloudtalk.io/api` | [Get call details](https://help.cloudtalk.io/api-reference/calls/get-call-details.md) |
| `https://platform-api.cloudtalk.io/api` | The legacy [CueCard](https://help.cloudtalk.io/api-reference/cuecard/create-cuecard.md) endpoint |

Each endpoint's reference page shows its full URL. A request sent to the wrong host answers `404`. Use HTTPS.

## Methods and headers

On `my.cloudtalk.io/api`, **`PUT` creates and `POST` updates**, the reverse of the usual convention. `PATCH` is not used.

| Method | Use | Example |
| - | - | - |
| `GET` | Read a resource or list a collection | `GET /calls/index.json` |
| `PUT` | Create a resource | `PUT /agents/add.json` |
| `POST` | Update a resource | `POST /agents/edit/{agentId}.json` |
| `DELETE` | Delete a resource | `DELETE /agents/delete/{agentId}.json` |

Three endpoints are actions and use `POST`: [Make a call](https://help.cloudtalk.io/api-reference/calls/make-a-call.md), and the legacy [Send sms](https://help.cloudtalk.io/api-reference/sms/send-sms.md) and [Contact actions](https://help.cloudtalk.io/api-reference/bulks-legacy/contact-actions.md).

Send `Accept: application/json` on every `GET`: without it, a request may be refused with `404` or `406`. Send `Content-Type: application/json` with a body.

## Responses

Responses are wrapped in `responseData`. One resource:

```json theme={"system"}
{ "responseData": { "id": 123, "created": "2018-01-10 12:34:56" } }
```

A paginated collection adds `itemsCount`, `pageCount`, `pageNumber` and `limit`:

```json theme={"system"}
{
  "responseData": {
    "itemsCount": 65,
    "pageCount": 3,
    "pageNumber": 1,
    "limit": 30,
    "data": [ { "id": 123, "created": "2018-01-10 12:34:56" } ]
  }
}
```

* `PUT` creates answer `201`. [Make a call](https://help.cloudtalk.io/api-reference/calls/make-a-call.md) answers `200` with only `{"responseData": {"status": 200}}`.
* Not every collection paginates: [List countries](https://help.cloudtalk.io/api-reference/utilities/list-countries.md) puts a plain array in `responseData`.
* [Download a call recording](https://help.cloudtalk.io/api-reference/calls/recording-media.md) answers `audio/x-wav`, with no envelope.
* Timestamps are UTC, in two forms: `2017-10-04T06:33:37.000Z` on call records, and `2017-12-24 12:22:00` in the `date_from` and `date_to` filters. Take the form from the endpoint's reference page.
* Call history groups each record's fields in nested objects: the call is under `Cdr`, with `Contact`, `Agent`, `Notes` and `Tags` beside it.

## Pagination

Send `limit` (`1` to `1000`; left out, the server applies its default and reports it in `limit`) and `page` (from `1`). Read pages until `pageNumber` equals `pageCount`, and stop on an empty `data` too.

```python theme={"system"}
import requests

def fetch_all_calls(auth, date_from, date_to, limit=100):
    calls, page = [], 1
    while True:
        response = requests.get(
            "https://my.cloudtalk.io/api/calls/index.json",
            auth=auth,
            headers={"Accept": "application/json"},
            params={"limit": limit, "page": page, "date_from": date_from, "date_to": date_to},
        )
        response.raise_for_status()
        envelope = response.json()["responseData"]
        calls.extend(envelope["data"])
        if not envelope["data"] or envelope["pageNumber"] >= envelope["pageCount"]:
            return calls
        page += 1
```

Records created between two requests can shift pages. For a sync, query a narrow `date_from` and `date_to` window instead of resuming from a page number.

## Errors

Errors are wrapped in `responseData`, with `status` equal to the HTTP status:

```json theme={"system"}
{ "responseData": { "status": 404, "message": "Not found." } }
```

| Status | When |
| - | - |
| `401` | Credentials are missing, wrong or revoked. The body is `{"responseData": {"status": 401, "message": "Unauthorized"}}`. |
| `403` | The agent is not online ([Make a call](https://help.cloudtalk.io/api-reference/calls/make-a-call.md)), the account has insufficient funds ([Send sms](https://help.cloudtalk.io/api-reference/sms/send-sms.md)), or the account has its maximum number of agents ([Add an agent](https://help.cloudtalk.io/api-reference/agents/add-an-agent.md)). A `403` with an HTML page instead of JSON never reached the API: send a `User-Agent` header. Requests with none, or with the one Python's `urllib` sends, are refused this way; `curl`, Python's `requests`, `axios` and `node-fetch` set an accepted one. |
| `404` | No such record in your account, or the wrong host. |
| `406` | A required field is missing, or a value is out of range or of the wrong type. |
| `409` | The resource's state prevents the action, for example an agent already on a call. |
| `410` | A call recording expired or was deleted. Do not request it again. |
| `429` | Over the rate limit (below). |
| `500` | Retry after a few seconds. If it persists, check the [CloudTalk Status Page](https://status.cloudtalk.io/). |

## Rate limit

`my.cloudtalk.io/api` allows **60 requests per minute per company** by default, one count for all its endpoints, shared by every API key of your account. Over it, the answer is `429` with `{"responseData": {"status": 429, "message": "Rate Limit Exceeded."}}` and the `X-CloudTalkAPI-Limit`, `X-CloudTalkAPI-Remaining` and `X-CloudTalkAPI-ResetTime` headers. Here `X-CloudTalkAPI-ResetTime` is a Unix timestamp: wait until that time, then retry. To ask for a higher limit, see [Rate limiting](https://help.cloudtalk.io/guides/rate-limiting.md#requesting-a-higher-limit).

## Make a call

[Make a call](https://help.cloudtalk.io/api-reference/calls/make-a-call.md) rings the agent first, who has 20 seconds to answer, then dials the callee:

```bash theme={"system"}
curl -u ACCESS_KEY_ID:ACCESS_KEY_SECRET \
  -X POST https://my.cloudtalk.io/api/calls/create.json \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{"agent_id": 1234, "callee_number": "+442012345678"}'
```

The answer has no call id. Find the call in [Call history](https://help.cloudtalk.io/api-reference/calls/call-history.md), filtered by `user_id` and `date_from`.

## Other hosts

* [Get call details](https://help.cloudtalk.io/api-reference/calls/get-call-details.md) on `analytics-api.cloudtalk.io` answers a bare JSON object. Its errors are `{ "statusCode", "message", "error" }`, with no `correlationId`; `message` may be an array of validation messages.
* [CueCard](https://help.cloudtalk.io/api-reference/cuecard/create-cuecard.md) on `platform-api.cloudtalk.io` answers `{"success": true}`, or `{"success": false, "errors": [...]}`. It answers `424` when the call it names has ended or `call_uuid` is not a call uuid, and `429` with no body from the gateway, or with an error body and `Retry-After` when too many cue cards wait for an agent to answer.

## Replacements for the LEGACY endpoints

The LEGACY endpoints keep working. For new integrations, use their v1 replacements:

* [Contacts (LEGACY)](https://help.cloudtalk.io/api-reference/contacts-legacy/list-contacts.md): use [Contacts](https://help.cloudtalk.io/api-reference/contacts/list-and-search-contacts.md). Notes and activities have no v1 equivalent.
* [Contact tags (LEGACY)](https://help.cloudtalk.io/api-reference/contact-tags-legacy/list-contact-tags.md): use [Contact tags](https://help.cloudtalk.io/api-reference/contacts/list-contact-tags.md).
* [Bulks (LEGACY)](https://help.cloudtalk.io/api-reference/bulks-legacy/contact-actions.md): use [Bulk upsert contacts](https://help.cloudtalk.io/api-reference/contacts/bulk-upsert-contacts.md) to create and update up to 100 contacts, and [Delete a contact](https://help.cloudtalk.io/api-reference/contacts/delete-a-contact.md) to delete them one at a time.
* [Campaigns (LEGACY)](https://help.cloudtalk.io/api-reference/campaigns-legacy/list-campaigns.md): use the [AI Sales Dialer campaign endpoints](https://help.cloudtalk.io/api-reference/dialer/list-dialer-campaigns.md).
* [Numbers (LEGACY)](https://help.cloudtalk.io/api-reference/numbers-legacy/list-numbers.md): use the v1 Numbers and Call flows endpoints, as below.
* [SMS (LEGACY)](https://help.cloudtalk.io/api-reference/sms/send-sms.md): use [Send a message](https://help.cloudtalk.io/api-reference/messages/send-a-message.md), and [Bulk send messages](https://help.cloudtalk.io/api-reference/messages/bulk-send-messages.md) for up to 50 recipients in one call.
* [CueCard (LEGACY)](https://help.cloudtalk.io/api-reference/cuecard/create-cuecard.md): use [Send an insight card](https://help.cloudtalk.io/api-reference/insight-cards/send-an-insight-card.md). CueCard keeps working for at least 365 days from its deprecation date, 2026-11-12, but some of its answers changed and every cue card shows as an insight card. [Migrate from Cue Cards](https://help.cloudtalk.io/guides/insight-cards/migrate-from-cue-cards.md) maps every field.

| Legacy number endpoint | Use instead |
| - | - |
| [List numbers](https://help.cloudtalk.io/api-reference/numbers-legacy/list-numbers.md) | [List and search numbers](https://help.cloudtalk.io/api-reference/numbers/list-and-search-numbers.md), [Get a number](https://help.cloudtalk.io/api-reference/numbers/get-a-number.md) |
| [Edit a number](https://help.cloudtalk.io/api-reference/numbers-legacy/edit-a-number.md) | [Update a number](https://help.cloudtalk.io/api-reference/numbers/update-a-number.md) for the settings, [Replace a number's call flow](https://help.cloudtalk.io/api-reference/call-flows/replace-a-numbers-call-flow.md) for the routing |
| [Unregister a number](https://help.cloudtalk.io/api-reference/numbers-legacy/unregister-a-number.md) | [Delete a number's call flow](https://help.cloudtalk.io/api-reference/call-flows/delete-a-numbers-call-flow.md) |

> [!WARNING]
>
> The legacy Edit a number deletes the number's whole call flow before it writes its one routing step, and it renames a number only by also rerouting it. It writes no call flow version. To rename a number, use [Update a number](https://help.cloudtalk.io/api-reference/numbers/update-a-number.md), which changes nothing else.


## Related topics

- [API reference](https://help.cloudtalk.io/api-reference/overview.md)
- [CloudTalk API HTTP Error Codes: Causes and Resolutions](https://help.cloudtalk.io/guides/error-codes.md)
- [CloudTalk REST API: Call Center Automation Platform](https://help.cloudtalk.io/guides/introduction.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.