Guides
Sandbox control
Mimicr's control API, CLI and MCP to play the payer, the bank and the end client, wait for webhooks, move the clock and inject failures across every Efí API.
Efí's APIs only let you act as the integrator. To test end to end, Mimicr also lets you act as the other side: the payer who pays the cob or the boleto, the bank that authorizes Open Finance, the SPI that settles a send, the end client who approves the account. All of this lives in the control API, at https://api.mimicr.dev/v1/efi, 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, homologation and reset require a write key.
curl --url https://api.mimicr.dev/v1/efi \ --header 'Authorization: Bearer mk_...'
The response has the six APIs' hosts, the credentials (client_id, client_secret), the account, the Pix keys, the balance in cents (total, blocked_med, available), the homologation switches, chaos and the clock. With the sandbox inactive, {"active": false}.
With the CLI (Node 18+):
npx mimicr login mk_... npx mimicr status efi
The key can also come from --key or the MIMICR_API_KEY variable. Output is JSON and the exit code is 1 on HTTP errors.
Routes
| Method and path | What for |
|---|---|
GET /v1/efi | Sandbox state: hosts, credentials, account, keys, balance, homologation, chaos and clock |
POST /v1/efi/activate | Activates the organization's sandbox (201); if already active, 409 efi_already_active |
POST /v1/efi/reset | Deletes test data; keeps credentials, keys and settings and resets the clock to real time |
POST /v1/efi/sweep | Runs what is already due (automatic payments, results, retries) now, without waiting for the 1-minute cron |
GET /v1/efi/wait | Waits until an object or a delivery shows up (long poll) |
GET /v1/efi/clock | Sandbox time (now) and offset (offset_ms) |
POST /v1/efi/clock/advance | Advances the clock and runs what came due |
GET /v1/efi/objects | Lists the sandbox resources |
GET /v1/efi/objects/{kind}/{ref} | One resource |
GET /v1/efi/deliveries | Lists webhooks and notifications sent to your application |
GET /v1/efi/deliveries/{id} | One delivery, with body, attempts and your server's response |
POST /v1/efi/deliveries/{id}/resend | Tries the delivery again now |
GET /v1/efi/actions | Lists the actions with their parameters |
POST /v1/efi/actions/{id} | Runs an action |
GET /v1/efi/chaos | Chaos by area |
PUT /v1/efi/chaos/{key} | Changes one area's chaos |
PUT /v1/efi/homolog | Turns the automatic homologation rules on or off |
Control API errors use {"error": {...}} with lowercase codes: 400 invalid_parameter, 403 read_only_key, 404 efi_not_active, not_found or unknown_action, 408 wait_timeout, 409 efi_already_active, 422 action_failed, and 422 efi_error when the action hits an Efí rule (Efí's error body comes in efi).
Objects and deliveries
Objects are the sandbox resources. ref is the same id the Efí API exposes.
kind | ref | API |
|---|---|---|
cob, cobv | txid | Pix |
pix, devolucao | endToEndId, rtrId | Pix |
envio | idEnvio | Pix |
rec, solicrec, cobr | idRec, idSolicRec, txid | Pix Automático |
infracao | infraction id (MED) | Pix |
charge, carnet, subscription, plan | charge_id, carnet_id, subscription_id, plan_id | Billing |
card_token | payment_token | Billing |
of_pagamento, of_vinculo, of_adesao, of_auto_pix, of_devolucao | urn:efi:…, endToEndId or identificadorDevolucao | Open Finance |
pc_pagamento | idPagamento | Bill payment |
cnab_arquivo, cnab_agendamento | file name, periodicity | Statements |
ac_conta, ac_webhook | identifier | Account opening |
| Filter | /objects | /deliveries |
|---|---|---|
kind | kind=charge,carnet | kind=of_pagamento |
status | status=waiting,unpaid | status=pending,failed (pending, success, failed, skipped) |
ref | ref=1000001 | ref=urn:efi:… |
parent | parent=<carnet_id> | |
api | api=pix,cobrancas,openfinance,pagarcontas,abrircontas | |
event | event=conta_aberta | |
since | updated since (ISO 8601) | created since (ISO 8601) |
limit | 50 by default, up to 200 | 50 by default, up to 200 |
Filters accept several comma-separated values. A skipped delivery wasn't sent because no URL was registered; last_error says why.
Wait
GET /v1/efi/wait answers as soon as something matches the filters, or 408 wait_timeout. Parameters: on (object or delivery), at least one of kind, ref, status, event, parent and api, and timeout in seconds (default 25, max 50). While waiting, the sandbox runs what is due every second. Use since with the time before the action so you don't match old events.
curl --url 'https://api.mimicr.dev/v1/efi/wait?on=delivery&kind=pix&since=2026-11-05T20:00:00Z&timeout=30' \ --header 'Authorization: Bearer mk_...'
npx mimicr wait efi object kind=charge ref=1000001 status=paid npx mimicr wait efi delivery api=openfinance kind=of_pagamento ref=urn:efi:…
Other-side actions
curl --request POST \
--url https://api.mimicr.dev/v1/efi/actions/pix.pay_cob \
--header 'Authorization: Bearer mk_...' \
--header 'Content-Type: application/json' \
--data '{ "txid": "7978c0c97ea847e78e8849634473c1f1" }'{ "ok": true, "action": "pix.pay_cob", "message": "Pix E09089356… recebido: cob CONCLUIDA e webhook enviado.", "data": { "e2eId": "E09089356…" } }In the CLI: npx mimicr action efi pix.pay_cob txid=… (true and false become booleans). npx mimicr actions efi lists them all. An action that doesn't apply to the current state answers 422 action_failed with the reason.
Pix API
| Action | Parameters | Effect |
|---|---|---|
pix.pay_cob | txid (required), tipo (cob default or cobv), nome, doc, infoPagador | The payer pays an ATIVA cob or cobv: Pix received, charge CONCLUIDA and /pix webhook |
pix.receive | valor (required, e.g. 12.50), chave (required, except via=dados_bancarios), via (chave, qrcode_estatico or dados_bancarios), txid (static QR), nome, doc, infoPagador | A Pix without a charge arrives at the account; applies the rules of PUT /v2/gn/config |
pix.decide_envio | idEnvio, ok (required) | The SPI settles (REALIZADO) or rejects (NAO_REALIZADO, AC03) an EM_PROCESSAMENTO send |
pix.decide_devolucao | id (rtrId), ok (required) | The payer's PSP accepts (DEVOLVIDO) or rejects an EM_PROCESSAMENTO refund |
pix.open_med | e2eId (required), tipoSituacao (default golpe) | The payer's bank opens an infraction (MED); the amount is blocked |
pix.decide_med | id, accept (required) | Fraud confirmed (returned to the payer, MED_FRAUDE) or rejected (block released) |
pixauto.approve_rec | idRec, jornada (JORNADA_2, JORNADA_3, JORNADA_4) (required), cobvTxid | The payer authorizes the recurrence in the bank app; journey 3 pays the activation cob, journey 4 pays the given cobv |
pixauto.reject_rec | idRec (required) | The payer rejects a CRIADA recurrence |
pixauto.cancel_rec | idRec, by (pagador or recebedor) (required) | Cancels a CRIADA or APROVADA recurrence and whatever is open in it |
pixauto.answer_solic | idSolicRec, accept (required) | The payer accepts or rejects the journey 1 request |
pixauto.decide_cobr | txid, result (liquidar, falhar, rejeitar) (required) | The payer's PSP settles, fails one attempt of, or rejects an ATIVA recurring charge |
Billing API
| Action | Parameters | Effect |
|---|---|---|
cobrancas.card_token | number (13 to 19 digits), brand (visa, mastercard, amex, elo, diners, hipercard) (required) | Creates a payment_token like Efí's JS library; the card's last digit decides (1, 2 and 3 are refused) |
cobrancas.charge | id (charge_id), action (required) | pagar (boleto paid), vencer (unpaid), expirar, identificar, contestar (paid only), baixa (settled), cancelar, reembolsar (card, becomes refunded shortly), link-boleto, link-cartao, link-cartao-recusado (the payer pays the link) |
cobrancas.carnet | id (carnet_id), action (cancelar or baixa) (required) | Cancels the open parcels or marks them all as paid (settled) |
cobrancas.subscription_next | id (subscription_id, required) | Creates the next cycle's charge; on the last one, the subscription expires |
Open Finance
| Action | Parameters | Effect |
|---|---|---|
openfinance.consent | kind (pagamento, vinculo, adesao), id (urn:efi:…), approve (required) | The payer authorizes or refuses at the bank, like the /consentimento page |
openfinance.payment | id (urn:efi:…), action (processar or expirar) (required) | Settles a scheduled payment or a recurrence's next installment now, or expires a pending consent |
openfinance.settle_auto_pix | e2eId (required) | Settles a scheduled Pix Automático now |
Bill payment
| Action | Parameters | Effect |
|---|---|---|
pagarcontas.barcode | tipo (boleto or convenio), valor (required); vencimento (boleto, default 5 days from now), banco (boleto, default 237), segmento (utility: 2 sanitation, 3 power, 4 telecom; default 3) | Creates a valid FEBRABAN barcode |
pagarcontas.payment | idPagamento, action (processar or cancelar) (required) | Runs an AGENDADO payment now, or cancels it like the Efí app |
Statements and Account opening
| Action | Parameters | Effect |
|---|---|---|
extratos.generate_now | comprimir (true = .zip) | Creates an ad hoc CNAB 240 file with today's entries so far |
abrircontas.decide | id, approve (required) | The end client approves (the account opens shortly, conta_aberta) or refuses, like the /aprovar page |
Homologation rules
curl --request PUT \
--url https://api.mimicr.dev/v1/efi/homolog \
--header 'Authorization: Bearer mk_...' \
--header 'Content-Type: application/json' \
--data '{ "autoPayCob": false, "envioRules": true }'| Switch | When on |
|---|---|
autoPayCob | Cob and cobv from R$ 0,01 to R$ 10,00 are paid on their own, as in Efí's homologation |
envioRules | Pix sends follow Efí's homologation amount table |
Turn autoPayCob off to pay only with pix.pay_cob. The other APIs' rules (card by last digit, 0.11 in Open Finance) are always on.
Clock
curl --request POST \
--url https://api.mimicr.dev/v1/efi/clock/advance \
--header 'Authorization: Bearer mk_...' \
--header 'Content-Type: application/json' \
--data '{ "days": 1 }'The body accepts seconds, minutes, hours and days, added together, up to 400 days per call; the response is {now, offset_ms}. Everything that comes due in the interval happens right away: cob and consent expiry, boletos falling due, webhook retries, bill cut-offs and schedules, installments and Pix Automático, statements for closed periods. Access tokens expire too: get a new one. The clock only moves forward; reset brings it back. In the CLI: npx mimicr clock efi +30m, +2h or +1d.
Chaos
curl --request PUT \
--url https://api.mimicr.dev/v1/efi/chaos/openfinance \
--header 'Authorization: Bearer mk_...' \
--header 'Content-Type: application/json' \
--data '{ "enabled": true, "apiErrorRate": 20, "apiErrorStatus": 503, "opsFailRate": 100, "opsFailCode": "Saldo insuficiente" }'Area (key) | Covers |
|---|---|
cob | Pix API: cob, cobv, batches, locations, received Pix, refunds and webhooks |
envio | Pix API: Pix sends |
conta | Pix API: /v2/gn/ routes (balance, config, split, MED, reports) |
rec | Pix Automático |
cobrancas | Billing API |
openfinance | Open Finance API |
pagarcontas | Bill payment API |
extratos | Statements API |
abrircontas | Account opening API |
| Field | Meaning |
|---|---|
enabled | Turns the area on or off |
apiErrorRate, apiErrorStatus | % of calls that answer 500, 503 or 429, with each API's error body |
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 refused and the reason: SPI codes for sends (AC03, AM04…), card, Open Finance and bill payment reasons |
webhookFailRate | % of webhooks whose first attempt fails |
webhookDuplicateRate | % of webhooks delivered twice |
A rate of 100 makes the test deterministic. Fields not sent keep their value; turn it off with {"enabled": false}. Token endpoints are never affected.
MCP server
Agents can use https://api.mimicr.dev/mcp (Streamable HTTP, same mk_… key). The tools cover overview, reference, control API calls, already-authenticated calls to the simulated APIs, actions, wait and clock advance. npx mimicr mcp prints the command to connect it in Claude Code and the JSON for other clients.
End-to-end example
npx mimicr reset efi T0=$(date -u +%Y-%m-%dT%H:%M:%SZ) # your application creates the cob with POST https://pix.efi.mimicr.dev/v2/cob and keeps the txid npx mimicr action efi pix.pay_cob txid=$TXID npx mimicr wait efi delivery kind=pix since=$T0 # your application pays a boleto at https://pagarcontas.efi.mimicr.dev npx mimicr wait efi object kind=pc_pagamento status=LIQUIDADO since=$T0