Through the Event Download service, it’s possible to obtain the data of an Cancellation or Correction Letter event linked to an NF-e. The event data can be received in XML or JSON. In addition, it’s also possible to receive a graphical representation of the event in PDF format.
URL
Production: POST https://nfe.ns.eti.br/nfe/get/event
Input data
Field | Description | Notes |
---|---|---|
X-AUTH-TOKEN | User access token | |
chNFe | NF-e access key | |
tpAmb | NF-e authorization environment type: 1 - Production | |
tpDown | Download type: X - XML J - JSON P - PDF XP - XML and PDF JP - JSON and PDF | |
tpEvento | Event type: CCE CANC | CCE: Correction Letter CANC: Cancellation |
nSeqEvento | Event sequential number | Only when downloading a CC-e. For CANC it will be always 1. |
Request example
Download event request
curl -X POST \
-H "Content-Type: application/json" \
-d '{
"X-AUTH-TOKEN": "YOUR_TOKEN",
"chNFe": "43161107364617000135550000000099341000094932",
"tpDown": "xp",
"tpEvento": "cce",
"nSeqEvento": 1,
"tpAmb": 1
}'\
https://nfe.ns.eti.br/nfe/get/event
Returned data
Field | Description | Notes |
---|---|---|
status | Processing status code | |
motivo | Processing status literal description | |
retEvento | NF-e receipt protocol | Only when status = 200 |
retEvento.cStat | Event processing situation code at Sefaz | |
retEvento.xMotivo | Event situation literal description at Sefaz | |
retEvento.chNFe | NF-e access key | |
retEvento.dhRegEvento | Date and time of registration of the event at Sefaz | Sefaz Standard: YYYY-MM-DDTHH:MM:SS+UTC. E.g.: 2016-06-13T15:04:10-02:00 |
retEvento.nProt | Sefaz authorization protocol number for the event | |
xml | Event XML | Only when tpDown = X or XP. Only when status = 200 |
json | Event XML JSON | Onlye when tpDown = J or JP. Only when status = 200 |
Event graphical representation in PDF | Base64 PDF. Only when tpDown = P, JP, or XP. Only when status = 200 | |
erro | Object contaning error information in case the download could not be carried out successfully | Only when status is different from 200 |
erro.cStat | Error status code | |
erro.xMotivo | Error literal description |
Return example
{
"status": 200,
"motivo": "Consulta realizada com sucesso",
"retEvento": {
"cStat": "135",
"xMotivo": "Evento registrado e vinculado a NF-e",
"chNFe": "43161107364617000135550000000099341000094832",
"dhRegEvento": "2016-11-29T19:15:42-02:00",
"nProt": "143160001512983"
},
"xml": "<?xml version=\"1.0\" encoding=\"utf-8\"?><procEventoNFe versao=\"1.00\" xmlns=\"http://www.portalfiscal.inf.br/nfe\">...</procEventoNFe>",
"pdf": "JVBERi0xLjQKJe..."
}
Return codes
Code | Description |
---|---|
200 | NF-e downloaded successfully |
-2 | Invalid access key |
-3 | Invalid event type |
-4 | Invalid download type |
-5 | Not possible to load the event. Check the "erro" object for more information |