Guides
Mimicr

Sandbox control

Control API, CLI and MCP to play the other side, wait for events, move the clock and inject chaos.

The simulated Bloquo API is the side your app calls. The other side (payer, bank, treasury, liquidity provider and compliance) you control through Mimicr's control API at https://api.mimicr.dev, the npx mimicr CLI or the MCP server. All three run the same operations as the console buttons.

Keys

Create a key in Organization settings → API keys and send it as Authorization: Bearer mk_…. read keys can only GET; write keys can also act. A key works for every sandbox of the organization.

bash
export MIMICR_API_KEY=mk_...
npx mimicr status bloquo

The CLI reads the key from --key, from MIMICR_API_KEY or from npx mimicr login mk_…. Control API errors come as {"error": {"code": "...", "message": "..."}}.

Routes

RoutePurpose
GET /v1/bloquoHost, token_url, credentials, root_customer_id, the root customer's accounts with balances, prices, homologation, chaos and clock
POST /v1/bloquo/activateActivates the sandbox (409 bloquo_already_active if it already exists)
POST /v1/bloquo/resetDeletes the test data and recreates a zeroed root customer; keeps credentials, prices and settings; brings the clock back to real time
GET /v1/bloquo/objectsSandbox objects, filtered by kind, status, id, parent (customer id), since and limit (default 50, max 200)
GET /v1/bloquo/objects/{kind}/{id}One object
GET /v1/bloquo/deliveriesNotification orders, filtered by order_type, order_id, event (the order status), status, since and limit
GET /v1/bloquo/deliveries/{id}One notification order, with body and attempts; each attempt has request_headers (the X-Bloquo-Signature sent) and signature_t
POST /v1/bloquo/deliveries/{id}/resendResends it now
GET /v1/bloquo/waitWaits for an object or a delivery (long poll)
GET /v1/bloquo/clockSandbox time (now, offset_ms)
POST /v1/bloquo/clock/advanceAdvances the clock
POST /v1/bloquo/sweepProcesses everything that is due right now
PUT /v1/bloquo/homologTurns the automatic steps on or off
PUT /v1/bloquo/ratesBRL prices used in quotes
GET /v1/bloquo/chaosChaos settings of the three areas
PUT /v1/bloquo/chaos/{key}Configures chaos for one area
GET /v1/bloquo/actionsLists the actions and their parameters
POST /v1/bloquo/actions/{id}Runs an action

Object kinds are customer, account, counterparty, relation (customer–counterparty, with the compliance status), whitelist, pair, quote, trade (id = UUID orderId), deposit, withdrawal, fx_payment, transaction and preference.

Actions

POST /v1/bloquo/actions/{id} takes the parameters as JSON and answers {"ok": true, "action": "...", "message": "...", "data": {...}}. An action that doesn't apply to the current state answers 422 action_failed with the reason. Action messages are in Portuguese.

ActionParametersWhat it does
account.creditaccountId, amountCredits the account as an already settled external deposit (Credit transaction, no order)
deposit.paydepositIdThe payer pays the PIX (or the network confirms) now: COMPLETED, credit and webhook; works for ,05 deposits too
deposit.expiredepositIdThe instruction expires now: EXPIRED
withdrawal.approvewithdrawalIdTreasury approves a PENDING_TREASURY withdrawal
withdrawal.completewithdrawalIdThe bank settles now (COMPLETED), ignoring the ,07 rule
withdrawal.failwithdrawalId, reason (optional)The bank rejects it: FAILED with failureReason; the hold is released
trade.completetradeId (orderId or numeric id)The liquidity provider and treasury confirm: COMPLETED
trade.failtradeIdThe provider rejects it: FAILED; the locked balance comes back
fxpayment.approvefxPaymentIdCompliance approves a PENDING_APPROVAL FX payment
fxpayment.rejectfxPaymentId, reason (optional)Compliance rejects it: REJECTED; the hold is released
counterparty.approvecustomerId, counterpartyIdCompliance approves the relation: Approved and a Compliance webhook
counterparty.rejectcustomerId, counterpartyId, notes (optional)Compliance rejects it: Rejected and a Compliance webhook
wallet.approvewalletWhitelistIdCompliance approves the address (complianceApproved: true)
subaccount.approvecustomerIdThe sub-account becomes Active
subaccount.request_kyccustomerIdCompliance asks for documents: AwaitingKyc
subaccount.rejectcustomerIdThe sub-account becomes Rejected
notification.resendnotificationIdResends a notification order now
bash
curl -X POST https://api.mimicr.dev/v1/bloquo/actions/deposit.pay \
  -H "Authorization: Bearer mk_..." \
  -H "Content-Type: application/json" \
  -d '{"depositId": "1043"}'
