TF Fiscal

NFC-e Consumer Invoices

POST/api/nfce/cancel

Cancel NFC-e

Cancels an authorized NFC-e. Unlike NFe, the cancellation reason here is provided by the client and forwarded to the tax authority. The tax authority cancellation window is short (usually 15-30 minutes after authorization).

Required headers

tokenstringstringIssuing company token
signstringstringMD5 signature
timestampstringstringUnix timestamp in seconds

Body

chave*stringstring44-digit access key of the NFC-e (note: here it's chave, not uuid as in other endpoints)
motivo*stringstringCancellation justification (tax authority requirement).

 * Required field.

Response fields (data)

motivostringstringOfficial tax authority message for the cancellation event
statusstringstringSituation: "Canceled"
nfceintintCanceled NFC-e number
serieintintNFC-e series
chavestringstring44-digit access key
modelostringstringDocument model: "nfce"
cStatintintTax authority event code: 135 or 155 = cancellation approved.

Response — error

When the tax authority rejects the event (e.g. cancellation deadline exceeded), success is false and data comes with status: "Failed" and the rejection cStat. Validation errors (missing chave/motivo, motivo shorter than 15 characters, NFC-e not found, contingency not yet transmitted) return success: false with the message in message and no data object.
{
  "success": false,
  "data": {
    "motivo": "Rejeição: Pedido de Cancelamento intempestivo",
    "status": "Failed",
    "nfce": 5,
    "serie": 1,
    "chave": "35210112345678901234650010000000051234567890",
    "modelo": "nfce",
    "cStat": 501
  }
}

Examples

# sign = md5(token + path + body + timestamp)
# Template generated from the endpoint path; replace the placeholders
curl -X POST "https://api.tffiscal.com/api/nfce/cancel" \
  -H "Content-Type: application/json" \
  -H "token: $TOKEN" \
  -H "timestamp: $TIMESTAMP" \
  -H "sign: $SIGN" \
  -d @body.json