Guides
Sandbox control
Mimicr's control API, CLI and MCP to act as the player and the bank, wait for notifications, move the clock and inject failures.
Okto's API only lets you act as the operator. To test end to end, Mimicr also lets you act as the other side: the player who pays the QR, approves at the bank or takes the selfie, the bank that credits the withdrawal and the wallet key that receives Pix. All of this lives in the control API, at https://api.mimicr.dev/v1/okto, and the same commands exist in the console, on the hosted pages, in the CLI and in 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 and reset need a write key.
curl --url https://api.mimicr.dev/v1/okto \ --header 'Authorization: Bearer mk_...'
With the CLI (Node 18+):
npx mimicr login mk_... npx mimicr status okto
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 path | Purpose |
|---|---|
GET /v1/okto | State: host, access_token, notification_token, URLs, public_key, balance, chaos and clock; {"active": false} when not activated |
POST /v1/okto/activate | Activates the organization's sandbox (201); if already active, 409 okto_already_active |
POST /v1/okto/reset | Deletes transactions, objects and notifications; keeps the token, URLs and RSA key and puts the clock back to real time |
POST /v1/okto/sweep | Processes now whatever is due (expirations, scheduled charges, retries) |
GET /v1/okto/wait | Waits until a transaction, object or notification shows up (long poll) |
GET /v1/okto/clock | Sandbox time (now) and offset (offset_ms) |
POST /v1/okto/clock/advance | Moves the clock forward and processes what became due |
GET /v1/okto/transactions | Lists the money movements of every product |
GET /v1/okto/transactions/{id} | One movement |
GET /v1/okto/objects | Lists what isn't money (recurrences, enrollments, journeys, KYC…) |
GET /v1/okto/objects/{kind}/{id} | One object |
GET /v1/okto/deliveries | Lists notifications |
GET /v1/okto/deliveries/{id} | One notification, with body, signature and attempts |
POST /v1/okto/deliveries/{id}/resend | Tries to deliver it again, right away |
GET /v1/okto/actions | Lists the actions with their parameters |
POST /v1/okto/actions/{id} | Runs an action |
GET /v1/okto/chaos | Chaos settings of each product |
PUT /v1/okto/chaos/{key} | Changes a product's chaos |
Control API errors use {"error": {...}} with lowercase codes (for example okto_not_active, unknown_action, action_failed, wait_timeout), different from Okto's envelope.
Transactions, objects and notifications
/transactions filter | Example |
|---|---|
type | type=deposit (deposit or withdraw) |
flow | flow=direct,smart (classic, dict, manual, automatic, biometric, direct, pix_by_key, pay_and_play, smart) |
status | status=paid,failed (lowercase, as stored: created, overdue, paid, expired, failed, reversed, reversing, reviewing, processing, success) |
id, external_id | id=1268321722477579 |
since | since=2026-10-21T19:00:00Z (updated since) |
limit | 50 by default, up to 200 |
/objects filter | Example |
|---|---|
kind | recurrence, bio_enrollment, bio_journey, payer_account, smart_journey, smart_enrollment, pnp_journey, pnp_block, face_match, kyc_terms, kyc_query |
status | status=AUTHORIZED (the product's status, as the API shows it) |
id, since, limit | as above |
/deliveries filter | Example |
|---|---|
kind | deposit, withdraw, by_key_deposit, automatic_authorization, automatic_payment, biometric_enrollment, biometric_payment, biometric_journey, direct_payment, pay_and_play, face_match, kyc |
event | the announced status, for example event=paid |
transaction_id | id of the transaction or object |
status | pending, success, failed or skipped |
since, limit | as above |
Filters take several comma-separated values.
Wait
GET /v1/okto/wait answers as soon as something matches the filters, or 408 wait_timeout. Parameters: on (transaction, object or delivery), the filters above (at least one of id, external_id, type, flow, kind, status, event and transaction_id) and timeout in seconds (default 25, maximum 50). While waiting, the simulator processes whatever is due.
curl --url 'https://api.mimicr.dev/v1/okto/wait?on=delivery&transaction_id=1268321722477579&event=paid&timeout=30' \ --header 'Authorization: Bearer mk_...'
npx mimicr wait okto transaction id=1268321722477579 status=paid npx mimicr wait okto object kind=recurrence status=AUTHORIZED --timeout 50 npx mimicr wait okto delivery kind=withdraw event=success
Use since with the time before the action so you don't match old events.
Other-side actions
curl --request POST \
--url https://api.mimicr.dev/v1/okto/actions/player.step \
--header 'Authorization: Bearer mk_...' \
--header 'Content-Type: application/json' \
--data '{ "step": "deposit:pay", "id": "1268321722477579" }'{
"ok": true,
"action": "player.step",
"message": "Depósito Pix (QR Code): paid",
"data": { "success": true }
}With the CLI: npx mimicr action okto player.step step=deposit:pay id=<id>. An action that doesn't apply to the current state answers 422 action_failed with the reason (Okto errors show as code · detail). Action messages are in Portuguese.
| Action | Parameters | Effect |
|---|---|---|
player.step | step, id (required); taxId, amount (only pay-and-play:pay) | The player acts at the bank or on the hosted page; steps are in the table below |
bykey.receive | taxId, amount (required, e.g. 25.00) | A player sends Pix to the wallet key, like Mock a received Pix (v2) |
deposit.refund | id (required) | The bank returns a deposit paid today to the payer (reversed, with a notification) |
notification.test | kind (required: deposit or withdraw) | Sends a signed sample notification (Invoice paid or Transfer success) without touching the balance |
Player steps
step | id | Effect |
|---|---|---|
deposit:pay | deposit | Pays the QR: paid, reviewing (closed loop) or failed per the test data |
deposit:expire | deposit | The deposit expires unpaid (expired) |
withdraw:credit | withdrawal | The bank credits the player now (success) or refuses per the test data, without waiting the 15 seconds |
withdraw:fail | withdrawal | The bank refuses (failed, 2006) |
direct:approve | Pix Direct payment | Approves at the bank (paid) |
direct:reject | Pix Direct payment | Refuses at the bank (failed, 4448) |
automatic:authorize | recurrence | Pays the immediate charge and authorizes (AUTHORIZED) |
automatic:pay | recurrence | Only pays the QR, without authorizing |
automatic:reject | recurrence | Refuses the authorization (REJECTED) |
automatic:cancel | recurrence | The payer cancels (CANCELLED) |
biometric-enrollment:authorize | enrollment | Authorizes the enrollment at the bank; then your application creates and validates the challenge |
biometric-enrollment:revoke | enrollment | Revokes the enrollment (revoked) |
biometric-journey:pay | biometric journey | Pays with biometrics (paid) |
biometric-journey:fail | biometric journey | The player refuses (failed, 4114) |
biometric-journey:expire | biometric journey | The journey expires (expired) |
smart:approve | Smart PIX journey | Authorizes: creates the bank enrollment and pays |
smart:reject | Smart PIX journey | Refuses (failed, 4448) |
pay-and-play:pay | Pay and Play journey | Onboards and pays the QR; the deposit waits for the operator to accept |
pay-and-play:expire | Pay and Play journey | The journey expires (expired) |
face-match:selfie | Face Match journey | Sends the selfie (success, or rejected per the test data) |
face-match:giveup | Face Match journey | Gives up (failed, 4303) |
In pay-and-play:pay, taxId is the payer's CPF (default: the journey's) and amount the amount in reais (default 50.00).
Clock
curl --request POST \
--url https://api.mimicr.dev/v1/okto/clock/advance \
--header 'Authorization: Bearer mk_...' \
--header 'Content-Type: application/json' \
--data '{ "hours": 3 }'The body takes seconds, minutes, hours and days, summed, up to 400 days per call. The response is {now, offset_ms}. After moving, whatever became due happens right away, with its notifications. With the CLI: npx mimicr clock okto +30m, +3h or +1d.
Common uses:
- Make a deposit
overdue(5 min) and thenexpired(+3 h with the defaultexpiration). - Expire a Pix Direct payment (5 min,
4447) or a Pay and Play journey (3 h). - Settle an Automatic Pix scheduled charge on its
dueDate. - Fire the retries of a failed notification.
The clock only moves forward; reset brings it back to real time. Deadlines are in Environment.
Chaos
curl --request PUT \
--url https://api.mimicr.dev/v1/okto/chaos/withdraw \
--header 'Authorization: Bearer mk_...' \
--header 'Content-Type: application/json' \
--data '{ "enabled": true, "apiErrorRate": 20, "apiErrorStatus": 503, "latencyMinMs": 500, "latencyMaxMs": 2000, "opsFailRate": 10, "opsFailCode": 2006 }'| Field | Meaning |
|---|---|
enabled | Turns the product on or off |
apiErrorRate | % of calls that answer an error |
apiErrorStatus | 500, 503 or 429 |
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 that fail and the Okto code used |
webhookFailRate | % of notifications whose first attempt fails |
webhookDuplicateRate | % of notifications delivered twice |
The keys are deposit, withdraw, by_key, direct, automatic, biometric, smart, pay_and_play, kyc and face_match; the codes each one accepts are in Testing in the sandbox. Smart PIX has no notifications and KYC has no operation failures. mock-* endpoints and the shared routes (/operator, /transactions/status, GET /transactions) are never affected. Fields you don't send keep their current value.
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 API, 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
npx mimicr reset okto # your application creates the deposit at https://okto.mimicr.dev and keeps the id npx mimicr action okto player.step step=deposit:pay id=<deposit-id> npx mimicr wait okto delivery transaction_id=<deposit-id> event=paid # your application requests a withdrawal with externalId saque-2001; the response has no id WITHDRAW=$(npx mimicr wait okto transaction external_id=saque-2001 type=withdraw | jq -r .transaction.id) # the withdrawal settles on its own in 15 s; credit settles it right away npx mimicr action okto player.step step=withdraw:credit id=$WITHDRAW npx mimicr wait okto delivery transaction_id=$WITHDRAW event=success