# Errors

Errors use conventional status codes and always carry a JSON body with a message. Validation errors add an errors object keyed by field.

| Status | Meaning |
| --- | --- |
| 400 | An Idempotency-Key longer than 255 characters. |
| 401 | Missing, revoked or unknown API key, an old key whose prefix does not name its mode, or a key of a suspended account: {"message": "This account is suspended."}. |
| 403 | The API key may not do this: a restricted key without the permission the endpoint needs, {"message": "This API key does not have the charges:write permission."}, or a key used from an address it does not allow, {"message": "This API key cannot be used from 198.51.100.4."}. An owner or admin can change the key's permissions and addresses on the API keys page; see Authentication. |
| 404 | No such object for this account and mode: {"message": "No such object."}. Other accounts' objects, and the other mode's, are never revealed. A path the API does not have answers 404 too. |
| 405 | The path exists, but not with this method. |
| 409 | The action is not allowed in the object's current state, e.g. canceling a paid charge. Also when an Idempotency-Key is reused for a different request, or while the first request carrying it is still being worked on; that one carries Retry-After: 1. |
| 422 | Validation failed; see errors. This includes a charge below its coin's minimum, under errors.asset, and emailing a test-mode invoice or charge to someone outside your account, under errors.customer_email. |
| 429 | Too many requests: the rate limit, an invoice or a charge emailed within the last 10 minutes or past the 100 customer emails an hour the account shares with the other accounts its owner owns, or a charge past the account's cap on charges created in one rate lock (see Charges). Wait the number of seconds in the Retry-After header. |
| 500 | Something went wrong on our side: {"message": "Server Error"}. Check the object before retrying a write, since a failed request is not stored for idempotency. |
| 503 | Creating a charge while no exchange rate is available: {"message": "Exchange rates are unavailable right now. Try again in a minute."} |

**Response**

```http
HTTP/1.1 422 Unprocessable Content
{
  "message": "The selected asset is invalid. (and 1 more error)",
  "errors": {
    "asset": ["The selected asset is invalid."],
    "amount": ["The amount field is required."]
  }
}
```
