Error format
codeis stable and machine-readable. Branch on it.messageis for people. Show it, log it, but do not parse it: the wording can change.- Some errors carry extra fields beside them, such as
sale,item,errors,creditNoteIdorbranches. They are listed below.
Status codes
A
404 for an id from another business is deliberate: whether an id exists in someone else’s account is not
something you can learn from us. It is never a 403.
Specific codes
These codes tell you more than the status alone.
Examples:
Validation messages
A400 reports the first problem it finds, and names the field, so you fix one thing at a time:
traderInvoiceNumber is requiredlines[0].quantity must be greater than 0saleDate must be a date as YYYY-MM-DD
"3500" is refused, because money is never guessed.
Dates are YYYY-MM-DD and must be real calendar dates.
Two kinds of failure
KRA or validation refused it
The request was understood and refused because of something in your data: a code that is not on KRA’s
list, a missing classification, too little stock. Status
400, 409 or 422. Fix the data, then retry.It never went through
A network or system problem on the way to KRA: a timeout, a
502, a 500. Nothing about your request was
wrong. Retry with the same Idempotency-Key, which is safe.
Retrying a data problem without fixing the value just fails again with the same reason.
Common KRA rejection reasons
When the code iskra_rejected, the message holds KRA’s own reason. These come up often:
If you meet a reason that is not listed and cannot tell which kind it is, contact support
with the exact reason text.
Troubleshooting checklist
- Call
GET /v1/me. If it fails, the problem is the key. See Authentication & API keys. - Read
error.code, thenerror.message. The message names the field or the KRA reason. - For a
422on a sale, readerror.sale.erroranderror.sale.status: the sale still exists. - For a missing scope, check the key’s permissions on the Integrations page.
- For a
403about environments, check that a test key is acting on a sandbox business, or a live key on a production one.
id, the time of
the request and the error body. Never send the key itself.
Read next
- Idempotency: repeating requests safely
- Rate limits: handling a
429 - Codes & Values: the code lists behind most data rejections