Uniform structure
Stable, machine-readable code. Use it to branch your error-handling logic (do not parse the
message).Human-readable message. It may change over time: do not use it to make decisions in your code.
May come in validation errors (
400 INVALID_REQUEST): a list of { field, issue } that indicates which field failed and why. In the batch mode of POST /v2/debts each entry also carries the index and externalRequestId of the failing item, and in POST /debts/cancel, the index. Malformed JSON returns [{ "field": "body", "issue": "Invalid JSON syntax" }]. Not every 400 carries it: when it is missing, the message says what failed.Catalog of codes
RESOLUTION_ERROR without companyCode indicates that the organization associated with your token is not properly configured in the system. If you see it persistently, contact support with the requestId.API Gateway errors (401 and 403)
401 and 403 are issued by the API Gateway, before the request reaches the API, and do not use the uniform structure: they carry no error object and no requestId. The only exception is the 403 RESOLUTION_ERROR of payment orders, which does have the error envelope.
The message is informational
The text of error.message is useful for debugging, but it is not a contract: it can change without notice. To decide what to do, use error.code and, when a validation error carries it, error.details[].field. The message examples in these guides are illustrative.
Recommendations
Branch by code
Decide your logic with
error.code, never with the text of message.Save the requestId
Log the
requestId in your logs: it is the fastest way for support to trace a request.Retry with idempotency
On
429 or 500, retry with the same Idempotency-Key (or the same externalRequestId) to avoid duplicates. After the retry, read the resource to confirm its status.Validate before sending
If a
400 carries error.details, use it to show your users which field to fix.
