Sign inCreate a free account
Theme

Errors

One error shape, the codes it uses, and which are worth retrying.

Anything that is not a 2xx carries a body of the same shape, so one branch in your code handles every failure:

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

code is stable and safe to branch on. message is written for a person and may be reworded, so match on the code rather than the sentence.

Status codes

StatusMeans
200The request succeeded.
202Accepted and queued. An analysis that is not cached returns this, with a Location header naming where the result will appear.
400The request was malformed: a missing field, a URL that is not a URL.
401No key, an unknown key, or a revoked one.
403A valid key on a plan that does not include what you asked for.
404No such endpoint, or no such thing in this workspace.
405Right path, wrong method. The Allow header says which are accepted.
429Too many calls, or the monthly allowance is spent.
500Our fault. Worth reporting with the time it happened.

Error codes

CodeStatusWhat to do
missing_key401Send the Authorization header.
invalid_key401Check the key. Guessing does not work: unknown keys are refused identically to malformed ones.
revoked_key401Somebody revoked it. Create a new one.
plan_excluded403The plan does not include the API, or not this part of it. Upgrade or stop calling it.
rate_limited429Wait the retry_after seconds and try again.
quota_exceeded429The monthly allowance is spent. Do not retry in a loop: it will not succeed until the period rolls over.
invalid_request400Read message; it names the field.
not_found404The path or the resource does not exist in this workspace.

When you run out

Two different limits return 429, and the code tells them apart. rate_limited means too many calls in the last minute and clears by itself; quota_exceeded means the monthly allowance is spent and clears when the period rolls over, or when the plan changes.

{
    "error": {
        "code": "rate_limited",
        "message": "That key has made 60 calls in the last minute.",
        "detail": {
            "limit": 60,
            "retry_after": 60
        }
    }
}

Retry 429 and 500 with a backoff. Do not retry 400, 401 or 403: nothing about them changes by asking again, and a tight retry loop on a bad key just burns your rate limit.

Type to search. Try a check name from your report, an endpoint, or what you are trying to do.

↑↓ to move ↵ to open Esc to close