Through this method, it’s possible to generate and validate the CT-e data in XML previously processed by Sefaz and obtain the PDF file of the DACTE if no errors are found.
URL
Production: POST https://cte.ns.eti.br/util/generatepdf
Input data
Field | Description | Occurrence | Data Type |
---|---|---|---|
X-AUTH-TOKEN | User access token | 1-1 | String |
projeto | Fill with: CTe or CTeOS | 1-1 | String |
xml | XML of the CT-e previously processed by Sefaz | 1-1 | String |
printCEAN | Print EAN code. Default value: False | 0-1 | Boolean |
obsCanhoto | Prints infCpl field content, instead of "Recebemos de ..." | 0-1 | Boolean |
Request example
Generate PDF request
curl -X POST \
-H "Content-Type: application/json" \
-d '{
"X-AUTH-TOKEN": "SEU_TOKEN",
"xml": "<?xml version=\"1.0\" encoding=\"utf-8\"?><nfeProc versao=\"4.00\" xmlns=\"http://www.portalfiscal.inf.br/nfe\"><NFe>...</NFe><protNFe versao=\"4.00\">...</protNFe></nfeProc>",
"printCEAN": true,
"projeto":"CTe",
"obsCanhoto": true
}'
\https://cte.ns.eti.br/util/generatepdf
Returned data
Field | Description | Notes |
---|---|---|
status | Processing status code | |
motivo | Processing status literal description | |
PDF of the CT-e in Base64 | Only when status = 200 |
Return examples
Successful return
{
"status": 200,
"motivo": "PDF gerado com Sucesso!",
"pdf": "JVBERi0xLjQKJeLjz..."
}
Return with error
{
"status": -2,
"motivo": "CTe invalido de acordo com a validacao contra schema",
"erros": [
"O campo 'vPIS' e de preenchimento obrigatorio e nao foi preenchido. Este campo deve ser informado antes do campo 'qBCProd' com numeros contendo no maximo 15 casas inteiras e 2 decimais. (cvc-complex-type.2.4.a: Invalid content was found starting with element 'qBCProd'. One of '{\"http://www.portalfiscal.inf.br/nfe\":vPIS}' is expected.)",
"O campo 'vCOFINS' e de preenchimento obrigatorio e nao foi preenchido. Este campo deve ser informado antes do campo 'qBCProd' com numeros contendo no maximo 15 casas inteiras e 2 decimais. (cvc-complex-type.2.4.a: Invalid content was found starting with element 'qBCProd'. One of '{\"http://www.portalfiscal.inf.br/nfe\":vCOFINS}' is expected.)"
]
}
Return codes
Code | Description |
---|---|
200 | CT-e received and DACTE preview generated successfully |
-2 | Error information according to the data type. Check the "motivo" field to identify the incorrect fields. The errors will be found in the "erros" object, which is an array of strings. |
-3 | Non-existent validation schema for the CT-e version informed in the CTe/infCTe/versao |
-4 | Data sent out of the expected pattern. Verify the "motivo" field for more information |