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

# Errors

> One shape for every refusal, the HTTP status that goes with it, and every code your program can branch on.

Every refusal looks the same, whatever refused it:

```json theme={null}
{
  "error": {
    "code": "invalid_request",
    "message": "Give “phone” as a number with its country code, like +919876543210.",
    "field": "phone"
  }
}
```

* `code` is the contract: stable, safe to branch on.
* `message` is for people. It may be improved; don't parse it.
* `field` names the part of the request at fault, when there is one.

Every answer, refused or not, carries an `X-Request-Id` header. Quote it to
[support@fireflo.au](mailto:support@fireflo.au) and we can find the request. You can send your own `X-Request-Id`
and it is used instead.

## Codes

| Status | Code | What happened, and what to do |
| :- | :- | :- |
| 400 | `invalid_request` | A value is missing or wrong; `field` names it |
| 400 | `invalid_json` | The body isn't valid JSON |
| 400 | `invalid_idempotency_key` | An `Idempotency-Key` is at most 255 characters |
| 401 | `key_required` | Send a key: `Authorization: Bearer ff_live_…` |
| 401 | `invalid_key` | The key is wrong, has expired, or was revoked |
| 403 | `account_suspended` | The account is suspended |
| 403 | `plan_excludes_api` | The account's plan doesn't include the API |
| 403 | `address_not_allowed` | The key only works from the addresses it was given |
| 403 | `scope_missing` | The key may not do this; the message names the scope |
| 404 | `not_found` | No such record in this account |
| 404 | `channel_off` | The account doesn't have that channel on |
| 405 | `method_not_allowed` | That method isn't allowed on this path |
| 410 | `gone` | The endpoint was removed; the message says what to use instead (`/v1/routes`: give `steps` in the message) |
| 409 | `contact_exists` | Another contact already has that number; the message names them |
| 409 | `name_taken` | Another template already has that name |
| 409 | `already_finished` | The message is no longer being tried, so it can't be cancelled |
| 409 | `not_permitted` | The person's consent doesn't allow it |
| 409 | `channel_closed` | The channel can't take typed text now, e.g. WhatsApp outside its 24 hours |
| 409 | `channel_refused` | The channel's provider turned it down; the message says why |
| 409 | `provider_refused` | A channel's provider refused the request (templates, registrations) |
| 409 | `call_refused` | The call couldn't be placed |
| 409 | `calls_unavailable` | The account has no channel that places calls |
| 409 | `idempotency_mismatch` | The same `Idempotency-Key` came with a different request |
| 409 | `idempotency_in_progress` | A request with that `Idempotency-Key` is still being answered |
| 429 | `rate_limited` | Too many requests from this key; wait for `Retry-After` seconds |

## Why a send was refused

When a channel won't take a message for reasons of account, money or consent, the reason
has one code, the same on SMS, WhatsApp and RCS. It is the `code` on a message's refused
attempt (see [Messages with failover](https://cpaas.fireflo.au/developers/messages-with-failover.md#how-a-step-hands-over)),
and the words beside it name the channel and, where it matters, the message type.

| Code | What happened |
| :- | :- |
| `no_units` | An account below a reseller has no units of the message's type left. The words name the type and who gives the units. |
| `reseller_paused` | The reseller's money for the channel has run out, or can't cover this send now. Sends below it wait until it is topped up. |
| `insufficient_balance` | An account that pays in money can't cover the send. |
| `not_in_plan` | The account's plan doesn't include the channel. |
| `awaiting_approval` | The account signed up and isn't approved yet. |
| `suspended` | The account, or a reseller above it, is suspended. |
| `unsubscribed` | The person unsubscribed from this channel in their messaging app, or from the number it would come from. |

> [!WARNING]
>
> From OMNI 1.11.0, an account below a reseller that has no units gets `no_units`. It used
> to get `insufficient_balance`. If your program matches on the old code for that case,
> match on `no_units` too.

Some sending endpoints add codes of their own — for example `no_channel` when a message
has nowhere to go. Each [API reference](https://cpaas.fireflo.au/api-reference/overview.md) page lists the codes it
can return.

> [!TIP]
>
> A provider's own words are passed on when they help ("the template isn't approved").
> When a provider couldn't be reached at all, you get a plain sentence instead — retry
> shortly.


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