Skip to content

Errors

Errors use standard HTTP status codes and a consistent JSON body.

{
"error": {
"code": "serpapi.region_unknown",
"message": "Unknown region code",
"task_id": null
}
}
Field Meaning
code Stable, machine-readable identifier — branch on this, not on message.
message Human-readable description (English).
task_id The related task, when the error concerns one (else null).
Status Code Meaning Fix
401 apikeys.missing No Authorization header. Send Authorization: Bearer sk_live_….
401 apikeys.invalid Unknown or revoked key. Check the key; create a new one if revoked.
402 payments.insufficient_balance Not enough credits; no task created. Top up your balance and retry.
404 serpapi.task_not_found No such task for your organization. Check the task_id.
422 serpapi.keyword_empty keyword is missing or blank. Provide a non-empty keyword.
422 serpapi.region_unknown region is not a supported code. Use a code from GET /regions.
422 serpapi.device_invalid device is not desktop, mobile, or tablet. Send a valid device.
422 serpapi.depth_out_of_range depth is outside 1–5. Use a depth between 1 and 5.
422 serpapi.type_unsupported type is not available. Use serp_full (the only current type).
429 serpapi.rate_limited Per-key rate limit exceeded. Honor Retry-After; back off. See Rate limits.