TF Fiscal

NF-e Invoices

POST/api/invoice/cancel

Cancel 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

tokenstringstringIssuing company token
signstringstringMD5 signature
timestampstringstringUnix timestamp in seconds

Body

uuid*stringstringUUID of the NF-e to cancel (internal identifier returned by /api/invoice/create)

 * Required field.

Response fields (data)

motivostringstringOfficial tax authority message confirming the cancellation
statusstringstringSituation: "Canceled"
nfeintintCanceled NF-e number
serieintintNF-e series
chavestringstring44-digit access key
modelostringstringDocument model: "nfe"
epecbooleanbooleanIssued under EPEC contingency
xmlstringstringURL of the invoice XML updated to the canceled status (cStat 101)
xml_cancelamentostringstringURL of the cancellation event XML (procEventoNFe).

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