Guides
Transfers and Pix in batches
Send account credits, TEDs, judicial deposits and Pix in one request, release the batch and follow each payment until PAGO.
The Pagamentos em Lote API groups payments into requests (requisições) that you number. Each request holds up to 320 entries of a single type. The flow is always the same:
- You send the batch (
POST). BB answers right away with the acceptance of each entry. - The bank validates the batch and leaves the request waiting for your release.
- You release it (Release payments) and the bank debits the account on each entry's date.
- Each payment ends as
PAGO,REJEITADO,BLOQUEADO,DEVOLVIDOorCANCELADO, and paid ones trigger a webhook.
This guide covers transfers and Pix. Boletos and taxes are in Boletos and taxes in batches; release and queries in Release and queries.
Before you start
- A token with the scopes
pagamentos-lote.transferencias-requisicao,pagamentos-lote.transferencias-pix-requisicao,pagamentos-lote.lotes-requisicaoandpagamentos-lote.lotes-info(see Authentication). Without the scope, the answer is a plain-text403Authentication failed. - The debit account: your sandbox's, or BB's homologação account (agência
1607, conta99738672-X, contract731030), which Mimicr accepts as yours. - A free request number. It goes from 1 to 9999999 and can be used once per contract. Ask for the next free ones with Next request numbers.
Dates are ddmmaaaa integers without the day's leading zero (9112026 = 09/11/2026), and the date can't be before today (error 53). Payment ids have 17 digits: read them as int64 or string, never as a double.
Transfer batch
BB account credit (numeroCOMPE 1), TED to another bank (another COMPE, with codigoFinalidadeTED), savings and judicial deposits all use the same resource:
curl --request POST \
--url 'https://bb.mimicr.dev/pagamentos-lote/v1/lotes-transferencias?gw-dev-app-key=<app-key>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"numeroRequisicao": 346625,
"numeroContratoPagamento": 731030,
"agenciaDebito": 1607,
"contaCorrenteDebito": 99738672,
"digitoVerificadorContaCorrente": "X",
"tipoPagamento": 128,
"listaTransferencias": [
{ "numeroCOMPE": 1, "agenciaCredito": 18, "contaCorrenteCredito": 3066, "digitoVerificadorContaCorrente": "X", "cpfBeneficiario": 99391916180, "dataTransferencia": 23102026, "valorTransferencia": 400.75, "descricaoTransferencia": "Fornecedor" },
{ "numeroCOMPE": 237, "agenciaCredito": 1234, "contaCorrenteCredito": 5678, "digitoVerificadorContaCorrente": "1", "cnpjBeneficiario": "84526081000158", "dataTransferencia": 23102026, "valorTransferencia": 10, "codigoFinalidadeTED": 5 },
{ "numeroCOMPE": 1, "cpfBeneficiario": 12345678900, "dataTransferencia": 23102026, "valorTransferencia": 0 }
]
}'The answer is 201. The third entry was refused (indicadorAceite N) with codes from BB's error table; the other two go ahead:
{
"estadoRequisicao": 2,
"quantidadeTransferencias": 3,
"valorTransferencias": 410.75,
"quantidadeTransferenciasValidas": 2,
"valorTransferenciasValidas": 410.75,
"transferencias": [
{ "identificadorTransferencia": 90346625218725001, "tipoCredito": 1, "indicadorAceite": "S", "erros": [] },
{ "identificadorTransferencia": 90346625218725002, "tipoCredito": 3, "codigoFInalidadeTED": 5, "indicadorAceite": "S", "erros": [] },
{ "identificadorTransferencia": 90346625218725003, "indicadorAceite": "N", "erros": [9, 1, 23, 3, 18] }
]
}tipoPagamento | Use |
|---|---|
126 | Supplier payments (Pagamento a Fornecedores) |
127 | Payroll (only to a BB account of an individual; error 82) |
128 | Miscellaneous payments (required for savings accounts) |
Reference: Create a transfer batch. The response field codigoFInalidadeTED has a capital I, as in BB's swagger.
Pix batch
Pix identifies the receiver by formaIdentificacao: 1 phone, 2 e-mail, 3 CPF/CNPJ, 4 random key or 5 bank details. Here the contract is called numeroContrato, and only types 126 and 128 are allowed.
curl --request POST \
--url 'https://bb.mimicr.dev/pagamentos-lote/v1/lotes-transferencias-pix?gw-dev-app-key=<app-key>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"numeroRequisicao": 346626,
"numeroContrato": 731030,
"agenciaDebito": 1607,
"contaCorrenteDebito": 99738672,
"digitoVerificadorContaCorrente": "X",
"tipoPagamento": 126,
"listaTransferencias": [
{ "data": 23102026, "valor": 123.45, "formaIdentificacao": 2, "email": "hmtestes2@bb.com.br" },
{ "data": 23102026, "valor": 20.92, "formaIdentificacao": 4, "identificacaoAleatoria": "9e881f18-cc66-4fc7-8f2c-a795dbb2bfc1" },
{ "data": 23102026, "valor": 650, "formaIdentificacao": 5, "numeroCOMPE": "1", "tipoConta": 1, "agencia": 4267, "conta": 1704959, "digitoVerificadorConta": "8", "cpf": 28779295827 },
{ "data": 23102026, "valor": 5, "formaIdentificacao": 2, "email": "invalido" }
]
}'Each item comes back with identificadorPagamento, indicadorMovimentoAceito and erros. The invalido e-mail comes back with N and error 100 (E-mail inválido). Reference: Create a Pix batch.
A Pix to one of the sandbox's own keys also arrives in the API Pix as a received Pix, and shows up in the statement as a credit. This is Mimicr's own behaviour; it lets you test both sides with one account.
Release and follow
About 2 seconds after the request, Mimicr validates the batch: the request moves to state 4 (waiting for release) and the accepted entries to PENDENTE. Release it:
curl --request POST \
--url 'https://bb.mimicr.dev/pagamentos-lote/v1/liberar-pagamentos?gw-dev-app-key=<app-key>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "numeroRequisicao": 346625, "indicadorFloat": "N" }'{ "mensagemRetorno": "Liberação efetuada com sucesso" }About 3 seconds later each entry is debited. Check the batch with Get a request or one payment with Get a transfer and Get a Pix payment. A paid Pix has a receipt in Get a Pix receipt. For a Pix to another institution's key, Mimicr doesn't know the DICT holder and leaves out the receiver's CPF:/CNPJ: line.
Test outcomes
BB documents no magic values in homologação. In Mimicr, the cents of the entry decide the outcome after release:
| Cents | Outcome |
|---|---|
,91 | REJEITADO (transfer 209, Pix 344 in listaDevolucao) |
,92 | PAGO and, 3 s later, DEVOLVIDO (Pix: reason 1010) |
,93 | BLOQUEADO for lack of balance (reason 269) |
| others | PAGO if there is balance; otherwise BLOQUEADO |
The sandbox starts with R$ 50,000.00, and received Pix and boletos add to it. To force an outcome without relying on the cents, use the lote.settle action (see Release and queries). Returned payments show up in List returned payments.