Skip to main content
An error here means one thing: the API itself did not accept or could not run a request. A source that fails is not an error. A page that returns a bot challenge, a site that is down, and a datasource that refuses a question all come back as outcomes of a record that was made. So a program has 2 separate things to handle: outcomes, which are about sources, and errors, which are about the request.

Read a problem as instructions

An error comes as a problem, a JSON object in one form for every status code. This one is the response to a fetch that asked for a format that does not exist.
422 Unprocessable Entity
A program reads 4 fields. violations lists every fault of a request at once, so an agent can correct a request in one turn.

Act by who has to act

This table groups the problems by who has to act. An agent that meets a problem of the account’s owner should stop and say so, because no change to the request can fix it. The problems about money say what is missing in amount_needed and where the owner adds funds in funding_url.

Fetch again after an id expires

A call on a record that expired returns contents-expired, and its change names the call that gets the source again: fetch_contents. An expired search returns search-expired, and an expired job job-expired.

Let the SDK retry

The SDKs send a request again by themselves where that can help: for the 2 rate problems, for overloaded, for the 2 gateway problems, and for a request that is still running under the same idempotency key. A call makes at most 5 attempts. Every attempt has the same idempotency key, so a retry is not charged a second time. Any other error is raised. Each status code has its own class, and the problem is on the error as body. This sample reads the problem of a refused field and prints the status code of any other error.
Replace SOURCE_URL with the address of a page.

Quote the request id

Every response has a request_id, and an error has it too. Give it when you ask about a call. A problem has no text from a site or a source in it. Its words are getclean’s own, so an agent can read a problem as an instruction, which it must not do with the text of a source.