# Status codes

> Every REST status and the error bodies you will see most often.

Page: https://doxtract.manoonlabs.com/docs/api/errors

| Status | Meaning |
| --- | --- |
| `200` | The call succeeded. |
| `201` | A schema was created. |
| `400` | A failed parse returns status "error", message, credits_used, and credits_remaining. That includes an export other than xlsx or csv, and a filename that is not a string, both caught before credits are spent. Schema routes (`/api/v1/schemas`) and whoami return status "error" and message naming the field or rule that failed, with no credit fields because they never spend credits. Their success bodies start with status "ok". |
| `401` | The bearer token is missing, unknown, revoked, or expired. The response body is empty, and the call is omitted from Activity. |
| `402` | The workspace does not have enough credits for this document. The body includes credits_required, credits_used, credits_remaining, and upgrade. A 402 does not spend. Allotments per plan are on the pricing page. |
| `403` | Parsing is paused for this workspace. |
| `404` | That schema was not found. |
| `405` | The HTTP method does not match the route. The response body is empty. |
| `409` | The schema name already exists, or the workspace is at its schema limit. |
| `429` | This workspace already parsed in the last second. Limit is 1 parse per second per workspace. The body includes retry_after. REST also sends Retry-After. A 429 does not spend credits. |
| `502` | The model could not extract the document. The body has status "error", message, credits_used 0 (the charge is refunded), and credits_remaining. With strict true, a chunk that could not be read also returns 502 with failed_page_ranges, the pages that failed. |
| `503` | Storage or the job queue behind the parser could not be reached. The body has status "error", message, failure_code SERVICE_UNAVAILABLE, credits_used 0 (nothing is charged), and credits_remaining. REST also sends Retry-After. Retry the same request after that many seconds; a job id you sent in X-Job-Id can be reused. |
| `504` | The parse took longer than 100 seconds (10 minutes with Prefer: respond-async) and was stopped. Same body as 502: the charge is refunded. Try again, or send fewer pages. |

## Error bodies

**400**

```json
{
  "status": "error",
  "message": "Unknown schema: invoice",
  "credits_used": 0,
  "credits_remaining": 59
}
```

**402**

```json
{
  "status": "error",
  "message": "Workspace is out of credits.",
  "credits_required": 1,
  "credits_used": 0,
  "credits_remaining": 0,
  "upgrade": "/billing"
}
```

**429**

```json
{
  "status": "error",
  "message": "This workspace is limited to 1 parse per second.",
  "credits_used": 0,
  "credits_remaining": 59,
  "retry_after": 1
}
```

**502**

```json
{
  "status": "error",
  "message": "The model could not extract this document.",
  "credits_used": 0,
  "credits_remaining": 59
}
```
