# Extract errors

A request can fail as a whole, and each URL can fail on its own. Only the first changes the HTTP status.

## Two levels

- **The request.** A request that is not valid, cannot be paid for, or has no room to run answers with an HTTP error and the one [error shape](https://millionshort.com/docs/errors#the-error-shape) every endpoint uses.
- **Each URL.** A valid request answers `200` even when every URL failed. Each entry of `data.results` has `status: "ok"` or `status: "error"` with an `error` of its own. A URL that fails costs nothing, except in `rendered`, `unblock` and `stealth` when the site says the page does not exist (`404`, `410`): that page is charged at the mode's price and marked `charged: true`.

## Request errors

| Status and code | When |
|---|---|
| `400 INVALID_PARAM` | A field the API does not take, a URL that is not `http` or `https`, an empty label list, an unknown slug. On a [batch](https://millionshort.com/docs/extract/batch), also a `webhook_id` that is not an `active` [endpoint](https://millionshort.com/docs/webhooks) of your team: one that does not exist, is still `pending` verification, or was `disabled` |
| `400 UNSUPPORTED_OPTION` | A mode the plan does not include, or one that is switched off |
| `401 AUTH_MISSING_KEY`, `401 AUTH_INVALID_KEY` | No `Authorization` header, or a key that is malformed, revoked or expired |
| `404 JOB_NOT_FOUND` | `GET` or `DELETE` of a batch that does not exist or belongs to another team. The two are not told apart |
| `429 INSUFFICIENT_CREDITS` | The balance does not cover the URLs at the price of the mode asked for |
| `429 RATE_LIMITED` | The team has no fetch slot free at all |

## Per-URL errors

| Code | Meaning | Try next |
|---|---|---|
| `URL_NOT_ALLOWED` | Not a public web page we will fetch | |
| `ROBOTS_DISALLOWED` | The site's robots.txt does not allow our bot | |
| `ROBOTS_UNAVAILABLE` | robots.txt could not be read, so we did not fetch | Later |
| `SITE_OPTED_OUT` | The site asked us not to fetch or serve it | |
| `NOT_IN_CACHE` | `cached` mode: we hold no copy | `live` |
| `FETCH_FAILED` | The site did not answer usefully | Later |
| `TIMEOUT` | The site was too slow | Later |
| `TOO_LARGE` | The page is over 10 MiB | |
| `UNSUPPORTED_CONTENT_TYPE` | Not a kind of document we read | |
| `BLOCKED_BY_SITE` | The site refused our bot | `unblock` |
| `RENDER_FAILED` | `rendered` or `unblock` could not load the page | Later |
| `HOST_BUSY` | We are already fetching from this site as fast as we allow | After `retry_after_seconds` |
| `HOST_DAILY_LIMIT` | This team reached its daily limit for this site | Tomorrow (UTC) |
| `CAPACITY` | `rendered` and `unblock` are at capacity | After `retry_after_seconds` when it is given, else later |

[Parameters](https://millionshort.com/docs/extract/parameters#per-url-errors) has the same table with every condition spelled out.

## What not to work around

`ROBOTS_DISALLOWED` and `SITE_OPTED_OUT` are final: there is no option to ignore robots.txt, and no mode gets past a site's own choice. `BLOCKED_BY_SITE` is different. The site refused an automated request, and `unblock` is the mode for that, on the plans that include it.

## Warnings

A `200` can carry `warnings`: `looks_script_built` when a `live` page looks like an empty shell (try `rendered`), and `labels_unavailable` when labels could not be made, in which case no page is left out by a label list.
