Guides
Boletos and taxes in batches
Pay boletos, barcode slips, GRU, DARF and GPS through the Pagamentos em Lote API.
Boletos and slips follow the same cycle as transfers: request, validation, release and debit. What changes is the resource, the field names (BB uses different names in each one) and whether there is a webhook.
| Type | Request | List in the body | Limit | Webhook |
|---|---|---|---|---|
| Boletos | Create a boleto batch | lancamentos | 150 | Yes |
| Barcode slips | Create a barcode slip batch | lancamentos | 200 | Yes |
| GRU | Create a GRU batch | listaRequisicao | 200 | No |
| DARF | Create a DARF batch | lancamentos | 100 | No |
| GPS | Create a GPS batch | lancamentos | 100 | No |
All of them answer 201 in Mimicr, with the acceptance of each entry. Dates are ddmmaaaa integers; the competence month is mmaaaa without the month's leading zero (102022).
Boletos
Send the 44-digit barcode (the linha digitável is not accepted) and the beneficiary (codigoTipoBeneficiario and documentoBeneficiario are required; without them, error 57).
curl --request POST \
--url 'https://bb.mimicr.dev/pagamentos-lote/v1/lotes-boletos?gw-dev-app-key=<app-key>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"numeroRequisicao": 346627,
"codigoContrato": 731030,
"numeroAgenciaDebito": 1607,
"numeroContaCorrenteDebito": 99738672,
"digitoVerificadorContaCorrenteDebito": "X",
"lancamentos": [
{ "numeroCodigoBarras": "00197313700000100000000003051284123456789117", "dataPagamento": 23102026, "valorPagamento": 100, "codigoTipoBeneficiario": 2, "documentoBeneficiario": "95752207000129" },
{ "numeroCodigoBarras": "1234", "dataPagamento": 23102026, "valorPagamento": 1, "codigoTipoBeneficiario": 2, "documentoBeneficiario": "95752207000129" }
]
}'The first boleto comes back accepted, with codigoIdentificadorPagamento and nomeBeneficiario; the second comes back with indicadorAceite N. In this resource each boleto's errors are in errorCodes; in the request lookup they are in erros.
| Code | When |
|---|---|
| 38 / 39 | Barcode not numeric or all zeros |
| 127 | Barcode of the wrong length, or of a slip rather than a boleto |
| 250 | Invalid general check digit |
| 57 / 44 / 47 | Beneficiary missing or with an invalid CPF/CNPJ |
In Mimicr, paying through the batch a boleto registered in the same sandbox's API Cobranças settles that boleto and fires the baixa operacional webhook. If the boleto is no longer open, the payment ends REJEITADO with code 334 (boleto already settled). This lets you test billing and payment end to end.
Barcode slips
Utility bills and taxes with a barcode (they start with 8):
curl --request POST \
--url 'https://bb.mimicr.dev/pagamentos-lote/v1/lotes-guias-codigo-barras?gw-dev-app-key=<app-key>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"numeroRequisicao": 346628,
"numeroAgenciaDebito": 1607,
"numeroContaCorrenteDebito": 99738672,
"digitoVerificadorContaCorrenteDebito": "X",
"lancamentos": [
{ "codigoBarras": "83630000000641400052836100812355200812351310", "dataPagamento": 23102026, "valorPagamento": 64.14 }
]
}'The answer carries the state in codigoEstado (not estadoRequisicao) and the errors in errors. This modality allows paying the same slip twice: if the answer doesn't arrive, don't resend; check with Get a barcode slip request. Every payment of one barcode is in List payments of a barcode.
GRU
The path is /pagamentos-gru and the debit account uses agencia, conta and digitoConta:
curl --request POST \
--url 'https://bb.mimicr.dev/pagamentos-lote/v1/pagamentos-gru?gw-dev-app-key=<app-key>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"numeroRequisicao": 346629,
"codigoContrato": 731030,
"agencia": 1607,
"conta": 99738672,
"digitoConta": "X",
"listaRequisicao": [
{ "codigoBarras": "89970000000800000010109552316288320117811508", "dataPagamento": 23102026, "valorPagamento": 80, "numeroReferencia": "50103006", "mesAnoCompetencia": 112022, "idContribuinte": "44214073215", "valorPrincipal": 80 }
]
}'idContribuinte (error 63) and valorPrincipal (error 69) are required. In the answer, the request's valorOutroAcrescimo becomes valorOutrosAcrescimos.
DARF
The request number goes in the id field, and the lookup uses another path (/lotes-darf-preto-normal/{idRequisicao}/solicitacao):
curl --request POST \
--url 'https://bb.mimicr.dev/pagamentos-lote/v1/lotes-darf-normal-preto?gw-dev-app-key=<app-key>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"id": 346630,
"codigoContrato": 731030,
"numeroAgenciaDebito": 1607,
"numeroContaCorrenteDebito": 99738672,
"digitoVerificadorContaCorrenteDebito": "X",
"lancamentos": [
{ "dataPagamento": 23102026, "valorPagamento": 128.01, "codigoReceitaTributo": 6106, "codigoTipoContribuinte": 1, "numeroIdentificacaoContribuinte": "75224842000126", "codigoIdentificadorTributo": "18", "dataApuracao": 30112021, "numeroReferencia": 1, "valorPrincipal": 128.01, "dataVencimento": 31122021 }
]
}'codigoIdentificadorTributo is 16 (other revenues) or 18 (Simples). A DARF with several revenue codes goes as separate entries.
GPS
The GPS fields end in GuiaPrevidenciaSocial:
curl --request POST \
--url 'https://bb.mimicr.dev/pagamentos-lote/v1/lotes-gps?gw-dev-app-key=<app-key>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"numeroRequisicao": 346631,
"numeroAgenciaDebito": 1607,
"numeroContaCorrenteDebito": 99738672,
"digitoVerificadorContaCorrenteDebito": "X",
"lancamentos": [
{ "dataPagamento": 23102026, "valorPagamento": 700, "codigoReceitaTributoGuiaPrevidenciaSocial": 1007, "codigoTipoContribuinteGuiaPrevidenciaSocial": 3, "numeroIdentificacaoContribuinteGuiaPrevidenciaSocial": "12679202899", "codigoIdentificadorTributoGuiaPrevidenciaSocial": "17", "mesAnoCompetenciaGuiaPrevidenciaSocial": 102022, "valorPrevistoInstNacSeguridadeSocialGuiaPrevidenciaSocial": 700 }
]
}'The state comes in codigoEstadoRequisicao.
After the request
Release the request as in Release and queries. Each type has its own payment lookup: boleto, slip, GRU, DARF and GPS. The cents ,91, ,92 and ,93 force the same outcomes as for transfers. BB's test barcodes (boletos, slips, GRU) are accepted; see Homologação.