# Errors

How the API reports a failed request, and the status codes that it uses.


A failed request answers with an HTTP status code and a problem document (RFC 9457). The content type is `application/problem+json`.

## The problem document

| Field | Type | What it holds |
| --- | --- | --- |
| `title` | string | The name of the status, for example `Conflict`. |
| `status` | integer | The HTTP status code. |
| `detail` | string | What went wrong, and what to change. |

For example, a submit with a file that failed its check answers:

```json
{
  "title": "Conflict",
  "status": 409,
  "detail": "gerber.zip: The zip has no board outline layer (Edge_Cuts, .GKO or .GM1). Export the outline with the other layers; it sets the shape and the size of the board. Fix the file and upload again, or remove it, then send the order to the quote."
}
```

Show the `detail` to your person, or act on it. It names the field, the limit or the state that caused the failure.

## Status codes

| Status | Title | When |
| --- | --- | --- |
| `400` | Bad Request | A path parameter or a field is not valid, the body is not JSON, or an upload has no body or no `Content-Length`. The `detail` names each field that failed. |
| `401` | Unauthorized | The request has no valid API key or session. |
| `403` | Forbidden | The credentials are valid, but the account may not do this. For example, an agent's account that no person has claimed cannot pay. |
| `404` | Not Found | The address does not exist, the order or the webhook is not in your account, or the order has no such file. |
| `405` | Method Not Allowed | The address exists, but not with this method. The `Allow` header lists the methods that it takes. |
| `409` | Conflict | The order is not in the right status for this call, a file failed its check, the process needs another file, the order holds 20 files already, or the quote expired. |
| `413` | Content Too Large | The file is larger than 50 MB. |
| `415` | Unsupported Media Type | The body has a media type that the operation does not take. |
| `429` | Too Many Requests | Too many requests in a short time, for example agent sign-ups from one IP address. Wait, then try again. |
| `503` | Service Unavailable | A part of the service is not ready, for example payment or email. Try again later. |

An unexpected failure answers `500` without a problem document. Try again later.

## Unknown addresses

An address under `/api/` that matches no operation answers `404` with the detail "There is no such address. See /openapi.json." The OpenAPI description lists every operation. See [API overview](/docs/api).

## What to do

| Status | Action |
| --- | --- |
| `400`, `413`, `415` | Change the request as the `detail` says. Do not send it again unchanged. |
| `401` | Check the API key. If you have none, see [Authentication](/docs/api/authentication). |
| `404` | Check the order ID and the file name. List the orders with `GET /orders`. |
| `403` | When the account must be claimed, ask your person to claim it. See [Agents](/docs/api/agents#claim). |
| `409` | Read the order with `GET /orders/{id}`, and check its `status`, its `files` and their `check`, and its `quote`. |
| `429`, `500`, `503` | Wait, then try again. |
