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: it is mistyped, was deleted in the profile or was revoked. Keys: https://publicwww.com/profile/api" } }

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, max for the largest value allowed, resets_at for when extraction points return.

Every code

StatusCodeWhen
400missing_queryquery was empty or absent.
400unknown_formatformat is not one of the six.
400unknown_columncolumns names a field that does not exist.
400format_not_availablecsv, tsv or txt where it does not fit. They fit search results; also csv on /v1/clusters/{id}/extract and txt on /v1/clusters/{id}.
400invalid_parameterA value of the wrong kind: page, per_page, offset or limit not a whole number in range, a delimiter longer than one character, a cluster number that is not one. parameter names it.
400per_page_too_largeper_page above its limit: your plan's row limit for a search, 10000 for a cluster's domains. The limit is in the error.
400page_too_deeppage × per_page past your plan's row limit: a plan covers the first N rows of a query. The limit is in the error.
400invalid_jsonThe POST body is not valid JSON.
400missing_sourceCreating a cluster needs query or domains.
400ambiguous_sourceBoth query and domains were sent.
400missing_domainsdomains held no usable name.
400domains_not_foundNone of the names in domains is in the index; no cluster is created.
400invalid_operationoperation is not and, or or diff.
400invalid_clustersclusters must list two or more ids, exactly two for diff.
400missing_nameRenaming needs a non-empty name.
400missing_regexExtraction needs fields, presets or regex.
400invalid_regexAn expression is not a PCRE in slashes or pipes, up to 200 characters, flags imsu.
400too_many_regexMore than ten expressions, presets included.
400unknown_fieldA field name that does not exist; the answer lists them.
400unknown_presetA preset name that does not exist; the answer lists them.
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, and did_you_mean names the nearest one, such as /v1/account for /account.
404cluster_not_foundNo cluster with that id on this account.
405method_not_allowedUse GET, or POST a JSON body; changes to clusters take POST.
409cluster_limitThe account already keeps the most clusters it can, 100; delete some first.
429too_many_requestsArriving faster than ten requests per minute (API and MCP together).
429quota_exceededThe day's search allowance is spent.
429snippet_quota_exceededThe day's snippet allowance is spent. Searching without snippets still works.
429extract_quota_exceededThe day's extraction points are spent.
503unavailableSignatures are temporarily unavailable. Try again later.

What to do about each

Errors and formats

Errors come back as JSON, or as XML with format=xml. The flat formats have no error shape: a failed csv, tsv or txt request gets JSON, so check the status code before reading rows.

The codes from the API itself

GET / lists every code above with its meaning, as JSON, without a key.

curl https://api.publicwww.com/
Next Clusters