Error codes
The API answers with standard HTTP status codes. An error also carries a JSON body. See authentication for key errors and 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.
| Status code | Description | Consumes credits | Cause | What to do next |
|---|---|---|---|---|
| 2xx | Success | Yes | The target page was fetched. | Nothing to do. |
| 404 | Target page not found | Yes | The URL does not exist on the target site. | Check the URL and that the page still exists. |
| 403 | Forbidden | Yes | The target site blocked the request. | Set request to "browser" for JavaScript rendering. |
| 401 | Unauthorized | Yes | The target page needs a login. | Use automation_scripts to run the login flow first. |
| 400 | Bad request | Yes | The target server rejected the request. | Check that the URL is well formed and reachable. |
| 429 | Rate limit exceeded | Yes | The target site is rate limiting requests. | Add a delay between requests or lower concurrency. |
| 500 | Server error | No | The target server hit an internal error. | Retry. If it keeps failing, the target site itself is down. |
| 503 | Service unavailable | No | The target server is temporarily unavailable. | Retry after a short delay. The site may be under maintenance. |
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 other than /scrape returns 402, except /unlimited/*, which returns 401.
| Status code | Description | Cause | What to do next |
|---|---|---|---|
| 200 | Success | Spider ran the request. | Read status and error on each page in the array. |
| 204 | No content returned | The crawl finished but found no content. | Check that the URL returns content. Try another return_format. |
| 400 | 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 | 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. |
| 402 | Payment required | No credits left, a call with no key to a route that needs one, or an /ai/* call without an AI plan. | Add credits at https://spider.cloud/credits/new. With no key, get one at https://spider.cloud/api-keys. For /ai/*, pick a plan at AI pricing. |
| 403 | 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, or call the same route without the /unlimited prefix to spend credits. |
| 404 | 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. The balance route is GET /data/credits. |
| 413 | Payload too large | The request body is over the size limit. | Send fewer URLs or parameters per request. |
| 429 | 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. |
| 500 | Server error | An unexpected error on Spider's side. | Retry with exponential backoff. If it keeps failing, write to support@spider.cloud. |
| 503 | Service unavailable | Spider is temporarily unavailable. | Retry with exponential backoff, honoring Retry-After when the response has one. |