Guides
Mimicr

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.

bash
curl --url https://api.mimicr.dev/v1/bb \
  --header 'Authorization: Bearer mk_...'

With the CLI (Node 18+):

bash
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 pathPurpose
GET /v1/bbSandbox state: hosts, credentials, account, Pix keys, test keys, balance, webhook URLs, switches, chaos and clock ({"active": false} if not activated)
POST /v1/bb/activateActivates the organization's sandbox (201); if already active, 409 bb_already_active
POST /v1/bb/resetDeletes resources and webhooks; keeps credentials, keys and settings and brings the clock back to real time
POST /v1/bb/sweepRuns due steps and pending deliveries now
GET /v1/bb/waitWaits until an object or a delivery shows up (long poll)
GET /v1/bb/clockSandbox time and offset
POST /v1/bb/clock/advanceMoves the clock forward and runs the steps that came due
GET /v1/bb/objectsLists sandbox objects
GET /v1/bb/objects/{kind}/{id}One object
GET /v1/bb/deliveriesLists sent webhooks
GET /v1/bb/deliveries/{id}One webhook
POST /v1/bb/deliveries/{id}/resendTries to deliver it again
GET /v1/bb/actionsLists the actions and their parameters
POST /v1/bb/actions/{id}Runs an action
GET /v1/bb/chaosChaos configuration per API
PUT /v1/bb/chaos/{key}Changes the chaos of pix, cobrancas, lote or extratos
PUT /v1/bb/homologTurns noWebhooksOnSimulatedPayments, autoRelease, boletoLock and tokenRateLimit on or off
PUT /v1/bb/webhooksCobranç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:

bash
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:

kindidparentstatus
cob, cobvtxidATIVA, CONCLUIDA, ...
loclocation idlinked txid
pixendToEndIdtxid
devolucao{e2eId}:{id}endToEndIdEM_PROCESSAMENTO, DEVOLVIDO, NAO_REALIZADO
pix_webhookkeyATIVO, REMOVIDO
lotecobvbatch id
boletonosso número (20 digits)NORMAL, LIQUIDADO, BAIXADO, ...
lotenumeroRequisicaoestadoRequisicao
lancamentopayment id (17 digits)numeroRequisicaoestadoPagamento (PAGO, REJEITADO, ...)
/objects filterExample
kindkind=cob,cobv
statusstatus=CONCLUIDA
idid=<txid>
parentparent=<numeroRequisicao>
sincesince=2026-11-05T20:00:00Z (updated since)
limit50 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.

bash
curl --url 'https://api.mimicr.dev/v1/bb/wait?on=object&kind=lancamento&parent=1234&status=PAGO&timeout=30' \
  --header 'Authorization: Bearer mk_...'
bash
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

bash
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" }'
json
{
  "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.

ActionParametersEffect
pix.pay_cobtxid (required), payer_document, payer_nameThe payer pays an ATIVA cob or cobv: creates the Pix, completes the charge and sends the webhook if the key has one
pix.receivevalor (required, e.g. 25.00), chave (default: the account's first), info_pagador, payer_document, payer_namePix without txid to an account key: shows up in GET /pix and the statement, no webhook
pix.settle_devolucaoe2eId, id, result (DEVOLVIDO or NAO_REALIZADO) (required), motivoThe SPI settles an EM_PROCESSAMENTO refund now
pix.webhook_testchave (required)Sends a test Pix webhook to the key's URL, like the Portal's "Disparar evento"
boleto.paynossoNumero (required), canal (boleto default, or pix), banco (bb default, or outro), valor, payer_document, payer_nameThe payer pays an open boleto: settles it, credits the account and sends the baixa operacional webhook
lote.settleid (17 digits), result (PAGO, REJEITADO, BLOQUEADO, DEVOLVIDO) (required), motivoThe bank concludes an entry now; PAGO debits and sends the webhook
lote.webhook_testid (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

bash
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

bash
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

bash
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 }'
FieldMeaning
enabledTurns the API's chaos on or off
apiErrorRate% of calls that answer an error
apiErrorStatus500, 503 or 429
apiErrorWhenbefore (nothing is processed) or after (processes, then answers an error)
latencyMinMs, latencyMaxMsExtra latency, up to 20,000 ms
opsFailRate, opsFailCode% of operations that fail
webhookFailRate% of webhooks whose first attempt fails
webhookDuplicateRate% of webhooks delivered twice
KeyRoutesOperation failure
pix/pix/v2Refund NAO_REALIZADO
cobrancas/cobrancas/v2Boleto update refused with 4923876
lote/pagamentos-lote/v1opsFailCode 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/v2None, 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

bash
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