Status codes and errors

Every status code the API returns, whether it was billed, and how to handle each one, including retries with backoff.
Open as Markdown
On this page

Errors come at two levels. A request-level error means nothing ran. A task-level error affects one task in an otherwise successful request. No error is billed.

Compatible routes (DataForSEO envelope)

The top-level status_code and the HTTP status describe the request. Each tasks[].status_code describes its task. A request with a failed task still returns HTTP 200 and top-level 20000; count failures with tasks_error.

CodeMessageLevelHTTPBilledWhat to do
20000Ok.request, task200Task: yesRead result.
20100Task Created.task200NoQueued. Collect it later with task_get.
40006You can send up to 100 tasks in one request.request400NoSplit the array.
40100Authentication required.request401NoSend your key. See Authentication.
40101Authentication failed.request401 or 403NoCheck the key; create a new one if it was revoked. 403 means the key's owner left the organization.
40102No Search Results.task200NoThe search or page returned nothing. Don't retry right away.
40202Too many requests. Retry after N s.request429NoWait for Retry-After seconds, then retry.
40210Insufficient funds.request402NoTop up, or lower max_cost / max_level to lower the reservation.
40400Not Found.request404NoCheck the path.
40401Task Not Found.task200NoWrong id, or another organization's task.
40402This endpoint isn't available yet.request, task404 / 200NoThe route isn't served yet. Check GET /v1/account/support_matrix.
40501Invalid Field: ...task200NoFix the field named in the message. Don't retry unchanged.
40503POST Data Is Invalid.request400 (405 for a GET on a POST route)NoSend a JSON array of task objects.
40601Task Handed.task200NoA worker is running it. Check again shortly.
40602Task In Queue.task200NoWaiting for a worker. Check again later.
50000Internal Error. You weren't billed.request, task500 / 200NoRetry with backoff.

Request-level errors return the envelope with an empty tasks array:

{
  "version": "0.1.20261203",
  "status_code": 40210,
  "status_message": "Insufficient funds. Your wallet balance is $0.00 and this request can cost up to $0.001800. Top up and retry. You weren't billed.",
  "time": "0.0025 sec.",
  "cost": 0.0,
  "tasks_count": 0,
  "tasks_error": 0,
  "tasks": []
}

GET /v1/account/errors is DataForSEO's errors list for your account: the failed queued tasks of the last 7 days, newest first (limit up to 1,000, offset).

Scale SERP, Outscraper and Apify shapes

These routes return their source product's error body with an HTTP status mapped from the code above:

CodeHTTPScale SERPOutscraperApify error.type
40100, 40101401request_info.success: falsestatus: "Error"user-or-token-not-found
40210402not-enough-usage-to-run-paid-actor
40400, 40402404record-not-found
40202429rate-limit-exceeded
50000500internal-error
anything else, including 40501 and 40102400invalid-input

The message is in request_info.message (Scale SERP), errorMessage (Outscraper) or error.message (Apify). An Apify-shaped search that finds no ads therefore returns HTTP 400 with invalid-input and the message "No ads found for the input."

Crawl API routes

Request-level errors use one body:

{ "status": "error", "error": { "http_status": 402, "code": "balance_required", "message": "Your wallet balance is $0.00 and this request can cost up to $0.003000. Top up and retry. You weren't billed." } }
HTTPcodeWhenWhat to do
400invalid_requestThe body isn't valid; details names the fields. Also more than 100 batch targets.Fix and resend.
401unauthorizedMissing, malformed or revoked key.Check the key.
402balance_requiredThe wallet can't cover the worst case.Top up.
403forbiddenThe key's owner isn't an active organization member.Use another key.
404not_foundNo job, task or tracker with that id in your organization.Check the id.
405method_not_allowedWrong HTTP method.
415unsupported_media_typeThe body isn't JSON.Send application/json.
422invalid_targetA URL isn't absolute http(s), is too long, or points to a private host.Fix the URL.
422max_cost_exceededmax_cost is below the price of a Standard fetch.Raise max_cost.
429rate_limitedOver the per-key rate or the per-organization inline limit.Wait for Retry-After.
502upstream_errorThe site or search couldn't be fetched.Retry later with backoff.
503not_configuredThe feature isn't available on this server yet.

A single-URL POST /v1/crawls mirrors its task in the HTTP status: 200 completed (including pages billed $0 because they weren't real content), 502 upstream_error, 422 invalid_target or max_cost_exceeded, 503 level_unavailable. The body is still the full envelope with a receipt. HTTP 451 blocked_by_policy appears only when robots.txt enforcement is turned on for the deployment; it's off by default, and the receipt records what robots.txt said either way.

Retrying safely

Retry only what can succeed on a second try:

RetryDon't retry unchanged
40202 / 429, after Retry-After40501, 40503, 40006, 400, 415, 422
50000 / 500, 50240100, 40101, 401, 403
Network errors and timeouts on GET40210 / 402, until you've topped up
40601, 40602 on task_get, after a pause40402, 40400, 40401

Use exponential backoff with jitter: wait about 1 s, then 2 s, 4 s, 8 s, up to a cap of around 60 s, with a random fraction added to each wait. Stop after a handful of attempts.

A POST that timed out on your side may have run and been billed. We don't support idempotency keys yet. Before retrying a live POST, read the result back where you can (task_get, GET /v1/crawls/{id}), or prefer task_post so you hold the task id before anything runs. Retrying safely has worked examples.