# API error codes: causes, billing and retries | Spider

Every error code the Spider API returns, what causes it, whether it is billable, and how to retry it. Covers auth, quota, target and browser failures.

Canonical: https://spider.cloud/docs/core/error-codes/

The API answers with standard HTTP status codes. An error also carries a JSON body. See [authentication](https://spider.cloud/docs/core/authentication/) for key errors and [rate limits](https://spider.cloud/docs/core/rate-limits/) for throttling.

## Error body

An error body is JSON with an error string. A 402 adds a code to branch on and an upgrade_url. A 400, 401 or 404 can arrive with an empty or plain text body, so read the status code first.

429 body

```
{
  "error": "Rate limit exceeded",
  "status": 429
}
```

402 body

```
{
  "error": "Your credit balance is empty. Add credits at https://spider.cloud/credits/new to continue.",
  "code": "credits_required",
  "upgrade_url": "https://spider.cloud/credits/new?utm_source=api&utm_medium=paywall&utm_content=credits_required"
}
```

## Status codes per page

Each page in a crawl result carries the HTTP status the target site returned. It says nothing about your request to Spider. An attempt bills for the bandwidth and compute it used, whatever status the page returns. A failed page is not free. A blocked or empty page pays the 0.01 credit page minimum plus the compute it used, usually a fraction of a cent. Spider does not bill bandwidth for bytes it never received.

| Status code      | Description           | Consumes credits | Cause                                                                             | What to do next                                                                         |
| ---------------- | --------------------- | ---------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| [2xx](#2xx-body) | Success               | Yes              | The target page was fetched.                                                      | Nothing to do.                                                                          |
| [404](#404-body) | Target page not found | Yes              | The URL does not exist on the target site.                                        | Check the URL and that the page still exists.                                           |
| [403](#403-body) | Forbidden             | Yes              | The target site blocked the request.                                              | Set request to "browser" for JavaScript rendering.                                      |
| [401](#401-body) | Unauthorized          | Yes              | The target page needs a login.                                                    | Use automation_scripts to run the login flow first.                                     |
| [400](#400-body) | Bad request           | Yes              | The target server rejected the request.                                           | Check that the URL is well formed and reachable.                                        |
| [429](#429-body) | Rate limit exceeded   | Yes              | The target site is rate limiting requests.                                        | Add a delay between requests or lower concurrency.                                      |
| [500](#500-body) | Server error          | No               | The target server hit an internal error.                                          | Retry. If it keeps failing, the target site itself is down.                             |
| [503](#503-body) | Service unavailable   | No               | The target server is temporarily unavailable.                                     | Retry after a short delay. The site may be under maintenance.                           |
| [504](#504-body) | Timed out             | Yes              | The page did not finish loading within the time the request allows.               | Retry the page.                                                                         |
| [597](#597-body) | No content returned   | Yes              | Spider sets this status itself when the page came back with no content to return. | Check that the URL serves content. Try request "browser" for pages built by JavaScript. |

## Status codes for the request

The HTTP status of the response to your request. It tells you whether Spider accepted and ran it. Without a key, every route returns 402 with an x402 payment challenge, /scrape included, except /unlimited/\*, which returns 401. With Bearer free, every route other than /scrape returns 402.

| Status code         | Description                           | Cause                                                                                                                                                                                                                                                   | What to do next                                                                                                                                                                                                                                                                                                                                          |
| ------------------- | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [200](#200-request) | Success                               | Spider ran the request.                                                                                                                                                                                                                                 | Read status and error on each page in the array.                                                                                                                                                                                                                                                                                                         |
| [204](#204-request) | No content returned                   | The crawl finished but found no content.                                                                                                                                                                                                                | Check that the URL returns content. Try another return_format.                                                                                                                                                                                                                                                                                           |
| [400](#400-request) | Bad request, check request parameters | Invalid parameters, a malformed JSON body, or a GET sent to a POST route.                                                                                                                                                                               | Send a POST with a JSON body and check it for a missing url or a bad value.                                                                                                                                                                                                                                                                              |
| [401](#401-request) | Authentication error                  | Missing, invalid, or expired API key. Also a call to /unlimited/\* with no key.                                                                                                                                                                         | Send `Authorization: Bearer` with a key from [https://spider.cloud/api-keys](https://spider.cloud/api-keys/).                                                                                                                                                                                                                                            |
| [402](#402-request) | Payment required                      | No credits left, a call with no Authorization header (code x402_payment_required, with a PAYMENT-REQUIRED header, /scrape included), the free token on a route other than /scrape (code free_tier_route_blocked), or an /ai/\* call without an AI plan. | Add credits at [https://spider.cloud/credits/new](https://spider.cloud/credits/new/). With no key, get one at [https://spider.cloud/api-keys](https://spider.cloud/api-keys/), or pay per request with x402. For the free tier on /scrape, send `Authorization: Bearer free`. For /ai/\*, pick a plan at [AI pricing](https://spider.cloud/ai/pricing/). |
| [403](#403-request) | Forbidden                             | An /unlimited/\* call without an active Unlimited plan. The body says unlimited_plan_required or unlimited_plan_inactive.                                                                                                                               | Start or renew the plan on the [pricing page](https://spider.cloud/pricing/?plan=unlimited), or call the same route without the /unlimited prefix to spend credits.                                                                                                                                                                                      |
| [404](#404-request) | Not found                             | The path is not an API route. With no key, an unknown path returns 402 instead.                                                                                                                                                                         | Check the path against the [API reference](https://spider.cloud/docs/api/). The balance route is GET /data/credits.                                                                                                                                                                                                                                      |
| [413](#413-request) | Payload too large                     | The request body is over the size limit.                                                                                                                                                                                                                | Send fewer URLs or parameters per request.                                                                                                                                                                                                                                                                                                               |
| [429](#429-request) | Rate limit exceeded                   | Too many requests in the current window. On /unlimited/\*, all of your concurrency is in use.                                                                                                                                                           | Wait the number of seconds in Retry-After, then send the request again. Your limit is on the [rate limits page](https://spider.cloud/docs/core/rate-limits/).                                                                                                                                                                                            |
| [500](#500-request) | Server error                          | An unexpected error on Spider's side.                                                                                                                                                                                                                   | Retry with exponential backoff. If it keeps failing, write to <support@spider.cloud>.                                                                                                                                                                                                                                                                    |
| [503](#503-request) | Service unavailable                   | Spider is temporarily unavailable.                                                                                                                                                                                                                      | Retry with exponential backoff, honoring Retry-After when the response has one.                                                                                                                                                                                                                                                                          |
