Through the event download service it is possible to obtain the data of an event linked to a BP-e through the NS BP-e API. The event data can be received in XML or JSON.
URL
Production: POST https://bpe.ns.eti.br/v1/bpe/get/event
Input Data
Field | Description | Occurrence | Data Type | |
---|---|---|---|---|
X-AUTH-TOKEN | software house access token | 0-1 | String | Can also be sent in the request header |
chBPe | BP-e access key | 1-1 | Int | |
tpDown | Download file type: X - XML, J - JSON | 1-1 | String | |
tpEvento | Event type: "NAOEMB"; "CANC"; "ALTPOL"; | 1-1 | String | "NAOEMB" - Non-Boarding; "CANC" - Cancellation "ALTPOL" = Seat Change |
nSeqEvento | Sequential event number | 0-1 | Int | Default value: 1 |
Request Example
Download Event Request
curl -X POST \
-H "Content-Type: application/json" \
-d '{
"X-AUTH-TOKEN": "SEU_TOKEN",
"chBPe": "43170507364617000135580000000003481000033457",
"tpDown": "x",
"tpEvento": "enc"
}'
https://bpe.ns.eti.br/v1/bpe/get/event
Returned Data
Field | Description | Occurrence | DataType | Parent | Notes |
---|---|---|---|---|---|
status | Processing status code | 1-1 | Int | ||
motivo | Literal description of processing status | 1-1 | String | ||
retEvento | Object containing the cancellation processing data at Sefaz | 0-1 | Object | Only with status = 200 | |
cStat | Event status code at Sefaz | 1-1 | Int | ||
xMotivo | Literal description of the situation of the event at Sefaz | 1-1 | String | ||
chBPe | BP-e access key | 1-1 | Int | ||
dhRegEvento | Date and time of the event registration at Sefaz | 1-1 | String ( date and time format ) | Sefaz Standard: YYYY-MM-DDTHH: MM:SS+UTC. Ex : 2016-06-13T15: 04: 10-03:00 |
|
nProt | Number of the protocol for authorization of the event by Sefaz | 1-1 | Int | ||
xml | Event XML | 0-1 | String | Only when tpDown = X, and in status = 200 | |
json | Event JSON | 0-1 | Object | Only when tpDown = J, and in status = 200 | |
erro | Object containing error information if the event cannot be downloaded successfully | 0-1 | Object | Only in status different than 200 | |
erro.cStat | Error status code | 1-1 | Int | ||
erro.xMotivo | Literal description of the error | 1-1 | String |
Response examples
Successful response
{
"status": 200,
"motivo": "Evento localizado com sucesso",
"retEvento": {
"cStat": "135",
"xMotivo": "Evento registrado e vinculado a BP-e",
"chBPe": "43180207364617000135630000000000311000000089",
"dhRegEvento": "2018-02-21T16:15:16-03:00",
"nProt": "143180000002639"
},
"xml": "<?xml version=\"1.0\" encoding=\"utf-8\"?><procEventoBPe versao=\"1.00\" xmlns=\"http://www.portalfiscal.inf.br/bpe\">...</procEventoBPe>"
}
Returned Codes
Code | Description |
---|---|
200 | Event Download done successfully |
-2 | Invalid access key |
-3 | Invalid event type |
-4 | Invalid download type |
-5 | The event could not be loaded. Check the error object for more information |