Guides
Mimicr

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.

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

With the CLI (Node 18+):

bash
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 pathPurpose
GET /v1/oktoState: host, access_token, notification_token, URLs, public_key, balance, chaos and clock; {"active": false} when not activated
POST /v1/okto/activateActivates the organization's sandbox (201); if already active, 409 okto_already_active
POST /v1/okto/resetDeletes transactions, objects and notifications; keeps the token, URLs and RSA key and puts the clock back to real time
POST /v1/okto/sweepProcesses now whatever is due (expirations, scheduled charges, retries)
GET /v1/okto/waitWaits until a transaction, object or notification shows up (long poll)
GET /v1/okto/clockSandbox time (now) and offset (offset_ms)
POST /v1/okto/clock/advanceMoves the clock forward and processes what became due
GET /v1/okto/transactionsLists the money movements of every product
GET /v1/okto/transactions/{id}One movement
GET /v1/okto/objectsLists what isn't money (recurrences, enrollments, journeys, KYC…)
GET /v1/okto/objects/{kind}/{id}One object
GET /v1/okto/deliveriesLists notifications
GET /v1/okto/deliveries/{id}One notification, with body, signature and attempts
POST /v1/okto/deliveries/{id}/resendTries to deliver it again, right away
GET /v1/okto/actionsLists the actions with their parameters
POST /v1/okto/actions/{id}Runs an action
GET /v1/okto/chaosChaos 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 filterExample
typetype=deposit (deposit or withdraw)
flowflow=direct,smart (classic, dict, manual, automatic, biometric, direct, pix_by_key, pay_and_play, smart)
statusstatus=paid,failed (lowercase, as stored: created, overdue, paid, expired, failed, reversed, reversing, reviewing, processing, success)
id, external_idid=1268321722477579
sincesince=2026-10-21T19:00:00Z (updated since)
limit50 by default, up to 200
/objects filterExample
kindrecurrence, bio_enrollment, bio_journey, payer_account, smart_journey, smart_enrollment, pnp_journey, pnp_block, face_match, kyc_terms, kyc_query
statusstatus=AUTHORIZED (the product's status, as the API shows it)
id, since, limitas above
/deliveries filterExample
kinddeposit, withdraw, by_key_deposit, automatic_authorization, automatic_payment, biometric_enrollment, biometric_payment, biometric_journey, direct_payment, pay_and_play, face_match, kyc
eventthe announced status, for example event=paid
transaction_idid of the transaction or object
statuspending, success, failed or skipped
since, limitas 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.

bash
curl --url 'https://api.mimicr.dev/v1/okto/wait?on=delivery&transaction_id=1268321722477579&event=paid&timeout=30' \
  --header 'Authorization: Bearer mk_...'
bash
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

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

ActionParametersEffect
player.stepstep, 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.receivetaxId, amount (required, e.g. 25.00)A player sends Pix to the wallet key, like Mock a received Pix (v2)
deposit.refundid (required)The bank returns a deposit paid today to the payer (reversed, with a notification)
notification.testkind (required: deposit or withdraw)Sends a signed sample notification (Invoice paid or Transfer success) without touching the balance

Player steps

stepidEffect
deposit:paydepositPays the QR: paid, reviewing (closed loop) or failed per the test data
deposit:expiredepositThe deposit expires unpaid (expired)
withdraw:creditwithdrawalThe bank credits the player now (success) or refuses per the test data, without waiting the 15 seconds
withdraw:failwithdrawalThe bank refuses (failed, 2006)
direct:approvePix Direct paymentApproves at the bank (paid)
direct:rejectPix Direct paymentRefuses at the bank (failed, 4448)
automatic:authorizerecurrencePays the immediate charge and authorizes (AUTHORIZED)
automatic:payrecurrenceOnly pays the QR, without authorizing
automatic:rejectrecurrenceRefuses the authorization (REJECTED)
automatic:cancelrecurrenceThe payer cancels (CANCELLED)
biometric-enrollment:authorizeenrollmentAuthorizes the enrollment at the bank; then your application creates and validates the challenge
biometric-enrollment:revokeenrollmentRevokes the enrollment (revoked)
biometric-journey:paybiometric journeyPays with biometrics (paid)
biometric-journey:failbiometric journeyThe player refuses (failed, 4114)
biometric-journey:expirebiometric journeyThe journey expires (expired)
smart:approveSmart PIX journeyAuthorizes: creates the bank enrollment and pays
smart:rejectSmart PIX journeyRefuses (failed, 4448)
pay-and-play:payPay and Play journeyOnboards and pays the QR; the deposit waits for the operator to accept
pay-and-play:expirePay and Play journeyThe journey expires (expired)
face-match:selfieFace Match journeySends the selfie (success, or rejected per the test data)
face-match:giveupFace Match journeyGives 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

bash
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 then expired (+3 h with the default expiration).
  • 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

bash
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 }'
FieldMeaning
enabledTurns the product on or off
apiErrorRate% of calls that answer an error
apiErrorStatus500, 503 or 429
apiErrorWhenbefore (nothing is processed) or after (processes, then answers an error)
latencyMinMs, latencyMaxMsExtra 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

bash
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