[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.

FieldValue
EndpointPUT https://api.brinta.com/invoices/{invoice_id}
statuscancel process
cancel_reasonCode (NFSe) or free text (NFe)

To cancel from the dashboard instead, see [BR] Cancelling Invoices.


When to cancel

SituationCancel?
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

The Brinta invoice ID returned when the invoice was created.

Body

status

Always "cancel process".

cancel_reason

The format depends on the document type:

NFSe (services invoice): reason code

ValueReason
"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

Free 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 400 with the authority's message, and the invoice keeps its status.

Common Mistakes

MistakeWhat happensFix
NFSe reason sent as free textCancelled with reason "issued with errors"Send the reason code
NFe reason under 15 or over 255 characters400, nothing is cancelledWrite a justification between 15 and 255 characters
Cancelling a failed NFe400: the invoice must not be failedOnly authorized notas fiscais can be cancelled
Cancelling after the deadlineThe authority refuses the cancellationIssue a credit note instead

Did this page help you?