Errors

Every failure has the same shape and a stable code. Branch on the code - the message is written for people and may be reworded.

{ "error": { "code": "invalid_key", "message": "That API key does not exist." } }

Some errors carry extra fields alongside those two: parameter for the one that was wrong, retry_after for how long to wait, limit and used for a spent quota.

Every code

StatusCodeWhen
400missing_queryquery was empty or absent.
400unsupported_queryfiletype:css or filetype:js, which work on the website only.
400unknown_formatformat is not one of the six.
400unknown_columncolumns names a field that does not exist.
400format_not_availableA flat format was asked for where rows are not what is being returned.
400per_page_too_largeper_page above your plan's row limit. The limit is in the error.
400invalid_jsonThe POST body is not valid JSON.
401missing_keyNo Authorization: Bearer header.
401invalid_keyThe key does not name an account.
403plan_requiredThe account has no paid plan.
404unknown_endpointNo such path. The known ones are listed in the error.
405method_not_allowedRead-only API. Use GET, or POST a JSON body.
429too_many_requestsArriving faster than two requests per 30 seconds.
429quota_exceededThe day's search allowance is spent.
429snippet_quota_exceededThe day's snippet allowance is spent. Searching without snippets still works.

What to do about each

Errors and formats

Errors come back as JSON, or as XML when format=xml was asked for. The flat formats have no shape for an error, so a failed request that asked for csv gets JSON - which means a client reading CSV should check the status code rather than assume every 200-shaped body is rows.

Reading the codes without reading this page

GET / lists every code above, with its meaning, as JSON. It needs no key, so a client can be built against the whole set without anyone opening a browser.

curl https://api.publicwww.com/
Next Code examples