The BP-e issuing service is responsible for carrying out the validation of the BP-e data sent according to the types of data defined by Sefaz XML schemas and sending the document for processing on the WebService of the Portal da Secretaria da Fazenda.
The response of this service contains the receipt status of the BP-e by the API and the code nsNRec for checking on the processing status.
URL
Production: POST https://bpe.ns.eti.br/v1/bpe/issue
Input data
The data for the issuing method can be sent in JSON or XML.
Sending data in JSON format
To send data in JSON, the request’s Content-Type must be defined as application/json.
Code | Description |
---|---|
-400 | Mandatory fields not filled |
-500 or -999 | Internal API Error |
200 | Success |
-401 | User without permissions to manage taxpayer documents |
By clicking on the file below it is possible to download a complete example of NF-e in a JSON format:
Sending data in XML format
To send data in XML, the request’s Content-Type must be defined as application/xml and the X-AUTH-TOKEN must be sent in the HTTP header.
When sending in XML format, the request body must contain the XML content with the BP-e information. This content must be generated from the layout of the Sefaz Contributors’ Guidance Manual.
Clicking on the file below it is possible to download a complete example of BP-e in XML format:
Request example
BP-e issue request in JSON
curl -X POST \
-H "Content-Type: application/json" \
-d '{"
X-AUTH-TOKEN":"...",
"BPe":{...}
}'
https://bpe.ns.eti.br/v1/bpe/issue
BP-e issue request in XML
curl -X POST \
-H "X-AUTH-TOKEN: SEU_TOKEN" \
-H "Content-Type: application/xml" \
-d '<BPe xmlns="http://www.portalfiscal.inf.br/bpe"><infBPe versao="1.00"><ide><cUF>43</cUF>....</BPe>'
https://bpe.ns.eti.br/v1/bpe/issue
Data returned
Field | Description | Data Type | Occurrence | Notes |
---|---|---|---|---|
Status | Processing status code | String | 1-1 | |
Motivo | Literal description of processing status | String | 1-1 | |
nsNRec | BP-e internal API process code | Int | 0-1 | Only when status = 200 |
Return examples
Successful response
{
"status": 200,
"motivo": "BP-e enviado para Sefaz",
"nsNRec": "1234"
}
Response with an error
{
"status": -2,
"motivo": "BPe invalido de acordo com a validacao contra schema",
"erros": [
"O campo 'CEP' foi preenchido incorretamente com o valor '9003000'. Este campo deve ser preenchido com numeros e conter exatamente 8 caracteres. (cvc-pattern-valid: Value '9003000' is not facet-valid with respect to pattern '[0-9]{8}' for type '#AnonType_CEPTEndeEmi'.)"
]
}
Return Codes
Code | Description |
---|---|
200 | BPe successfully received and sent to Sefaz |
-2 | Information error according to data type. Check the reason field to identify the incorrect fields |
-3 | No validation scheme for the BP-e version reported in BPe / infBPe / version |
-4 | Data sent outside the expected standard. Check the "motivo" field for more information |
-5 | Error sending BP-e to Sefaz. Check the error object for more information |
-6 | BP-e previously authorized. Check the processing status of the returned nsNRec. |
-7 | Invalid Content-Type. The content-types accepted by this method are application / json or application / xml. |