Through the NF3-e cancellation method, it’s possible to cancel a previously authorized NF3-e through the API.
Obs.: the NF3-e cancellation has rules and deadlines defined by the Secretaria da Fazenda that must be considered and respected. For more information, click here and verify the most up-to-date version of the Sefaz Contributors’ Guidance Manual.
URL
Production: POST https://nf3e.ns.eti.br/v1/nf3e/cancel
Input Data
Field | Description | Notes |
---|---|---|
X-AUTH-TOKEN | User access token | |
chNF3e | NF3-e access key | |
tpAmb | NF3-e authorization environment type: 1 - Production, 2 - Homologation | |
dhEvento | Date and time of the cancellation | Sefaz Standard: YYYY-MM-DDTHH:MM:SS+UTC. E.g.: 2016-06-13T15:04:10-02:00 |
nProt | NF3-e authorization protocol number | |
xJust | Literal description of the reason for the NF3-e cancellation | Minimum 15 characters (no API restriction on special characters) |
Request Example
NF3-e cancellation request
curl -X POST \
-H "Content-Type: application/json" \
-d '{"chNF3e": "11111111111111111111111111111111111111111111", "tpAmb": 2, "dhEvento": "2021-02-22T10:26:00-03:00", "nProt": "111111111111111", "xJust": "teste de integração"}'\
https://nf3e.ns.eti.br/v1/nf3e/cancel
Returned Data
Field | Description | Data Type | Parent | Notes |
---|---|---|---|---|
status | Processing status code | Int | ||
motivo | Literal description of the processing status code | String | ||
retEvento | Object containing the cancellation processing data at Sefaz | Object | Only when status = 200 | |
cStat | Processing status code | Int | retEvento | |
xMotivo | Literal description of the processing status at Sefaz | String | retEvento | |
idEvento | Id of the generated event | Int | retEvento | |
chNF3e | NF3-e access key | Int | retEvento | Only when cStat = 135 |
dhRegEvento | Date and time of the event registration at Sefaz | Date | retEvento | Sefaz Standard: YYYY-MM-DDTHH:MM:SS+UTC. E.g.: 2016-06-13T15:04:10-03:00. Only when cStat = 135 |
nProt | Event authorization protocol number | Int | retEvento | Only when cStat = 135 |
xml | Cancel event distribution XML | String | retEvento | Only when cStat = 135 |
erro | Object containing error information in case the cancellation cannot be carried out successfully | Object | Only when status is different from 200 | |
cStat | Error status code | Int | erro | |
xMotivo | Literal description of the error | String | erro |
Response Examples
Successful response
{
"status": 200,
"motivo": "NF3e cancelado com sucesso",
"retEvento": {
"cStat": "135",
"xMotivo": "Evento registrado e vinculado a NF3e ",
"idEvento": "11011111111111111111111111111111111111111111111111",
"chNF3e": "11111111111111111111111111111111111111111111",
"dhRegEvento": "2021-02-25T17:56:36-03:00",
"nProt": "111111111111111",
"xml": "<procEventoNF3e>... </procEventoNF3e>"
}
}
Return Codes
Code | Description |
---|---|
200 | NF3-e successfully cancelled |
-2 | Invalid access key |
-3 | It was not possible to cancel the NF3-e. Verify the "erro" object for more information |
-4 | Problem with digital certificate. Check the "erro" object for more information |
-5 | Invalid event according to the validation agaisnt schema |
NF3-e Cancellation Download
You can download the complete cancellation distribution information in XML or JSON and also a graphical representation of the same in PDF. For this, check the download event at NS NF3-e API.