Guides
Cobrança webhook
Receive the baixa operacional of every paid boleto, understand the payload and retries, and fire the event in tests.
The Cobranças API notifies your application when BB receives a boleto's baixa operacional: the payment notice that arrives right away, at BB or at another bank, before clearing. There is no webhook for registration, changes or write-offs.
Register the URL
At BB, the URL is registered in the Developers Portal, per convênio; there is no API for it. In Mimicr, set it in the console (Webhooks tab) or through the sandbox control:
curl --request PUT \
--url https://api.mimicr.dev/v1/bb/webhooks \
--header 'Authorization: Bearer mk_…' \
--header 'Content-Type: application/json' \
--data '{ "cobranca": "https://your-app.example.com/webhooks/bb-cobranca" }'null removes the URL. It applies to every boleto of the convênio.
Payload
POST to your URL with Content-Type: application/json. The body is an array:
[
{
"id": "00031285570031443497",
"dataRegistro": "23.10.2026",
"dataVencimento": "12.11.2026",
"valorOriginal": 150,
"valorPagoSacado": 145,
"numeroConvenio": 3128557,
"numeroOperacao": 10898773,
"carteiraConvenio": 17,
"variacaoCarteiraConvenio": 35,
"codigoEstadoBaixaOperacional": 1,
"dataLiquidacao": "23/10/2026 01:57:25",
"instituicaoLiquidacao": 0,
"canalLiquidacao": 3,
"codigoModalidadeBoleto": 1,
"tipoPessoaPortador": 1,
"identidadePortador": "96050176876",
"nomePortador": "VALERIO DE AGUIAR ZORZATO",
"formaPagamento": 2,
"dataCredito": "24.10.2026"
}
]| Field | Meaning |
|---|---|
id | Nosso número |
valorOriginal, valorPagoSacado | In reais. The paid amount already includes interest, fine and discount (here, a R$ 5 discount) |
codigoEstadoBaixaOperacional | 1 paid at BB, 2 paid at another bank, 10 cancellation of the notice |
dataLiquidacao | dd/mm/aaaa hh:mm:ss, with slashes (the other dates use dots) |
instituicaoLiquidacao | ISPB of the receiving bank. In Mimicr, 0 when paid at BB and 60746948 for another bank |
canalLiquidacao | 1 branches, 2 ATM, 3 internet, 4 Pix, 5 correspondent… |
tipoPessoaPortador, identidadePortador, nomePortador | Who paid; may be null or empty |
formaPagamento | 1 cash, 2 account debit, 3 card, 4 cheque |
dataCredito | Credit date, dd.mm.aaaa |
Use the id to fetch the boleto with Get a boleto and confirm state 6 (LIQUIDADO) or 18 (PAGO PARCIALMENTE).
Respond and retries
Answer 200 or 201 with a short body (e.g. ok). Any other answer, or none within 10 seconds, counts as a failure: the event is resent up to 3 times, 10 seconds apart. BB does not sign the webhook or send an auth header; in production the origin is guaranteed by mTLS.
Treat repeated deliveries as idempotent by id + dataLiquidacao.
Test
Any boleto payment fires the webhook:
curl --request POST \
--url https://api.mimicr.dev/v1/bb/actions/boleto.pay \
--header 'Authorization: Bearer mk_…' \
--header 'Content-Type: application/json' \
--data '{ "nossoNumero": "00031285570031443497", "banco": "outro" }'banco: "outro" gives codigoEstadoBaixaOperacional 2; canal: "pix" pays by the boleto's QR (canalLiquidacao 4); a valor below the amount due simulates a partial payment, when the boleto allows it. The homologação simulator (/testes-portal-desenvolvedor/v1/boletos-cobranca/{linhaDigitavel}/pagar) fires it too.
At BB, homologação sends no webhooks for simulated payments; the event is only fired by hand in the portal. In Mimicr the simulators send it by default. To mirror BB, turn on noWebhooksOnSimulatedPayments with PUT https://api.mimicr.dev/v1/bb/homolog. The boleto.pay action always sends it.
Wait for the delivery and see what your application answered:
curl 'https://api.mimicr.dev/v1/bb/wait?on=delivery&kind=cobranca&ref=00031285570031443497&timeout=25' \ --header 'Authorization: Bearer mk_…'
Or with the CLI:
npx mimicr wait bb delivery kind=cobranca ref=00031285570031443497
To resend a delivery, use POST https://api.mimicr.dev/v1/bb/deliveries/{id}/resend. See Sandbox control.