1. Inicio
  2. Documentos
  3. NS NFe (English)
  4. Events
  5. NFe Cancellation

NFe Cancellation

Through the NF-e cancellation service, it’s possible to cancel a previously authorized invoice through the API.

Obs.: The cancellation of NF-e has rules and deadlines defined by Sefaz that must be considered and respected. For more information, click here and check the most updated version of the Sefaz Contributors’ Guidance Manual.

URL

Production: POST https://nfe.ns.eti.br/nfe/cancel

Input Data
FieldDescriptionOccurrenceNotes
X-AUTH-TOKENUser access token1-1
chNFeNF-e access key1-1
tpAmbNF-e authorization environment type:
1 - Production
2 - Homologation
1-1
dhEventoDate and time of the cancellation1-1Sefaz Standard: YYYY-MM-DDTHH:MM:SS+UTC
E.g.: 2016-06-13T15:04:10-02:00
nProtNF-e authorization protocol number1-1
xJustLiteral description of the reason for cancelling the NF-e
Request example
NF-e cancellation request
curl -X POST \
    -H "Content-Type: application/json" \
    -d '{
         "X-AUTH-TOKEN": "YOUR_TOKEN", 
         "chNFe": "43161107364617000135550000000099601000094832", 
         "tpAmb": "2", 
         "dhEvento": "2016-11-28T19:06:14-02:00", 
         "nProt": "143160001510168", 
         "xJust": "NF-e cancelada para teste de desenvolvimento de software de integração"
         }'\
    https://nfe.ns.eti.br/nfe/cancel
Returned data
FieldDescriptionNotes
statusProcessing status code
motivoProcessing status literal description
retEventoObject containing the cancellation processing data at SefazOnly when status = 200
retEvento.cStatProcessing situation code
retEvento.xMotivoLiteral description of the processing situation at Sefaz
retEvento.chNFeNF-e access key
retEvento.dhRegEventoDate and time of the event registration at SefazSefaz Standard: YYYY-MM-DDTHH:MM:SS+UTC. E.g.: 2016-06-13T15:04:10-02:00
retEvento.nProtSefaz authorization protocol number for the event
erroObject containing error information in case the cancellation could not be carried out successfullyOnly when status is different from 200
erro.cStatError status code
erro.xMotivoError literal description
Return example

Successful return

{
  "status": 200,
  "motivo": "NF-e cancelada com sucesso",
  "retEvento": {
    "cStat": 135,
    "xMotivo": "Evento registrado e vinculado a NF-e",
    "chNFe": "43161107364617000135550000000099601000094832",
    "dhRegEvento": "2016-11-28T19:09:04-02:00",
    "nProt": "143160001510173"
  }
}
Return codes
CodeDescription
200NF-e cancelled successfully
-2Invalid access key
-3It was not possible to cancel the NF-e. Check the "erro" object for more information
Download NF-e cancellation

You can download the complete cancellation distribution information in XML or JSON and also a graphical representation of the same in PDF format. For this, check the Event Download method in the NS NF-e API.

Como podemos ajudar?