1. Inicio
  2. Documentos
  3. NS BPe (English)
  4. BPe Events
  5. Cancellation

Cancellation

BPe Cancellation

Through the BP-e cancellation service, it is possible to cancel a previously authorized ticket through the API.

Note: The cancellation of BP-e has rules and deadlines defined by the SEFAZ that must be considered and respected. For more information click here and check the most up-to-date version of the Sefaz Taxpayer Guidance Manual.

URL

Production: POST https://bpe.ns.eti.br/v1/bpe/cancel

Input data
FieldDescriptionOccurrenceData TypeNote
X-AUTH-TOKENSoftware House Access Token0-1StringCan be sent in the request header
chBPeBP-e access key1-1Int
tpAmbType of BP-e authorization environment: 1 - Production, 2 - Homologation1-1Int
dhEventoDate and time the cancellation occurred1-1String ( Data and Time fomat )Sefaz Standard YYYY-MM-DDTHH:MM:SS + UTC
Ex .: 2016-06-13T15: 04: 10-02:00
nProtBP-e authorization protocol number1-1Int
xJustLiteral description of the reason for canceling the BP-e1-1StringMinimum 15 characters (there are no API restrictions on special characters)
Request Example

BPe Cancellation Request Example

curl -X POST \
-H "Content-Type: application/json" \
-d '{
      "chBPe": "43180207364617000135630000000000311000000089", 
      "tpAmb": 2, 
      "dhEvento": "2017-05-15T12:00:00-03:00", 
      "nProt": "443170000037618", 
      "xJust": "BPe cancelado para teste de integracao"
     }'\
https://bpe.ns.eti.br/v1/bpe/cancel
Returned Data
FieldDescriptionData TypeParentNote
statusProcessing status codeInt
motivoLiteral description of processing statusString
retEventoObject containing the cancellation processing data at SefazObjectOnly when statys = 200
cStatProcessing status codeIntretEvento
xMotivoLiteral description of the processing situation at SefazStringretEvento
chBPeBP-e access keyIntretEventoOnly with cStat = 135
dhRegEventoDate and time of the event registration at SefazString ( Date and time format )retEventoSefaz Standard YYYY-MM-DDTHH: MM: SS + UTC.
Ex .: 2016-06-13T15: 04: 10-03: 00 Only in cStat = 135
nProtEvent authorization protocol numberIntretEventoOnly with cStat = 135
xmlCancel event distribution XMLStringretEventoOnly with cStat = 135
erro
Object containing the error information in case the cancellation cannot be carried out successfully
ObjectOnly in status different than 200
cStatError status codeIntErro
xMotivoLiteral description of the errorStringErro
Responses Examples

Successful Response

{
    "status": 200,
    "motivo": "Processamento de evento realizado com sucesso",
    "retEvento": {
        "cStat": 135,
        "xMotivo": "Evento registrado e vinculado a BP-e",
        "chBPe": "43180207364617000135630000000000301000000081",
        "dhRegEvento": "2018-02-21T14:58:46-03:00",
        "nProt": "143180000002623",
        "xml": "<?xml version=\"1.0\" encoding=\"utf-8\"?><procEventoBPe versao=\"1.00\" xmlns=\"http://www.portalfiscal.inf.br/bpe\">...</procEventoBPe>"
    }
}
Returned Code
CodeDescription
200BP-e successfully cancelled
-2Invalid BPe access key
-3It was not possible to cancel the BP-e. Check the error object for more information
Bpe Cancellation Download

You can download the complete cancellation distribution information in XML or JSON. To do this, check the Download Events method in the NS BP-e API.

Como podemos ajudar?