[BR] Cancelling Notas Fiscais (API)
What is a cancellation?
Cancelling a nota fiscal voids an authorized NFSe or NFe with the authority (Prefeitura or SEFAZ). Brinta sends the cancellation request and stores the canceled XML/PDF on the invoice.
| Field | Value |
|---|---|
| Endpoint | PUT https://api.brinta.com/invoices/{invoice_id} |
status | cancel process |
cancel_reason | Code (NFSe) or free text (NFe) |
To cancel from the dashboard instead, see [BR] Cancelling Invoices.
When to cancel
| Situation | Cancel? |
|---|---|
| NFSe or NFe authorized with wrong data, within the deadline | ✅ Yes |
| Duplicated nota fiscal | ✅ Yes |
| Services not rendered / sale not completed | ✅ Yes |
Nota fiscal rejected by the authority (failed) | ❌ No, it was never authorized |
| Deadline expired | ❌ No, issue a credit note instead (see API Credit Notes Creation) |
NFe can usually be cancelled within 24 hours of authorization. NFSe deadlines depend on the municipality.
Field by Field
Path
invoice_id
invoice_idThe Brinta invoice ID returned when the invoice was created.
Body
status
statusAlways "cancel process".
cancel_reason
cancel_reasonThe format depends on the document type:
NFSe (services invoice): reason code
services invoice): reason code| Value | Reason |
|---|---|
"01" | Invoice issued with errors |
"02" | Services not rendered |
"03" | Duplicated invoice |
Send the code without a leading zero. Any other value, including "01" or free text, is sent as "1" (issued with errors).
NFe (goods invoice): justification text
goods invoice): justification textFree text (justificativa) between 15 and 255 characters. Shorter or longer values return 400.
No related invoice is needed for Brazil cancellations.
Full Example Payload
Cancel an NFSe
{
"status": "cancel process",
"cancel_reason": "02"
// NFSe: "01" errors, "02" services not rendered, "03" duplicated
}Cancel an NFe
{
"status": "cancel process",
"cancel_reason": "Pedido cancelado pelo cliente antes do envio da mercadoria"
// NFe: free text, 15 to 255 characters
}What happens next
The cancellation is sent to the authority during the request.
- Accepted: the invoice moves to
canceled(confirmed through the invoice webhook) and the canceled XML/PDF become available on the invoice. - Refused: the request returns
400with the authority's message, and the invoice keeps its status.
Common Mistakes
| Mistake | What happens | Fix |
|---|---|---|
| NFSe reason sent as free text | Cancelled with reason "issued with errors" | Send the reason code |
| NFe reason under 15 or over 255 characters | 400, nothing is cancelled | Write a justification between 15 and 255 characters |
Cancelling a failed NFe | 400: the invoice must not be failed | Only authorized notas fiscais can be cancelled |
| Cancelling after the deadline | The authority refuses the cancellation | Issue a credit note instead |
Updated about 12 hours ago
