1. Inicio
  2. Documentos
  3. NS CTe (English)
  4. CTe Events
  5. CT-e Cancellation

CT-e Cancellation

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
FieldDescriptionNotes
X-AUTH-TOKENUser access token
chCTeCT-e access key
tpAmbCT-e authorization environment type: 1 - Production, 2 - Homologation
dhEventoDate and time of the cancellationSefaz Standard: YYYY-MM-DDTHH:MM:SS+UTC
E.g.: 2016-06-13T15:04:10-02:00
nProtCT-e authorization protocol number
xJustLiteral description of the reason for canceling the CT-eMinimum 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
FieldDescriptionNotes
statusProcessing status code
motivoProcessing status literal description
retEventoObject containing the CT-e processing dataOnly when status = 200
retEvento.cStatProcessing situation code
retEvento.xMotivoProcessing situation literal description at Sefaz
retEvento.chCTeCT-e access key
retEvento.dhRegEventoDate and time of event registration at SefazSefaz Standard: YYYY-MM-DDTHH:MM:SS+UTC
E.g.: 2016-06-13T15:04:10-02:00
retEvento.nProtEvent authorization protocol number
xmlDistribution XML of the cancellation eventOnly when status = 200
errosArray containing list of errors during the validation of the cancellation information according to the data typeOnly when status = -4
erros.codigoOccurred error codeOnly when status = -5
erros.descricaoOccurred error literal descriptionOnly 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
CodeDescription
200CT-e cancelled successfully
-2Mandatory fields in the request not informed
-3Invalid access key
-4Information error according to the data type
-5Error sending the cancellation to Sefaz. Check the "codigo" and "descricao" fields for more information

Como podemos ajudar?