The CT-e download method is responsible for returning the XML and the DACTE (Electronic Auxiliary Document of Transport Knowledge) from providing the access key of an authorized CT-e.
URL
3.00 version
Production: POST https://cte.ns.eti.br/cte/get/300
Input data
Field | Occurrence | Description |
---|---|---|
X-AUTH-TOKEN | 1-1 | User access token |
chCTe | 1-1 | CT-e access key |
tpAmb | 1-1 | CT-e authorization environment type: 1 - Production, 2 - Homologation |
CNPJ | 1-1 | Issuer CNPJ |
tpDown | 1-1 | Download type: "X" - XML, "J" - JSON, "P" - PDF, "XP" - XML and PDF, "JP" - JSON and PDF |
Request example
CT-e download request
curl -X POST
\-H "Content-Type: application/json"
\-d '{
"X-AUTHTOKEN":"...",
"chCTe":"44444444444444444444444444444444444444444444",
"CNPJ": "11111111111111",
"tpAmb": "2",
"tpDown":"XP"
}' \
https://cte.ns.eti.br/cte/get/300
Returned data
Field | Description | Notes |
---|---|---|
status | Processing status code | |
motivo | Processing status literal description | |
chCTe | CT-e access key | |
xml | Distribution XML of the authorized CT-e | Only when tpDown = "X" (or "XP") and with status = 200 |
cteProc | JSON object containing the distribution data of the authorized CT-e | Only when tpDown = "J" (or "JP") and with status = 200 |
DACTE | DACTE PDF in Base64. Only when tpDown = "P" (or "XP" or "JP") and with status = 200 | |
erro | Object containing error information when downloading the CT-e | Only when status = -6 |
cStat | Error status code | |
xMotivo | Error literal description |
Return example
Successful return
{
"status": 200,
"motivo": "Consulta realizada com sucesso",
"chCTe": "44444444444444444444444444444444444444444444",
"xml": "<cteProc>...</cteProc>",
"pdf: "JVBERi0xLjQKJeLjz..."
}
Return codes
Code | Description |
---|---|
200 | Download carried out successfully |
-2 | Mandatory fields in the request not informed |
-3 | Invalid download type. Obs.: When the is different from "X", "P", "XP", "J" or "JP" |
-4 | Invalid access key |
-5 | CT-e with informed key not found |
-6 | Error loading the CT-e |
-400 | Mandatory fields in the request not informed |