> For the complete documentation index, see [llms.txt](https://docs.cekat.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cekat.ai/api-documentation/errors.md).

# Errors

Errors return a non-2xx HTTP status and a JSON body with `success: false` and a human-readable message in `error.message`.

| Status   | Meaning                                                                                             |
| -------- | --------------------------------------------------------------------------------------------------- |
| 400      | The request is invalid: a field is missing or in the wrong format, or Meta rejected it.             |
| 401      | The API key is missing or invalid.                                                                  |
| 404      | The resource doesn't exist or doesn't belong to your business.                                      |
| 409      | The record already exists, such as a contact with the same phone number or email.                   |
| 413      | The uploaded file is too large.                                                                     |
| 422      | The request is well-formed but fails validation. Used by the campaign and recipient list endpoints. |
| 429      | Too many requests. See **Rate limits** below.                                                       |
| 500      | Unexpected server error.                                                                            |
| 502, 503 | A dependency is temporarily unavailable. Retry later.                                               |

#### Error body

Endpoints under `/api/...` return:

```json
{
  "success": false,
  "message": "Campaign not found",
  "statusCode": 404,
  "error": { "message": "Campaign not found" },
  "correlationId": "9b2f6c1e-3d4a-4f7e-8a51-2c0d9e7b6a10"
}
```

Other endpoints, such as `/templates...`, `/messages...` and `/inboxes`, return:

```json
{
  "success": false,
  "status_code": 400,
  "error": { "message": "phone_number required" }
}
```

In both, read the reason from `error.message`. When you contact support about an error, include the `correlationId` if the response has one.

`POST /templates/send` is an exception: when Meta rejects the message, it returns HTTP 200 with `success: false`. Check `success` in the body as well as the HTTP status.

#### Rate limits

Requests are limited per API key, per endpoint, over a one-minute window. When you go over the limit, you get HTTP 429 with:

```json
{ "message": "Too many requests, please try again later" }
```

Wait before retrying, and back off further if you get 429 again. Spread large jobs out instead of sending requests in bursts, and use the bulk endpoints where they exist, such as recipient lists and campaigns instead of many single template sends.
