Guides
Mimicr

Sandbox control

Mimicr's control API, CLI and MCP server to drive the other side, wait for events, move the clock and inject failures.

Trace's API only lets you act as the customer. To test end to end, Mimicr also lets you act as the other side: compliance, the QR payer, the Pix rail and the back office. All of it lives in the control API, at https://api.mimicr.dev/v1/trace, 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, "API keys" tab. Read keys can only query; actions, clock, chaos and reset need a write key.

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

With the CLI (Node 18+):

bash
npx mimicr login mk_...
npx mimicr status trace

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/traceSandbox state: host, credentials, customer, virtual Pix key, rates, toggles, chaos and clock
POST /v1/trace/activateActivates the organization's sandbox (201); if already active, 409 trace_already_active
POST /v1/trace/resetDeletes the test data; keeps credentials, rates and settings and returns the clock to real time
POST /v1/trace/sweepRuns the due automatic steps and pending deliveries now
GET /v1/trace/waitWaits until an object or a delivery shows up (long poll)
GET /v1/trace/clockSandbox time (now) and offset (offset_ms)
POST /v1/trace/clock/advanceMoves the clock forward and runs the steps that became due
GET /v1/trace/objectsLists sandbox objects
GET /v1/trace/objects/{kind}/{id}One object
GET /v1/trace/deliveriesLists webhook deliveries
GET /v1/trace/deliveries/{id}One delivery, with request_headers: the headers sent, including X-Message-Signature
POST /v1/trace/deliveries/{id}/resendResends it as a new delivery
GET /v1/trace/actionsLists the actions and their parameters
POST /v1/trace/actions/{id}Runs an action
GET /v1/trace/chaosChaos configuration per area
PUT /v1/trace/chaos/{area}Changes chaos for accounts, operations or beneficiaries
PUT /v1/trace/homologTurns the automatic steps on or off
PUT /v1/trace/ratesPrice of 1 USDT and 1 USDC in BRL

Control API errors use {"error": {...}} with lowercase codes (for example trace_not_active, unknown_action, action_failed, wait_timeout), unlike Trace's envelope.

Objects and deliveries

Objects are the sandbox's resources. kind is one of account, ubo, document, quote, operation, beneficiary, instruction or subscription; id is the same id as in Trace's API; parent links an instruction to its beneficiary, and a UBO or an operation to its account.

/objects filterExample
kindkind=operation,instruction
statusstatus=PROCESSING,ACTION_REQUIRED
idid=<operation-id>
parentparent=<account-id>
sincesince=2026-11-05T20:00:00Z (updated since)
limit50 by default, up to 200
/deliveries filterExample
resourceresource=OPERATION
eventevent=OPERATION_COMPLETED,OPERATION_FAILED
statusstatus=FAILED (PENDING, SUCCESS or FAILED)
refref=<operation, account or beneficiary id>
since, limitas above

Filters accept several comma-separated values.

Wait

GET /v1/trace/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, resource and ref) and timeout in seconds (default 25, max 50). While waiting, the simulator runs the due steps.

bash
curl --url 'https://api.mimicr.dev/v1/trace/wait?on=object&id=<operation-id>&status=COMPLETED&timeout=30' \
  --header 'Authorization: Bearer mk_...'
bash
npx mimicr wait trace object id=<operation-id> status=COMPLETED
npx mimicr wait trace delivery event=OPERATION_COMPLETED ref=<operation-id> --timeout 50

Other-side actions

bash
curl --request POST \
  --url https://api.mimicr.dev/v1/trace/actions/deposit.pay \
  --header 'Authorization: Bearer mk_...' \
  --header 'Content-Type: application/json' \
  --data '{ "operationId": "<operation-id>" }'
json
{
  "ok": true,
  "action": "deposit.pay",
  "message": "Depósito COMPLETED: webhook OPERATION_COMPLETED enviado.",
  "data": { "id": "<operation-id>", "type": "DEPOSIT", "status": "COMPLETED" }
}

With the CLI: npx mimicr action trace deposit.pay operationId=<id> (true and false become booleans). An action that does not fit the current state answers 422 action_failed with the reason. Action messages are in Portuguese.

