The BP-e download method is responsible for returning JSON, XML and DABPE ( Electronic Ticket Ticket Auxiliary Document ) from providing the access key of a BP-e authorized by NS BP-e API.
URL
Production: POST https://bpe.ns.eti.br/v1/bpe/get
Input Data
| Field | Occurrence | Description |
|---|---|---|
| X-AUTH-TOKEN | 1-1 | Software House access token |
| chBPe | 1-1 | BP-e access key |
| tpDown | 1-1 | Download files type: X - XML, J - JSON, P - PDF, XP - XML and PDF, JP - JSON and PDF |
| tpAmb | 1-1 | Type of Environment: 1 - Production, 2 - Homologation ( test enviroment |
Request Examples
Download Request
curl -X POST \
-H "Content-Type: application/json" \
-d '{"
X-AUTH-TOKEN":"SEU_TOKEN",
"chBPe":"44444444444444444444444444444444444444444444",
"tpDown":"XP",
"tpAmb":"2"
}' \
https://bpe.ns.eti.br/v1/bpe/get
Returned Data
| Field | Description | Occurrence | Data Type | Parent | Notes |
|---|---|---|---|---|---|
| status | Processing status code | 1-1 | Int | ||
| motivo | Literal description of processing status | 1-1 | String | ||
| chBPe | BP-e access key | 0-1 | Int | ||
| xml | Authorized BP-e distribution XML | 0-1 | String | Only when Download type = X or XP, Only with status = 200 |
|
| nfeProc | JSON object with authorized BP-e distribution data | 0-1 | String | Only when Download type = J or JP. Only with status = 200 | |
| BPe PDF | 0-1 | String | Base64 of BPE PDF. Only when download type = P, JP or XP. Only with status = 200 | ||
| erro | Objeto contendo informações de erro ao carregar o CT-e | 0-1 | Object | only with status different than 200 | |
| cStat | Error status code | 1-1 | String | erro | |
| xMotivo | Literal description of the error | 1-1 | String | erro |
Response Examples
Successful Response
{
"status": 200,
"motivo": "Consulta realizada com sucesso",
,
"chBPe": "43180107364617000135630000000000101000000085",
"xml": "<?xml version=\"1.0\" encoding=\"utf-8\"?><bpeProc versao=\"1.00\" xmlns=\"http://www.portalfiscal.inf.br/bpe\"><BPe>...</bpeProc>",
"pdf: "JVBERi0xLjQKJeLjz..."}
Returned Codes
| Code | Description |
|---|---|
| 200 | Download successfully done |
| -2 | Invalid download type Note: When the type is different X, P, XP or PX (case-insensitive). |
| -3 | Invalid access key |
| -4 | BP-e not found with the given access key |