bash
npx mimicr action bloquo account.credit accountId=1004 amount=10000.00
npx mimicr action bloquo withdrawal.fail withdrawalId=1057 reason="Destination account closed"

Wait for events

GET /v1/bloquo/wait holds the response until something matches the filters, for up to timeout seconds (default 25, max 50); if nothing shows up, it answers 408 wait_timeout. Use on=object (filters kind, id, parent, status, since) or on=delivery (filters order_type, order_id, event, status, since).

bash
curl "https://api.mimicr.dev/v1/bloquo/wait?on=object&kind=deposit&id=1043&status=COMPLETED" \
  -H "Authorization: Bearer mk_..."
bash
npx mimicr wait bloquo delivery order_type=Deposit order_id=1043 event=COMPLETED
npx mimicr wait bloquo object kind=fx_payment id=1090 status=COMPLETED --timeout 50

In an automated test, the pattern is: call the Bloquo API, wait for the event with wait, then check what your app did with the webhook.

Clock

bash
curl -X POST https://api.mimicr.dev/v1/bloquo/clock/advance \
  -H "Authorization: Bearer mk_..." \
  -H "Content-Type: application/json" \
  -d '{"minutes": 10}'
bash
npx mimicr clock bloquo +2h

The body accepts seconds, minutes, hours and days (summed, up to 400 days per call). Advancing the clock processes whatever became due right away: 30 s quotes, deposit instructions, 1-hour tokens and webhook retries. The clock only moves forward; reset brings it back to real time.

Homologation and prices

bash
curl -X PUT https://api.mimicr.dev/v1/bloquo/homolog \
  -H "Authorization: Bearer mk_..." \
  -H "Content-Type: application/json" \
  -d '{"autoSettleOrders": false, "autoApproveFxPayments": false}'

Keys: autoApproveSubaccounts, autoApproveCounterparties, autoApproveWallets, autoPayDeposits, autoSettleOrders and autoApproveFxPayments, all on by default. See Sandbox rules.

bash
curl -X PUT https://api.mimicr.dev/v1/bloquo/rates \
  -H "Authorization: Bearer mk_..." \
  -H "Content-Type: application/json" \
  -d '{"USD": "5.37", "BTC": "360000.00"}'

Accepted currencies: USD, EUR, GBP, USDT, USDC and BTC, with the BRL price as a decimal string.

Chaos

There are three areas: customers (customers, accounts and counterparties), orders (deposits, withdrawals, FX payments and transactions) and trade (quotes and execution).

bash
curl -X PUT https://api.mimicr.dev/v1/bloquo/chaos/orders \
  -H "Authorization: Bearer mk_..." \
  -H "Content-Type: application/json" \
  -d '{"enabled": true, "apiErrorRate": 10, "apiErrorStatus": 503, "latencyMinMs": 200, "latencyMaxMs": 1500, "opsFailRate": 20, "opsFailCode": "FAILED", "webhookFailRate": 50, "webhookDuplicateRate": 10}'
FieldEffect
enabledTurns the area's chaos on or off
apiErrorRate, apiErrorStatus, apiErrorWhen% of calls that answer 500, 503 or 429, before (before) or after (after) processing
latencyMinMs, latencyMaxMsExtra latency, up to 20000 ms
opsFailRate, opsFailCode% of operations that end badly: Rejected in customers; FAILED or EXPIRED in orders; FAILED in trade
webhookFailRate% of notifications whose first attempt fails
webhookDuplicateRate% of notifications delivered twice

With apiErrorWhen: "after", the operation happens but the response is an error: the classic case for testing your app's reconciliation.

MCP

The same host serves an MCP server at https://api.mimicr.dev/mcp, with the same key. It exposes high-level tools (overview, reference, control, simulated API call, action, wait and clock) so an agent can run the same flows. To connect it in Claude Code:

bash
claude mcp add --transport http mimicr https://api.mimicr.dev/mcp --header "Authorization: Bearer $MIMICR_API_KEY"

npx mimicr mcp prints this command and the JSON for other clients.