ActionParametersEffect
account.create_activeaccountType (VIRTUAL default, NAMED, NAMED_NON_RESIDENT), legalNameCreates an ACTIVE account with BRL, USDT and USDC, no onboarding, in the sandbox customer's name
account.approveaccountId (required), activateFiat (default true)Compliance approves: documents and UBOs approved, crypto ACTIVE; with activateFiat, BRL ACTIVE and account ACTIVE
account.reject_requirementaccountId, requirement (required), messageSends back a document (by documentType) or an owner field; account in ACTION_REQUIRED, ACCOUNT_ACTION_REQUIRED
account.rejectaccountId (required), messageRejects the account (REJECTED)
account.fail_assetaccountId, asset (BRL, USDT, USDC) (required)An asset in ONBOARDING becomes FAILED, ACCOUNT_ASSET_FAILED
account.receive_pixaccountId, amount (required, e.g. 1000.00), payerNameUnrequested Pix to the account's key: COMPLETED deposit with quote: null
account.receive_cryptoaccountId, asset (USDT, USDC), amount (required, e.g. 250.000000)Stablecoins received at the account's wallet: COMPLETED deposit with quote: null
deposit.payoperationId (required)The payer pays the QR now (COMPLETED), including the 8.00 amount
deposit.expireoperationId (required)The QR expires unpaid (FAILED, QR_CODE_EXPIRED)
operation.settleoperationId (required), forceSettles a withdrawal, swap or transfer, or takes a refund from REFUNDING to REFUNDED; force skips the .09 rule and chaos
operation.failoperationId (required), code (default PROCESSING_ERROR), messageThe rail refuses: FAILED with the reason and the reserve released
operation.require_documentoperationId (required), documentType (FINANCIAL_CAPACITY default, INVOICE)Compliance pauses an operation in PROCESSING: ACTION_REQUIRED, OPERATION_ACTION_REQUIRED
instruction.approveinstructionId (required)Approves a pending instruction, BENEFICIARY_INSTRUCTION_APPROVED
instruction.rejectinstructionId (required), message (default "An unknown error occurred.")Rejects with COMPLIANCE_REJECTED
instruction.require_documentinstructionId (required), messageAsks (again) for the custody attestation of a CRYPTO instruction
webhook.resendlogId (required), retryResends a delivery as a new log, with the same X-Message-Id; retry=true retries the same log

Homologation toggles

All on by default.

bash
curl --request PUT \
  --url https://api.mimicr.dev/v1/trace/homolog \
  --header 'Authorization: Bearer mk_...' \
  --header 'Content-Type: application/json' \
  --data '{ "autoApproveAccounts": false, "autoSettleOperations": false }'
ToggleWhen on
autoApproveAccountsAccount review settles on its own
autoPayDepositsThe QR is paid on its own (the 8.00 and 9.00 rules still apply)
autoSettleOperationsWithdrawals, swaps, transfers and refunds advance on their own
autoReviewInstructionsPayment instruction review settles on its own

Or with the CLI: npx mimicr put /v1/trace/homolog autoPayDeposits=false.

Rates

bash
curl --request PUT \
  --url https://api.mimicr.dev/v1/trace/rates \
  --header 'Authorization: Bearer mk_...' \
  --header 'Content-Type: application/json' \
  --data '{ "USDT": "5.37" }'

The value is the price of one unit in BRL, as a decimal string. USDT ↔ USDC is always 1:1.

Clock

bash
curl --request POST \
  --url https://api.mimicr.dev/v1/trace/clock/advance \
  --header 'Authorization: Bearer mk_...' \
  --header 'Content-Type: application/json' \
  --data '{ "hours": 24 }'

The body accepts seconds, minutes, hours and days, added together, up to 400 days per call. The response is {now, offset_ms}. After the move, the due steps run right away. With the CLI: npx mimicr clock trace +30m, +2h or +1d.

Common uses:

  • Expire a quote (30 s) and test QUOTE_EXPIRED.
  • Expire the QR of an 8.00 deposit (24 h).
  • Expire the token (23 h) and test EXPIRED_ACCESS_TOKEN.

Reset returns the clock to real time.

Chaos

bash
curl --request PUT \
  --url https://api.mimicr.dev/v1/trace/chaos/operations \
  --header 'Authorization: Bearer mk_...' \
  --header 'Content-Type: application/json' \
  --data '{ "enabled": true, "apiErrorRate": 20, "apiErrorStatus": 503, "latencyMinMs": 500, "latencyMaxMs": 2000, "opsFailRate": 10, "opsFailCode": "PROCESSING_ERROR" }'
FieldMeaning
enabledTurns the area on or off
apiErrorRate% of calls that answer an error
apiErrorStatus500, 503 or 429
apiErrorWhenbefore (nothing is processed) or after (processes, then answers the error)
latencyMinMs, latencyMaxMsExtra latency, up to 20,000 ms
opsFailRate, opsFailCode% of operations that fail: on operations, PROCESSING_ERROR or INSUFFICIENT_BALANCE; on beneficiaries, COMPLIANCE_REJECTED; accounts has none
webhookFailRate% of deliveries whose first attempt fails
webhookDuplicateRate% of events delivered twice

The areas cover /v1/accounts (accounts), /v1/beneficiaries (beneficiaries) and /v1/quotes, /v1/operations and /v1/reports (operations). The token endpoint and the Webhooks API are never affected. Fields you do not send keep their current value.

MCP server

Agents can use https://api.mimicr.dev/mcp (Streamable HTTP, same mk_… key). Its tools cover an overview, the 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 trace
ACCOUNT=$(npx mimicr action trace account.create_active | jq -r .data.id)
npx mimicr action trace account.receive_pix accountId=$ACCOUNT amount=1000.00
# your app creates a quote and a withdrawal against https://trace.mimicr.dev and keeps the withdrawal id
npx mimicr wait trace object id=<withdrawal-id> status=COMPLETED