# Errors

> Every `/v1` error has one shape, `{"error": {"code", "message"}}`, with a stable `code` to branch on and a `message` to show a person. This page lists the codes, what each status means, and the OAuth endpoints’ own error shape.

Source: https://zurchin.com/docs/errors

## The shape

Response 403:

```json
{
  "error": {
    "code": "forbidden",
    "message": "This key cannot do that: it needs `send` access or more."
  }
}
```

Branch on `code`, never on `message`: messages are written for people and may change. The SDKs raise `PidgeonError` with `status`, `code` and `message`.

## Codes

| Status | `code` | Meaning |
| --- | --- | --- |
| 400 | `invalid` | The request is missing a field or has a bad value. The message names it. |
| 401 | `unauthenticated` | No key, an unknown or revoked key, or a suspended account. Send `Authorization: Bearer pgn_…`. |
| 402 | `payment_required` | The month’s free volume is used and usage billing is off. |
| 403 | `forbidden` | The key’s access is too low, or the thing is not allowed (a revoked agent, another pod). |
| 403 | `held` | Email only: the message is held for a person until a member releases it. |
| 403 | `exfiltration_blocked` | Email only: the message carries text a key read in another conversation. Nothing was sent. |
| 404 | `not_found` | No such thing in this account (or this key’s pod), or no such route: a `/v1` path the API does not have answers this too. |
| 405 | `method_not_allowed` | The route exists but not with this method. `Allow` lists the methods it takes. |
| 409 | `conflict` | It already exists: a published key, a reported verification, a taken address. |
| 409 | `idempotency_in_progress` | A call with the same `Idempotency-Key` is still running. `Retry-After` says when to ask for its answer. [Idempotency](https://zurchin.com/docs/api-keys.md#idempotency) |
| 422 | `idempotency_key_reused` | This `Idempotency-Key` was used with a different body, or by another key of the account. Use a new one. |
| 409 | `draft_not_editable` | Email only: the draft has moved on (held for approval, scheduled, sent, rejected); the message says which. |
| 429 | `rate_limited` | Too many requests for this key, or over a sending limit. `Retry-After` says when, where it applies. |
| 413 | `too_large` | Email only: a file over 4 MB sent in one request. Use the [upload link](https://zurchin.com/docs/email.md#attachments) instead. |
| 502 | `send_failed` | Email only: the mail service refused the message. |
| 507 | `storage_full` | Email only: the account’s 10 GB of mail and files is used. Delete conversations to free it. |
| 503 | `unavailable` | Email only: the mail service is busy. Try again in a minute. |

## A body over 4.5 MB

Zurchin runs on Vercel, which refuses any request body over 4.5 MB before Zurchin sees it: `413` with a plain-text body (`FUNCTION_PAYLOAD_TOO_LARGE`), not the JSON shape above. Check the status before parsing. Only files get that large: over 4 MB, upload one with the [upload link](https://zurchin.com/docs/email.md#attachments), which puts the bytes straight into storage, up to 25 MB.

## OAuth endpoints

`/oauth/token` and `/oauth/register` answer as OAuth does (RFC 6749 §5.2): `{"error": "invalid_grant", "error_description": "…"}`.
