# Errors

A failed request answers with an HTTP status and, in most cases, a JSON body with a `code` your system can
act on and a `message` for people:

```json
{ "code": "bad_request", "message": "The request is invalid." }
```

| Status | `code` | When | What to do |
|---|---|---|---|
| `400` | `bad_request` | A parameter is invalid or out of range, a cursor was sent with other parameters, or the request has more than 50 query parameters. | Fix the request. Sending it again unchanged won't help. |
| `400` | `too_large` | The answer would be too large. | Ask for fewer results with a smaller `limit`. |
| `401` | | The key is missing, unknown, expired or deleted, or API access is off for the workspace. | Check the key on the API keys page. See below for this body. |
| `404` | `not_found` | The by-id route (coming soon): no result with this id in your workspace. | Check the id. |
| `429` | | Too many calls. See [Rate limits](/rate-limits). | Wait for `Retry-After` seconds. |
| `503` | `unavailable` | A service behind the API failed or was too slow. | Wait for `Retry-After` seconds, then send the same request again, cursor included. |

## The 401 body

A `401` comes from the key check, before the API reads anything, and its body has a different shape: a
problem details object with `type`, `title` and `status`. Rely on the status code, not on the body.

## A 503 without a body

When the key can't be checked at all, the answer is `503` and may have no body. Treat it like any other
`503`.
