- Getting started
- Errors
Getting started
Errors
HTTP statuses returned by the API and what to do in each case.
| Status | Meaning | What to do |
|---|---|---|
400 | Invalid body: a required field is missing, the format is wrong, or a field is not allowed. | Fix the payload. |
401 | The credential is missing, invalid, or expired. | Check the x-api-key header. Generate a new key in the issuer app if the current one expired. |
402 | Issuance is blocked by the plan or the account balance. | Talk to Treeunfe sales. |
403 | No permission. Includes Organization is inactive. | Check that the company is active in Treeunfe. |
404 | Resource not found. | Check the ID and that it belongs to the key’s company. |
422 | The invoice or event was rejected in validation, by SEFAZ, or by the ADN. | Read the reason in the response, fix it, and send it again. |
429 | The request limit was exceeded. | Wait and try again, with a growing interval between attempts. |
503 | SEFAZ is unavailable. | Try again later, with a growing interval between attempts. |
On 503 for an NF-e, do not create an invoice with a new number. Send the same invoice again, with the same nNF and the same serie, so you do not leave gaps in the numbering.
NFS-e validation errors
When issuing an NFS-e, a 400 returns outcome: "VALIDATION_ERROR" and a list of every problem found:
{
"outcome": "VALIDATION_ERROR",
"errors": [
{
"code": "2002",
"title": "Tipo inválido",
"field": "payload.vServ",
"message": "Campo foi enviado com tipo diferente do esperado. Esperado: number, recebido: string",
"details": { "expected": "number", "received": "string" }
},
{
"code": "2006",
"title": "CNPJ/CPF inválido",
"field": "payload.tomadorCnpj",
"message": "Documento informado não é um CNPJ ou CPF válido"
}
]
}
code range | Type | Example |
|---|---|---|
2xxx | Payload: a field is missing, or the type or format is wrong. | 2002 Invalid type |
3xxx | Business rule. | |
5xxx | Resource or system. field comes back as system. | 5001 company not found |
Fix every item in the list before sending the invoice again.