Skip to main content
After you read this page, you can tell from a status code and a body what went wrong and what to do next. You also know which error class the SDK throws for it.

Rules for all routes

  • Branch on the HTTP status code. Branch on a JSON code only where this page names one.
  • A plain-text body is a short English sentence. Show it or log it. Do not parse it, because the words can change.
  • A route answers 200 also for some results that are not a success. Read the result field: outcome.kind of the receipt route, and outcome.kind inside the sealed reply of the email routes.

Body shape per route

Errors before the route runs

These errors come before the handler of a route reads the request. They have a plain-text body. A 400 or a 422 with such a body is a defect in your request. Fix the request. Do not retry it unchanged.

Errors from the engine

These routes pass a sealed request to the engine: stage, recover, notification_email/request_code and notification_email/verify_code. When the engine refuses, the Anafi API returns the status and the body of the engine without change. When the engine cannot be reached, the Anafi API answers 502 with the body engine unreachable. The bodies of the engine do not contain your plaintext. The reason for a refused rule document is sealed to you. See Sealed requests.

Status codes

The API reference lists the exact statuses of each operation.

SDK error classes

The SDK turns a failed HTTP call into the classes below. See SDK errors for the full list. DslStaleParentError is not a subclass of BackendRequestError. Check for it first.