Short answer: every response is HTTP 200 with a status field. 0 is success; 1000–1029 mean the request must change (or wait); 1500–1504 mean the same request can be sent again. The response header X-SerpBase-Retryable says which of the two it is, so a client never has to parse the message.
Below are the codes we triggered on purpose on 29 November 2026, with the exact messages, followed by the ones we did not trigger.
Codes we triggered
All of these answered HTTP 200 with credits_charged 0.
| What we sent | status | error | Retryable header |
|---|---|---|---|
/google/search with no q | 1000 | query is required and must not be empty | false |
/google/search with "tbs":"lastweek" | 1000 | invalid or conflicting search parameter: tbs | false |
/google/trends with six terms | 1000 | Trends supports at most five compared query terms | false |
| An endpoint the docs mark as Paused | 1003 | forbidden | false |
A path that does not exist (/google/nothing) | 1004 | no product is registered at /google/nothing... | false |
/google/search with "timeout":1 | 1504 | upstream request timed out | true |
/google/resolve, one call out of four | 1502 | upstream service error; retry shortly | true, with Retry-After: 1 |
Two details from those runs:
- The
1000,1003and1004refusals came back at once (elapsed_ms0). The1504came back after 1,002 ms: the one-second budget we asked for, then an immediate answer. - The
1502on the resolver arrived in a tenth of a second. The identical call a few minutes later returned all ten links.
A missing or wrong key gives 1001; those messages are in the API key guide.
A failure looks like this
{
"status": 1000,
"error": "query is required and must not be empty",
"request_id": "r-a21e54f7b5e0eb9039dbe7c7",
"elapsed_ms": 0,
"credits_charged": 0
}
request_id is on every answer, success or failure. Quote it when you ask support about a request.
Codes we did not trigger
From the responses and errors docs:
status | Meaning | What to do |
|---|---|---|
1020 | Not enough credits | Top up; do not retry |
1029 | Over your requests per second | Wait the Retry-After seconds, then resend |
1500 | Unexpected error on our side | Resend |
1503 | The endpoint cannot take the request right now | Resend after a short wait |
None of the failures is charged.
Python: one function that handles all of them
import time, requests
API = "https://api.serpbase.dev"
HEADERS = {"X-API-Key": "YOUR_API_KEY"}
class ApiError(Exception):
pass
def call(path, body, tries=3):
for attempt in range(tries):
resp = requests.post(API + path, headers=HEADERS, json=body, timeout=60)
data = resp.json()
if data["status"] == 0:
return data
retryable = resp.headers.get("X-SerpBase-Retryable") == "true" or data["status"] == 1029
if not retryable or attempt == tries - 1:
raise ApiError(f'{data["status"]} {data.get("error")} ({data.get("request_id")})')
time.sleep(float(resp.headers.get("Retry-After", 1 + attempt)))
try:
call("/google/search", {"gl": "us"})
except ApiError as e:
print("refused:", e)
r = call("/google/search", {"q": "coffee shops", "gl": "us", "hl": "en"})
print("ok:", len(r.get("organic", [])), "organic results,", r["credits_charged"], "credit")
Our run printed refused: 1000 query is required and must not be empty (r-26d1...) and then ok: 7 organic results, 1 credit.
Things that trip people up
response.okis always true. The HTTP status is 200 for failures too. Testdata["status"] == 0.- Success can be empty. A search Google has no results for is
status0 withno_resultstrue, and it is charged. That is an answer, not an error. - Do not retry
1000–1020. The same request will fail the same way. Readerror: it names the parameter. 1003on one endpoint is not a key problem. In our test the key worked everywhere else; the endpoint was one the docs list as paused. Check the endpoint's docs page.- Keep your HTTP timeout at 60 seconds. If the client hangs up first you get neither a result nor a status. To get an answer sooner, send the
timeoutparameter (1–30 seconds) on Google search and you receive1504when it runs out. Background: what timeout to set. - Cap the retries. Three attempts with a short pause is enough; an endless loop on
1502just burns your rate limit.
Related
Pacing and the 1029 code are covered in the API keys and rate limits docs. The machine-readable list of every endpoint and schema is in the OpenAPI file.
Cost and limits
Failed requests cost nothing. Successful Google searches are 1 credit; credits cost $0.25–$0.50 per 1,000 depending on the plan, and new accounts get 500 free credits without a card.
- All status codes: responses and errors
- Endpoint reference: docs
- Credit packs: pricing