# Errors

Every error is JSON with a stable `code`. Branch on the code, never on the message.

```json
{
  "error": {
    "code": "rate_limited",
    "message": "More than 30 requests in a minute for this key.",
    "docs_url": "https://whet.design/docs/api/errors#rate_limited"
  },
  "request_id": "req_…"
}
```

## Codes

| Status | code | Retry | Meaning |
| --- | --- | --- | --- |
| 401 | `missing_api_key` | No | No `Authorization: Bearer whet_sk_…` header. |
| 401 | `invalid_api_key` | No | The key is malformed, unknown or revoked. |
| 403 | `insufficient_scope` | No | The key does not carry the scope this endpoint needs. |
| 400 | `invalid_request` | No | A field is missing or invalid; the message names it. |
| 415 | `unsupported_media_type` | No | The body is not multipart/form-data or application/json. |
| 415 | `unsupported_image` | No | The image is not a PNG, JPEG or WebP Whet can read. |
| 415 | `unsupported_file` | No | The file is not a PDF, PNG, JPEG, WebP or SVG Whet can open. |
| 413 | `payload_too_large` | No | The file is larger than the endpoint allows (10 MB for images to identify, 50 MB for jobs). |
| 404 | `not_found` | No | No such object for this key's organisation. |
| 401 | `invalid_signature` | No | The X-Whet-Signature does not match the body, or the timestamp is more than 5 minutes off. |
| 409 | `automation_paused` | No | The automation is paused; resume it in the dashboard. |
| 429 | `rate_limited` | Yes | Too many requests for this key right now; wait `Retry-After` seconds. |
| 429 | `daily_limit_exceeded` | Yes | The key's 24-hour quota is used up; `Retry-After` says when a slot frees. |
| 504 | `upstream_timeout` | Yes | Identification took longer than 60 s. Retry once; crop to the word if it repeats. |
| 502 | `upstream_error` | Yes | Whet's identification service failed. Retry with backoff. |
| 503 | `service_unavailable` | Yes | Whet's identification service is not reachable. Retry with backoff. |
| 500 | `internal_error` | Yes | Something failed inside the API gateway. Retry with backoff. |

## Retrying

- Retry only the codes marked Yes.
- With `Retry-After`, wait that many seconds. Without it, back off exponentially: 2, 4, 8 seconds.
- At most 3 tries. Then report the `request_id`.
- `upstream_timeout` twice for the same word: crop tighter to the word, or pass its `box`.

---
This page as HTML: https://whet.design/docs/api/errors. All docs for agents: https://whet.design/llms.txt
