# Errors (/docs/errors)

Every error has the same shape. `message` explains what is wrong and how to fix it, and `docs_url` links to this page:

```json
{
  "error": {
    "code": "message_too_long",
    "message": "Your message, labels and replies are 612 characters; your plan allows 500. Remove 112 characters or upgrade.",
    "docs_url": "https://www.callhuman.es/docs/errors#message_too_long"
  }
}
```

Use `code` in your code (it never changes); show `message` to humans. When a request has several problems, we return the first one in this order: `401` → `402` → `403` → `429` → `422`.

| Code | HTTP | When |
|---|---|---|
| [`invalid_api_key`](#invalid_api_key) | 401 | API key missing, revoked or expired |
| [`subscription_required`](#subscription_required) | 402 | The project has no active plan |
| [`project_suspended`](#project_suspended) | 403 | Calls paused for a security review |
| [`rate_limit_exceeded`](#rate_limit_exceeded) | 429 | More than 30 requests/min or 300/hour |
| [`quota_exceeded`](#quota_exceeded) | 429 | No answered calls left this cycle |
| [`invalid_request`](#invalid_request) | 422 | Missing or invalid fields |
| [`message_too_long`](#message_too_long) | 422 | Message + labels + replies over your plan's limit |
| [`destination_not_allowed`](#destination_not_allowed) | 422 | Invalid number, unsupported country or blocked prefix |
| [`call_not_allowed`](#call_not_allowed) | 422 | The content isn't transactional (sales, marketing, scam) |
| [`call_not_found`](#call_not_found) | 404 | `GET /v1/calls/{id}` with an unknown ID |

## invalid_api_key [#invalid_api_key]

**HTTP 401.** The `Authorization` header is missing, or the key was revoked or has expired.

**Fix:** send `Authorization: Bearer <your key>`. Create a new key in the dashboard under **API keys** if needed. Keys can expire after 30 days, 90 days or 1 year, or never — check the one you use.

## subscription_required [#subscription_required]

**HTTP 402.** The project has no active plan, or the last payment failed.

**Fix:** choose a plan in the dashboard (**Settings → Choose a plan**), or update your card in **Manage billing**. API keys work as soon as the plan is active.

## rate_limit_exceeded [#rate_limit_exceeded]

**HTTP 429.** More than **30 requests per minute** or **300 per hour** for the project.

**Fix:** wait the seconds shown in the message and retry. Spread large batches over time. Use an `Idempotency-Key` header so retries never create duplicate calls.

## quota_exceeded [#quota_exceeded]

**HTTP 429.** You have used all the answered calls included in this billing cycle.

**Fix:** upgrade your plan from the dashboard — it applies immediately. Otherwise calls reset at the start of your next cycle. Unanswered calls never count.

## invalid_request [#invalid_request]

**HTTP 422.** A required field is missing or a value is invalid. The message names the exact field, for example:

- `to is required` / `to must be in international format, e.g. +34600111222`
- `options[2].options has 12 items; the maximum per menu is 9 (keys 1–9). Group the rest into a submenu.`
- `options[1] has both reply and options; use one of them`
- `options are nested 4 levels deep; the maximum is 3`

**Fix:** correct the field named in the message. See [Options, replies & submenus](/docs/options#rules) for the menu rules.

## message_too_long [#message_too_long]

**HTTP 422.** `message` plus every `label` and `reply` (submenus included) is longer than your plan allows. The message says how many characters to remove.

**Fix:** shorten the text, or upgrade to a plan with a higher limit. We check before calling, so a call is never cut halfway.

## destination_not_allowed [#destination_not_allowed]

**HTTP 422.** The number is not valid, its country is not supported, or it uses a blocked prefix (premium-rate and other high-risk destinations).

**Fix:** use the international format with country code (`+34…`, `+1…`). Check that the country is supported in [Phone numbers](/docs/phone-numbers).

## project_suspended [#project_suspended]

**HTTP 403.** New calls are paused for this project because too many recent calls looked like marketing, sales or other unsolicited messages (10% warns, 25% — or 3 blocked calls in a row — pauses).

**Fix:** reply to the email we sent, or write to hello@callhuman.es. We review it and lift the pause if it was a mistake.

## call_not_allowed [#call_not_allowed]

**HTTP 422.** CallHuman only places **transactional** calls: confirmations, reminders and updates about something the person already has with you, verification codes, security alerts and approvals. Before every call we check what the person will hear; this one looked like marketing, sales, a scam or another unsolicited message, so we didn't call and it doesn't count.

```json
{
  "error": {
    "code": "call_not_allowed",
    "message": "This call looks like marketing or sales. CallHuman only places transactional calls (confirmations, codes, approvals, alerts). Remove the promotional part and try again.",
    "docs_url": "https://www.callhuman.es/docs/errors#call_not_allowed"
  }
}
```

**Fix:** keep the message about the person's booking, order, account or code. Offers, discounts and sales pitches aren't allowed, even as a side note.

## call_not_found [#call_not_found]

**HTTP 404.** No call with that ID exists in the project of your API key.

**Fix:** check the ID returned by `POST /v1/calls`, and use an API key of the same project.