Error catalogue
One envelope, a code you branch on, and a status that tells you little.
Every error answers the same three fields, and all three are always present:
{
"code": "ER038",
"message": "Bad credentials.",
"solution": "Check the username and password you authenticated with."
}code- A stable ERxxx identifier. This is what you branch on.
message- What went wrong, in a sentence. For your logs.
solution- What to do about it. Written for a person, not for a parser.
Branch on the code, not the status
Almost every error is a 400
Of the 65 endpoints documented here, all but one answer their failures as
400, whatever the failure was. So the status does not distinguish a bad
currency from an expired token from a disabled account. The code does.
That is the opposite of the advice for v3, where the body shape is not uniform
and the status is the reliable part. Here the envelope is uniform and the status
is not, so a legacy client reads body.code and a v3 client reads the status.
Two integrations, two habits.
The exception is ER920, which answers 429, because throttling was handled
before the envelope ever got involved.
The codes worth knowing up front
The two documents declare 214 codes between them, and each endpoint page lists the ones that endpoint can return. These are the ones that turn up everywhere:
ER802- Authorization token not found. No usable credential arrived.
ER803- Multiple authorization methods used. Send one credential.
ER048- Invalid JSON data provided. The body did not parse.
ER114- Unsupported currency provided.
ER124- User is disabled. Authenticated, but not permitted to act.
ER920- Rate limit exceeded. The one code that is not a 400.
ER999- Something failed that we did not name. Treat it as ours, not yours, and retry with backoff.
Handle an unknown code as a plain failure
The catalogue grows. A code you do not recognise means the call did not
succeed, which is all your integration needs to act on. Log the message and
the solution, show the customer your own copy, and never match on the message
text: it is prose and can be reworded.