TF Fiscal

NFS-e Service Invoices

POST/api/nfse/cancel

Cancel NFS-e

Required headers

tokenstringstringCompany token
signstringstringMD5 signature
timestampstringstringUnix timestamp in seconds

Fields

chave*stringstringVerification code of the NFS-e (codigoVerificacao from the issuance response, codigo_verificacao in the list); for NFS-e of the national system, the 50-digit access key (chave in the issuance response and the list) is also accepted
motivo*stringstringCancellation reason.
c_motivostringstringNational system only: cancellation justification code, "1" = Issuance error (default), "2" = Service not provided, "9" = Other; other values return an error.

Only NFS-e with status autorizada can be cancelled. If the national system or the municipality replies that the NFS-e is already cancelled, the endpoint also returns success and updates the record status to cancelada.

Common errors

MessageCause
O campo chave (codigo de verificacao) e obrigatoriochave not provided
O campo motivo e obrigatoriomotivo not provided
NFS-e nao encontrada para a chave informadaNo NFS-e with this verification code or access key under the company of the token
Somente NFS-e autorizada pode ser canceladaThe NFS-e is already cancelled or not authorized
O motivo do cancelamento deve ter no minimo 15 caracteresNational system: motivo shorter than 15 characters
cMotivo invalido: use 1 (Erro na emissao), 2 (Servico nao prestado) ou 9 (Outros)National system: c_motivo outside the allowed values
Chave de acesso da NFS-e invalida para cancelamento (esperados 50 digitos)National system: the access key stored in the record does not have 50 digits

Examples

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