The NF-e download method is responsible for return the JSON, XML or the DANFE (Auxiliary Document of Electronic Invoice) from provinding the access key of an authorized NF-e.
URL
Production: POST https://nfe.ns.eti.br/nfe/get
Input data
Field | Occurrence | Data Type | Description |
---|---|---|---|
X-AUTH-TOKEN | 1-1 | String | User access token |
chNFe | 1-1 | Int | NF-e access key |
printCEAN | 0-1 | Boolean | Print EAN code Standard value: false |
tpAmb | 0-1 | Int | NF-e authorization environment type: 1 - Production 2 - Homologation Standard value: 2 |
tpDown | 1-1 | String | Download type: X - XML J - JSON P - PDF XP - XML and PDF JP - JSON and PDF |
obsCanhoto | 0-1 | Bolleant | Prints infCpl field contents in the stub, instead of "Recebemos de ...." |
Request example
NF-e download request |
curl -X POST \
-H "Content-Type: application/json" \
-d '{"X-AUTH-TOKEN":"YOUR_TOKEN","chNFe":"44444444444444444444444444444444444444444444", "tpDown":"XP"}' \
https://nfe.ns.eti.br/nfe/get
Returned data
Field | Description | Notes |
---|---|---|
status | Processing status code | |
motivo | Processing status literal description | |
chNFe | NF-e access key | |
xml | Authorized NF-e distribution XML | Only when tpDown = X or XP. Only when status = 200 |
nfeProc | JSON object with the authorized NF-e distribution data | Only when tpDown = J or JP. Only when status = 200 |
DANFE PDF | DANFE PDF Base64. Only when tpDown = `, JP or XP. Only when status = 200 | |
erro | Object containing error information when loading an NF-e | Only whe status is different from 200 |
erro.cStat | Error status code | |
erro.xMotivo | Error literal description |
Return examples
Successful return
{
"status": 200,
"motivo": "Consulta realizada com sucesso",
"chNFe": "44444444444444444444444444444444444444444444",
"xml": "<?xml version=\"1.0\" encoding=\"utf-8\"?><nfeProc versao=\"3.10\" xmlns=\"http://www.portalfiscal.inf.br/nfe\"><NFe>...</NFe><protNFe versao=\"3.10\">...</protNFe></nfeProc>",
"pdf": "JVBERi0xLjQKJeLjz..."
}
Return codes
Code | Description |
---|---|
200 | Download successfully done |
-2 | Invalid download type Obs.: When the type is different than X, P, J, XP ou JP (case-insensitive) |
-3 | Invalid access key |
-4 | NF-e not found with the informed access key |
Print xTexto on stub
The NF-e stub can contain the message “Recebemos de …” or the infCpl when requested in the download method.
In addition to these contents, it’s possible to also print the issuer’s desired information on the stub.
For this, it’s necessary to inform, during the issuance, the group “obsCont(Z04)” containing an “xCampo” with value “xObsCanhoto”, then the content of the respective “xTexto” will be printed on the stub.