Guides
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.
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
| Route | Purpose |
|---|---|
GET /v1/bloquo | Host, token_url, credentials, root_customer_id, the root customer's accounts with balances, prices, homologation, chaos and clock |
POST /v1/bloquo/activate | Activates the sandbox (409 bloquo_already_active if it already exists) |
POST /v1/bloquo/reset | Deletes the test data and recreates a zeroed root customer; keeps credentials, prices and settings; brings the clock back to real time |
GET /v1/bloquo/objects | Sandbox 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/deliveries | Notification 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}/resend | Resends it now |
GET /v1/bloquo/wait | Waits for an object or a delivery (long poll) |
GET /v1/bloquo/clock | Sandbox time (now, offset_ms) |
POST /v1/bloquo/clock/advance | Advances the clock |
POST /v1/bloquo/sweep | Processes everything that is due right now |
PUT /v1/bloquo/homolog | Turns the automatic steps on or off |
PUT /v1/bloquo/rates | BRL prices used in quotes |
GET /v1/bloquo/chaos | Chaos settings of the three areas |
PUT /v1/bloquo/chaos/{key} | Configures chaos for one area |
GET /v1/bloquo/actions | Lists 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.
| Action | Parameters | What it does |
|---|---|---|
account.credit | accountId, amount | Credits the account as an already settled external deposit (Credit transaction, no order) |
deposit.pay | depositId | The payer pays the PIX (or the network confirms) now: COMPLETED, credit and webhook; works for ,05 deposits too |
deposit.expire | depositId | The instruction expires now: EXPIRED |
withdrawal.approve | withdrawalId | Treasury approves a PENDING_TREASURY withdrawal |
withdrawal.complete | withdrawalId | The bank settles now (COMPLETED), ignoring the ,07 rule |
withdrawal.fail | withdrawalId, reason (optional) | The bank rejects it: FAILED with failureReason; the hold is released |
trade.complete | tradeId (orderId or numeric id) | The liquidity provider and treasury confirm: COMPLETED |
trade.fail | tradeId | The provider rejects it: FAILED; the locked balance comes back |
fxpayment.approve | fxPaymentId | Compliance approves a PENDING_APPROVAL FX payment |
fxpayment.reject | fxPaymentId, reason (optional) | Compliance rejects it: REJECTED; the hold is released |
counterparty.approve | customerId, counterpartyId | Compliance approves the relation: Approved and a Compliance webhook |
counterparty.reject | customerId, counterpartyId, notes (optional) | Compliance rejects it: Rejected and a Compliance webhook |
wallet.approve | walletWhitelistId | Compliance approves the address (complianceApproved: true) |
subaccount.approve | customerId | The sub-account becomes Active |
subaccount.request_kyc | customerId | Compliance asks for documents: AwaitingKyc |
subaccount.reject | customerId | The sub-account becomes Rejected |
notification.resend | notificationId | Resends a notification order now |
curl -X POST https://api.mimicr.dev/v1/bloquo/actions/deposit.pay \
-H "Authorization: Bearer mk_..." \
-H "Content-Type: application/json" \
-d '{"depositId": "1043"}'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).
curl "https://api.mimicr.dev/v1/bloquo/wait?on=object&kind=deposit&id=1043&status=COMPLETED" \ -H "Authorization: Bearer mk_..."
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
curl -X POST https://api.mimicr.dev/v1/bloquo/clock/advance \
-H "Authorization: Bearer mk_..." \
-H "Content-Type: application/json" \
-d '{"minutes": 10}'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
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.
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).
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}'| Field | Effect |
|---|---|
enabled | Turns 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, latencyMaxMs | Extra 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:
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.