Guides
Sandbox control
Mimicr's control API, CLI and MCP to play the payer, the SPI and the bank, wait for events, move the clock and inject failures.
BB's APIs only let you act as the customer company. To test end to end, Mimicr lets you act as the other side: the payer, the SPI and the bank itself. All of this lives in the control API, at https://api.mimicr.dev/v1/bb, and the same commands exist in the console, the CLI and the MCP server.
Authentication
Use an organization API key (mk_…), created in the organization settings, "Chaves de API" tab. Read keys only query; actions, clock, chaos, switches, webhooks and reset need a write key.
curl --url https://api.mimicr.dev/v1/bb \ --header 'Authorization: Bearer mk_...'
With the CLI (Node 18+):
npx mimicr login mk_... npx mimicr status bb
The key can also come from --key or the MIMICR_API_KEY variable. Output is JSON and the exit code is 1 on an HTTP error.
Routes
| Method and path | Purpose |
|---|---|
GET /v1/bb | Sandbox state: hosts, credentials, account, Pix keys, test keys, balance, webhook URLs, switches, chaos and clock ({"active": false} if not activated) |
POST /v1/bb/activate | Activates the organization's sandbox (201); if already active, 409 bb_already_active |
POST /v1/bb/reset | Deletes resources and webhooks; keeps credentials, keys and settings and brings the clock back to real time |
POST /v1/bb/sweep | Runs due steps and pending deliveries now |
GET /v1/bb/wait | Waits until an object or a delivery shows up (long poll) |
GET /v1/bb/clock | Sandbox time and offset |
POST /v1/bb/clock/advance | Moves the clock forward and runs the steps that came due |
GET /v1/bb/objects | Lists sandbox objects |
GET /v1/bb/objects/{kind}/{id} | One object |
GET /v1/bb/deliveries | Lists sent webhooks |
GET /v1/bb/deliveries/{id} | One webhook |
POST /v1/bb/deliveries/{id}/resend | Tries to deliver it again |
GET /v1/bb/actions | Lists the actions and their parameters |
POST /v1/bb/actions/{id} | Runs an action |
GET /v1/bb/chaos | Chaos configuration per API |
PUT /v1/bb/chaos/{key} | Changes the chaos of pix, cobrancas, lote or extratos |
PUT /v1/bb/homolog | Turns noWebhooksOnSimulatedPayments, autoRelease, boletoLock and tokenRateLimit on or off |
PUT /v1/bb/webhooks | Cobrança and Pagamentos em Lote webhook URLs |
Control API errors use {"error": {...}} with lowercase codes (for example bb_not_active, unknown_action, action_failed, wait_timeout), unlike BB's errors.
Cobrança and Lote webhook URLs
At BB these URLs are registered in the developer Portal, per convênio and per contract; there is no API. In Mimicr, use:
curl --request PUT \
--url https://api.mimicr.dev/v1/bb/webhooks \
--header 'Authorization: Bearer mk_...' \
--header 'Content-Type: application/json' \
--data '{ "cobranca": "https://your-server.example.com/bb/boletos", "lote": "https://your-server.example.com/bb/lote" }'null removes a URL. The Pix webhook is per key, through the API itself: Configure a webhook.
Objects and deliveries
Objects are the sandbox's resources:
kind | id | parent | status |
|---|---|---|---|
cob, cobv | txid | ATIVA, CONCLUIDA, ... | |
loc | location id | linked txid | |
pix | endToEndId | txid | |
devolucao | {e2eId}:{id} | endToEndId | EM_PROCESSAMENTO, DEVOLVIDO, NAO_REALIZADO |
pix_webhook | key | ATIVO, REMOVIDO | |
lotecobv | batch id | ||
boleto | nosso número (20 digits) | NORMAL, LIQUIDADO, BAIXADO, ... | |
lote | numeroRequisicao | estadoRequisicao | |
lancamento | payment id (17 digits) | numeroRequisicao | estadoPagamento (PAGO, REJEITADO, ...) |
/objects filter | Example |
|---|---|
kind | kind=cob,cobv |
status | status=CONCLUIDA |
id | id=<txid> |
parent | parent=<numeroRequisicao> |
since | since=2026-11-05T20:00:00Z (updated since) |
limit | 50 by default, up to 200 |
Deliveries are the webhooks sent to your application: kind pix (events pix and devolucao), cobranca (event baixa_operacional) and lote (event pagamento). /deliveries filters: kind, event, ref, status (pending, success, failed, skipped), since and limit. A skipped delivery means no URL was registered. Each webhook gets up to 3 attempts, 10 s apart.
Filters take several comma-separated values.
Wait
GET /v1/bb/wait answers as soon as something matches the filters, or 408 wait_timeout. Parameters: on (object or delivery), the filters above (at least one of id, parent, kind, status, event and ref) and timeout in seconds (default 25, max 50). While waiting, the simulator runs due steps.
curl --url 'https://api.mimicr.dev/v1/bb/wait?on=object&kind=lancamento&parent=1234&status=PAGO&timeout=30' \ --header 'Authorization: Bearer mk_...'
npx mimicr wait bb object kind=cob id=<txid> status=CONCLUIDA npx mimicr wait bb delivery kind=cobranca ref=<nosso-numero> --timeout 50
Actions of the other side
curl --request POST \
--url https://api.mimicr.dev/v1/bb/actions/pix.receive \
--header 'Authorization: Bearer mk_...' \
--header 'Content-Type: application/json' \
--data '{ "valor": "25.00" }'{
"ok": true,
"action": "pix.receive",
"message": "Pix E00000000202611052013ABCDEFGHIJK de R$ 25.00 recebido na chave e488511c-2025-4005-97ac-ff01ff2b5686.",
"data": { "endToEndId": "E00000000202611052013ABCDEFGHIJK" }
}With the CLI: npx mimicr action bb pix.receive valor=25.00. An action that doesn't apply to the current state answers 422 action_failed with the reason.
| Action | Parameters | Effect |
|---|---|---|
pix.pay_cob | txid (required), payer_document, payer_name | The payer pays an ATIVA cob or cobv: creates the Pix, completes the charge and sends the webhook if the key has one |
pix.receive | valor (required, e.g. 25.00), chave (default: the account's first), info_pagador, payer_document, payer_name | Pix without txid to an account key: shows up in GET /pix and the statement, no webhook |
pix.settle_devolucao | e2eId, id, result (DEVOLVIDO or NAO_REALIZADO) (required), motivo | The SPI settles an EM_PROCESSAMENTO refund now |
pix.webhook_test | chave (required) | Sends a test Pix webhook to the key's URL, like the Portal's "Disparar evento" |
boleto.pay | nossoNumero (required), canal (boleto default, or pix), banco (bb default, or outro), valor, payer_document, payer_name | The payer pays an open boleto: settles it, credits the account and sends the baixa operacional webhook |
lote.settle | id (17 digits), result (PAGO, REJEITADO, BLOQUEADO, DEVOLVIDO) (required), motivo | The bank concludes an entry now; PAGO debits and sends the webhook |
lote.webhook_test | id (required, 17 digits) | Sends the entry's webhook to the Lote URL |
Without payer_document, the payer is VICTOR LOPES DORNELES (CPF 93492239293). In boleto.pay, banco=outro records the payment with state 2 instead of 1, and a valor lower than the amount due is only accepted on a boleto that allows partial payment. In lote.settle, motivo is a code from BB's error table (e.g. 344, 269, 1010).
Homologação switches
curl --request PUT \
--url https://api.mimicr.dev/v1/bb/homolog \
--header 'Authorization: Bearer mk_...' \
--header 'Content-Type: application/json' \
--data '{ "noWebhooksOnSimulatedPayments": true }'Values are booleans and only the fields you send change. What each one does is in Homologação. With the CLI: npx mimicr put /v1/bb/homolog autoRelease=true.
Clock
curl --request POST \
--url https://api.mimicr.dev/v1/bb/clock/advance \
--header 'Authorization: Bearer mk_...' \
--header 'Content-Type: application/json' \
--data '{ "days": 3 }'The body takes seconds, minutes, hours and days, added up, up to 400 days per call. After moving, due steps run right away. With the CLI: npx mimicr clock bb +30m, +2h or +1d.
Common uses:
- Expire a cob (
calendario.expiracao) or go past a cobv's due date. - Go past a boleto's due date to see interest and fines, or past its receiving deadline for the automatic write-off.
- Reach the date of a scheduled batch.
- Get past the boletos' 30-minute lock and expire the 600 s token.
A reset brings the clock back to real time.
Chaos
curl --request PUT \
--url https://api.mimicr.dev/v1/bb/chaos/pix \
--header 'Authorization: Bearer mk_...' \
--header 'Content-Type: application/json' \
--data '{ "enabled": true, "apiErrorRate": 20, "apiErrorStatus": 503, "latencyMinMs": 500, "latencyMaxMs": 2000, "opsFailRate": 10 }'| Field | Meaning |
|---|---|
enabled | Turns the API's chaos on or off |
apiErrorRate | % of calls that answer an error |
apiErrorStatus | 500, 503 or 429 |
apiErrorWhen | before (nothing is processed) or after (processes, then answers an error) |
latencyMinMs, latencyMaxMs | Extra latency, up to 20,000 ms |
opsFailRate, opsFailCode | % of operations that fail |
webhookFailRate | % of webhooks whose first attempt fails |
webhookDuplicateRate | % of webhooks delivered twice |
| Key | Routes | Operation failure |
|---|---|---|
pix | /pix/v2 | Refund NAO_REALIZADO |
cobrancas | /cobrancas/v2 | Boleto update refused with 4923876 |
lote | /pagamentos-lote/v1 | opsFailCode REJEITADO: entry REJEITADO. DEVOLVIDO: Pix and transfers become PAGO and ~3 s later DEVOLVIDO, like the ,92 cents; the other types become REJEITADO |
extratos | /extratos/v1 and /extratos/v2 | None, and no webhooks |
Injected errors use BB-style bodies and the X-Mimicr-Chaos header. OAuth and the homologação simulators are not affected. Fields you don't send keep their current value.
MCP server
Agents can use https://api.mimicr.dev/mcp (Streamable HTTP, same mk_… key). The tools cover overview, reference, control API calls, simulated API calls, actions, waiting and moving the clock. npx mimicr mcp prints the command to connect it in Claude Code and the JSON for other clients.
End-to-end test example
npx mimicr reset bb npx mimicr put /v1/bb/webhooks lote=https://your-server.example.com/bb/lote # your application creates and releases a transfer batch and keeps the numeroRequisicao npx mimicr wait bb object kind=lancamento parent=<numeroRequisicao> status=PAGO npx mimicr wait bb delivery kind=lote event=pagamento