Through this methid it’s possible to generate and validate the NF-e data in XML previously processed by Sefaz and obtain the DANFE PDF file if no error are found.
URL
Production: POST https://nfe.ns.eti.br/util/generatepdf
Input data
Field | Occurrence | Data Type | Description |
---|---|---|---|
X-AUTH-TOKEN | 1-1 | String | User access token |
xml | 1-1 | String | NF-e XML previously processed by Sefaz |
printCEAN | 0-1 | Boolean | Print EAN code. Default value: False |
obsCanhoto | 0-1 | Boolean | Prints infCpl field content, instead of "Recebemos de ..." |
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,
"obsCanhoto": true
}'\https: //nfe.ns.eti.br/util/generatepdf
Returned data
Field | Description | Notes |
---|---|---|
status | Status processing code | |
motivo | Processing status literal description | |
Base64 PDF from the NF-e | Only when status = 200 |
Return examples
Successful return
{
"status": 200,
"motivo": "PDF gerado com Sucesso!",
"pdf": "JVBERi0xLjQKJeLjz..."
}
Return with error
{
"status": -2,
"motivo": "NFe 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 | NF-e received and DANFE preview generated successfully |
-2 | Information error according to data type. Check the "movito" field to identify the incorrect fields. Errors will be found in the "erro" object, which is an array of strings |
-3 | Non-existent validation schema for the NF-e version informed in NFe/infNFe/version |
-4 | Data sent out of the expected pattern. Check the "motivo" for more information |