A API V3 JÁ ESTÁ DISPONÍVEL
As integrações API v2 que já estão configuradas, seguirão funcionando temporariamente. |
Registro de cancelamento
Registrando o cancelamento de um CT-e a partir do XML de evento de cancelamento.
curl |
curl -X POST "https://bling.com.br/b/Api/v2/cte/{id}" |
PHP |
$id = {id} |
Parâmetro | Descrição | Tipo |
apikey |
sua_api_key |
string |
xml |
XML da nota compactado no padrão GZip e após convertido para Base64 |
string |
Observações
O parâmetro xml
deve ser compactado no padrão GZip e o resultado deve ser convertido para Base64, semelhante ao processo de compactação da SEFAZ.
Exemplo de XML
<?xml version="1.0" encoding="UTF-8"?>
<pedido>
<xml>H4sIAAAAAAAAA51ZW5OiyrL+K8bs89Znmpt4WcEYh0uBIBe5qfiGgIgK2Iqg/vqTBfb0dK+JvfbsjhnJysrKyvoyKysLuKhK5ucy6tXJ+RKWP74xryT5rXfLj8Xlx7ddVZ3+IoimaV5P5bkKj9vsEoXH16zYvm7OBIz9NuFEL/kjeWiIVdJT4x/fYCjDUGOSpkmqPxxQQ5KkKIph8RP+0QzF0Cw1Ho+Gg9FgCHZ9shJUxcmEi3x5wjAcgZ9cJHqTd3lgQYsTZWs+GTAsiLQkV4SVdZrMHeR6rz0XOYvXnufwpju3HA/1+B7weQHpSFQNZHpWT7QM5Igqr3NEN5TLy3jCgn785C7JOUsmFEd0BFfApE/TYQC2IN6hPJvAGsffSfo7SXnU4C928BdJQhN+OfIT4KqTmp+wpo6ANrAvHaOluEhaTEAeP6CXzzddJyagDXDi3o7gTuBWrBY47yQH+GFvTzB+HPHe4iLjWqCiBhjJPosX9s7gbk/CUa2ehHoabyLVsTjinc/5ctutcURHYWzC44SkWnSAArvc5Fx3hrVUO51aZJ+nw4x2Okz8brpWwJfb7na6loGHylk+YSB4aHLQ6cKMVhcmfAE5Om9KKt/paTt9GT8MBetpGeekys4htvJJcTcpqZyONnkLAqXHz3VVxFo+eiCaYxV5ZR5iT3w0uAp+me7RLr1lEk8u0QVumZ8AH2tzEcui6t3EMD9BbO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18jYJr7xCuTv3xt79/sICp+NMxiyaOC5etEUVSA7ho0X26/TLRdcHdGpv3J1cyfLdulxTvnCTaVOWnLy/Dv0jqL6b/8eXlKcMV2PjJF6s5omNzcZZCxfwPd52nEBe5VVjht0BgSktyN6Ossrqc8NcKblsP/N6+7F0vZQ8I0fue4Fd0nUR7Te/mJJ4+wS/gu690k/8H+sjbVK8bAAA=</xml>
</pedido>
Retorno
Em caso de sucesso, retornará o número e a série do CT-e no mesmo modelo do exemplo a seguir. Caso contrário, retornará um erro.
A resposta será no formato especificado na URL (XML ou JSON).
Exemplo de retorno
{
"retorno": {
"ctes": [
{
"cte": {
"id": "123456",
"serie": "0",
"numero": "0001",
"natureza": "NATUREZA",
"cfop": "6353",
"dataEmissao": "2019-07-11 16:26:26",
"situacao": "emitido",
"tipoCte": "CT-e normal",
"tipoServico": "Normal",
"modal": "Rodoviário",
"municipioInicio": "Bento Gonçalves",
"UFInicio": "RS",
"municipioFim": "Hortolândia",
"UFFim": "SP",
"cst": "40",
"baseCalculo": 0.00,
"aliquotaIcms": 0.00,
"valorIcms": 0.00,
"valorPis": "0.00",
"valorCofins": "0.00",
"valorIr": "0.00",
"valorInss": "0.00",
"valorCsll": "0.00",
"valorTotal": "738.00",
"rntrc": "00000000",
"emissor": {
"nome": "EMISSOR",
"cnpj": "00000000000000",
"ie": "000000000000",
"endereco": "ENDERECO",
"numero": "1234",
"complemento": "",
"bairro": "BAIRRO",
"cep": "00000000",
"municipio": "Bento Gonçalves",
"uf": "RS",
"fone": "00000000000"
},
"remetente": {
"nome": "REMETENTE",
"cnpj": "00000000000000",
"ie": "0000000000000",
"endereco": "ENDERECO",
"numero": "S/N",
"complemento": "",
"bairro": "BAIRRO",
"cep": "00000000",
"municipio": "Poços de Caldas",
"uf": "MG",
"fone": "",
"email": “”
},
"destinatario": {
"nome": "DESTINATARIO",
"cnpj": "00000000000000",
"ie": "ISENTO",
"endereco": "ENDERECO",
"numero": "SN",
"complemento": "",
"bairro": "BAIRRO",
"cep": "00000000",
"municipio": "Hortolândia",
"uf": "SP",
"fone": "",
"email": ""
},
"autorizacao": {
"chave": "00000000000000000000000000000000000000000000",
"dataRecebimento": "2019-03-11 16:31:35",
"numeroProtocolo": "000000000000000"
},
"nota": {
"chave": "00000000000000000000000000000000000000000000"
}
}
}
]
}
}