POST
/api/invoice/cancelCancel invoice
Cancels an authorized NF-e. The justification sent to the tax authority is fixed: "Erro no preenchimento da nota fiscal." — it cannot be configured via payload. Calling the endpoint again for an invoice already canceled through it returns success with the previous cancellation result, without resubmitting to the tax authority.
Required headers
tokenstring | string | Issuing company token |
signstring | string | MD5 signature |
timestampstring | string | Unix timestamp in seconds |
Body
uuid*string | string | UUID of the NF-e to cancel (internal identifier returned by /api/invoice/create) |
* Required field.
Response fields (data)
motivostring | string | Official tax authority message confirming the cancellation |
statusstring | string | Situation: "Canceled" |
nfeint | int | Canceled NF-e number |
serieint | int | NF-e series |
chavestring | string | 44-digit access key |
modelostring | string | Document model: "nfe" |
epecboolean | boolean | Issued under EPEC contingency |
xmlstring | string | URL of the invoice XML updated to the canceled status (cStat 101) |
xml_string | string | URL of the cancellation event XML (procEventoNFe).Not returned when the invoice was already canceled before the call |
Response — error
Failures return
success: false with the tax authority message in message and no data object. Happens when uuid is missing, the certificate is invalid, or tax authority rejects the cancellation (e.g. deadline exceeded, invoice already canceled).
{
"success": false,
"message": "Rejeicao: Prazo de Cancelamento superior ao previsto na Legislacao",
"code": "TAX_AUTHORITY_REJECTED"
}Examples
# sign = md5(token + path + body + timestamp) # Template generated from the endpoint path; replace the placeholders curl -X POST "https://api.tffiscal.com/api/invoice/cancel" \ -H "Content-Type: application/json" \ -H "token: $TOKEN" \ -H "timestamp: $TIMESTAMP" \ -H "sign: $SIGN" \ -d @body.json
{
"uuid": "4663a257-adf1-4561-971f-6aaffbd30ca8"
}
{
"success": true,
"data": {
"motivo": "Cancelamento de NF-e homologado",
"status": "Canceled",
"nfe": 100,
"serie": 1,
"chave": "35260112345678000199550010000001001000000017",
"modelo": "nfe",
"epec": false,
"xml": "https://oss.example.com/.../chave.xml",
"xml_cancelamento": "https://oss.example.com/.../chave-cancelamento.xml"
}
}