Guides
Mimicr

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.

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

bash
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 pathWhat for
GET /v1/efiSandbox state: hosts, credentials, account, keys, balance, homologation, chaos and clock
POST /v1/efi/activateActivates the organization's sandbox (201); if already active, 409 efi_already_active
POST /v1/efi/resetDeletes test data; keeps credentials, keys and settings and resets the clock to real time
POST /v1/efi/sweepRuns what is already due (automatic payments, results, retries) now, without waiting for the 1-minute cron
GET /v1/efi/waitWaits until an object or a delivery shows up (long poll)
GET /v1/efi/clockSandbox time (now) and offset (offset_ms)
POST /v1/efi/clock/advanceAdvances the clock and runs what came due
GET /v1/efi/objectsLists the sandbox resources
GET /v1/efi/objects/{kind}/{ref}One resource
GET /v1/efi/deliveriesLists 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}/resendTries the delivery again now
GET /v1/efi/actionsLists the actions with their parameters
POST /v1/efi/actions/{id}Runs an action
GET /v1/efi/chaosChaos by area
PUT /v1/efi/chaos/{key}Changes one area's chaos
PUT /v1/efi/homologTurns 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.

kindrefAPI
cob, cobvtxidPix
pix, devolucaoendToEndId, rtrIdPix
envioidEnvioPix
rec, solicrec, cobridRec, idSolicRec, txidPix Automático
infracaoinfraction id (MED)Pix
charge, carnet, subscription, plancharge_id, carnet_id, subscription_id, plan_idBilling
card_tokenpayment_tokenBilling
of_pagamento, of_vinculo, of_adesao, of_auto_pix, of_devolucaourn:efi:…, endToEndId or identificadorDevolucaoOpen Finance
pc_pagamentoidPagamentoBill payment
cnab_arquivo, cnab_agendamentofile name, periodicityStatements
ac_conta, ac_webhookidentifierAccount opening
Filter/objects/deliveries
kindkind=charge,carnetkind=of_pagamento
statusstatus=waiting,unpaidstatus=pending,failed (pending, success, failed, skipped)
refref=1000001ref=urn:efi:…
parentparent=<carnet_id>
apiapi=pix,cobrancas,openfinance,pagarcontas,abrircontas
eventevent=conta_aberta
sinceupdated since (ISO 8601)created since (ISO 8601)
limit50 by default, up to 20050 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.

bash
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_...'
bash
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

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

ActionParametersEffect
pix.pay_cobtxid (required), tipo (cob default or cobv), nome, doc, infoPagadorThe payer pays an ATIVA cob or cobv: Pix received, charge CONCLUIDA and /pix webhook
pix.receivevalor (required, e.g. 12.50), chave (required, except via=dados_bancarios), via (chave, qrcode_estatico or dados_bancarios), txid (static QR), nome, doc, infoPagadorA Pix without a charge arrives at the account; applies the rules of PUT /v2/gn/config
pix.decide_envioidEnvio, ok (required)The SPI settles (REALIZADO) or rejects (NAO_REALIZADO, AC03) an EM_PROCESSAMENTO send
pix.decide_devolucaoid (rtrId), ok (required)The payer's PSP accepts (DEVOLVIDO) or rejects an EM_PROCESSAMENTO refund
pix.open_mede2eId (required), tipoSituacao (default golpe)The payer's bank opens an infraction (MED); the amount is blocked
pix.decide_medid, accept (required)Fraud confirmed (returned to the payer, MED_FRAUDE) or rejected (block released)
pixauto.approve_recidRec, jornada (JORNADA_2, JORNADA_3, JORNADA_4) (required), cobvTxidThe payer authorizes the recurrence in the bank app; journey 3 pays the activation cob, journey 4 pays the given cobv
pixauto.reject_recidRec (required)The payer rejects a CRIADA recurrence
pixauto.cancel_recidRec, by (pagador or recebedor) (required)Cancels a CRIADA or APROVADA recurrence and whatever is open in it
pixauto.answer_solicidSolicRec, accept (required)The payer accepts or rejects the journey 1 request
pixauto.decide_cobrtxid, result (liquidar, falhar, rejeitar) (required)The payer's PSP settles, fails one attempt of, or rejects an ATIVA recurring charge

Billing API

ActionParametersEffect
cobrancas.card_tokennumber (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.chargeid (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.carnetid (carnet_id), action (cancelar or baixa) (required)Cancels the open parcels or marks them all as paid (settled)
cobrancas.subscription_nextid (subscription_id, required)Creates the next cycle's charge; on the last one, the subscription expires

Open Finance

ActionParametersEffect
openfinance.consentkind (pagamento, vinculo, adesao), id (urn:efi:…), approve (required)The payer authorizes or refuses at the bank, like the /consentimento page
openfinance.paymentid (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_pixe2eId (required)Settles a scheduled Pix Automático now

Bill payment

ActionParametersEffect
pagarcontas.barcodetipo (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.paymentidPagamento, action (processar or cancelar) (required)Runs an AGENDADO payment now, or cancels it like the Efí app

Statements and Account opening

ActionParametersEffect
extratos.generate_nowcomprimir (true = .zip)Creates an ad hoc CNAB 240 file with today's entries so far
abrircontas.decideid, approve (required)The end client approves (the account opens shortly, conta_aberta) or refuses, like the /aprovar page

Homologation rules

bash
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 }'
SwitchWhen on
autoPayCobCob and cobv from R$ 0,01 to R$ 10,00 are paid on their own, as in Efí's homologation
envioRulesPix 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

bash
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

bash
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
cobPix API: cob, cobv, batches, locations, received Pix, refunds and webhooks
envioPix API: Pix sends
contaPix API: /v2/gn/ routes (balance, config, split, MED, reports)
recPix Automático
cobrancasBilling API
openfinanceOpen Finance API
pagarcontasBill payment API
extratosStatements API
abrircontasAccount opening API
FieldMeaning
enabledTurns the area on or off
apiErrorRate, apiErrorStatus% of calls that answer 500, 503 or 429, with each API's error body
apiErrorWhenbefore (nothing is processed) or after (processes, then answers an error)
latencyMinMs, latencyMaxMsExtra 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

bash
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