Skip to main content
Every error uses the same shape, so you can handle failures uniformly. The HTTP status code and error.code always match.
Some errors include an error.details object with extra fields. The clearest example is an insufficient funds error, which tells you the reference, the price, and your balance:

Status codes

Which errors charge you

Only a completed check charges your wallet, and only when it returns an answer. None of the errors above debit you:
  • 402, 403, 422 are refused before the provider is called.
  • 500 and 502 mean the check failed, which is never charged.
A 502 and, in the wallet race case, a 402 include a reference in error.details, so a failed attempt is still traceable in support and in your list.
A not_found is not an error. It comes back as a normal 200 with "status": "not_found" in the data, and it is charged, because the provider gave a real answer. Do not treat not_found as a failure. See the three outcomes.

Authentication errors in detail

Handling errors well

1

Branch on status first

Read the top level status boolean. If false, read error; never assume data is present on a failure.
2

Use error.code, not the message text

Branch your logic on the numeric code. Messages are for humans and may be refined over time; the codes are stable.
3

Keep any reference

When error.details.reference is present, log it. It ties a failed attempt to your support request and to your verification list.
4

Do not loop retries

A 402, 403, or 422 will not succeed on retry without a change on your side. A 502 may be transient, but each retry is a fresh, potentially billed check, so retry once at most and reconcile from the list. See References and retrieval.