Through the CT-e cancellation service, it’s possible to cancel a previously authorized knowledge through the API.
Obs.: The cancellation of a CT-e has rules and deadlines defined by the Secretaria da Fazendo that must be considered and respected. For more information, click here and check the most updated version of the Sefaz Contributors’ Guidance Manual.
URL
3.00 version
Production: POST https://cte.ns.eti.br/cte/cancel/300
Input data
Field | Description | Notes |
---|---|---|
X-AUTH-TOKEN | User access token | |
chCTe | CT-e access key | |
tpAmb | CT-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 | CT-e authorization protocol number | |
xJust | Literal description of the reason for canceling the CT-e | Minimum 15 characters |
Request Example
CT-e Cancellation request
curl -X POST
\-H "Content-Type: application/json"
\-d '{"X-AUTH-TOKEN":"...",
"chCTe":"43160612936829000344570000000010801000010620",
"tpAmb":"2",
"dhEvento":"2016-06-27T11:24:49-03:00",
"nProt":"143160000336628",
"xJust":"Conhecimento emitido para teste de integracao"
}' \
https://cte.ns.eti.br/cte/cancel
Returned data
Field | Description | Notes |
---|---|---|
status | Processing status code | |
motivo | Processing status literal description | |
retEvento | Object containing the CT-e processing data | Only when status = 200 |
retEvento.cStat | Processing situation code | |
retEvento.xMotivo | Processing situation literal description at Sefaz | |
retEvento.chCTe | CT-e access key | |
retEvento.dhRegEvento | Date and time of event registration at Sefaz | Sefaz Standard: YYYY-MM-DDTHH:MM:SS+UTC E.g.: 2016-06-13T15:04:10-02:00 |
retEvento.nProt | Event authorization protocol number | |
xml | Distribution XML of the cancellation event | Only when status = 200 |
erros | Array containing list of errors during the validation of the cancellation information according to the data type | Only when status = -4 |
erros.codigo | Occurred error code | Only when status = -5 |
erros.descricao | Occurred error literal description | Only when status = -5 |
Return example
{
"status": 200,
"motivo": "CT-e cancelado com sucesso",
"retEvento": {
"cStat": 135,
"xMotivo": "Evento registrado e vinculado a CT-e",
"chCTe": "43160612936129000195570000000010841000010620",
"dhRegEvento": "2016-06-28T07:56:35-03:00",
"nProt": "143160000339043"
},
"xml": "<?xml version=\"1.0\" encoding=\"utf-8\"?><procEventoCTe versao=\"2.00\" xmlns=\"http://www.portalfiscal.inf.br/cte\">...</procEventoCTe>"
}
Return codes
Code | Description |
---|---|
200 | CT-e cancelled successfully |
-2 | Mandatory fields in the request not informed |
-3 | Invalid access key |
-4 | Information error according to the data type |
-5 | Error sending the cancellation to Sefaz. Check the "codigo" and "descricao" fields for more information |