Guides
Mimicr

Sandbox control

Mimicr's control API, the /_sim/v1 routes, the CLI and the MCP to act as the customer and as Meta, wait for events, move the clock and inject failures.

The Graph API only lets you act as the business. To test end to end, Mimicr also lets you act as the customer (write, tap buttons, read, stop marketing) and as Meta (review templates, force statuses, fire account events). It all lives in the control API, at https://api.mimicr.dev/v1/whatsapp, 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; everything else needs a write key.

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

With the CLI (Node 18+):

bash
npx mimicr login mk_...
npx mimicr status whatsapp

The key can also come from --key or the MIMICR_API_KEY variable. Output is JSON and the exit code is 1 on HTTP errors. In CLI commands, the product is whatsapp:<slug>.

/_sim/v1 routes with the sandbox token

The same per-sandbox routes also answer on the Graph API host, at https://whatsapp.mimicr.dev/_sim/v1/..., authenticated with the sandbox token instead of the organization key (replace /v1/whatsapp/{slug} with /_sim/v1). Only tokens, app secret and callback are left out (403), and wait only exists in the control API.

Sandboxes

Method and pathPurpose
GET /v1/whatsappThe organization's sandboxes with slug, graph_base, app_id, app_secret, verify_token, callback_url, tokens, WABAs, numbers and clock
POST /v1/whatsappCreates a sandbox: {"name", "business_name"?, "examples"?} (201). Handy for one sandbox per test run
GET /v1/whatsapp/{slug}One sandbox
POST /v1/whatsapp/{slug}/resetDeletes messages, media and webhooks, puts the clock back to real time and the OTP scenario back to happy. With no body, also deletes contacts, templates, Flows and audience rules (only hello_world remains; {"examples": true} recreates the samples); with {"keep_content": true} it keeps contacts and templates

Test customer

Method and pathPurpose
GET /v1/whatsapp/{slug}/contactsTest numbers
POST /v1/whatsapp/{slug}/contactsCreates or updates: {"wa_id", "profile_name"?, "persona"?, "rules"?} (201)
GET /v1/whatsapp/{slug}/contacts/{wa_id}One number, with the persona rules
PUT /v1/whatsapp/{slug}/contacts/{wa_id}Any subset of profile_name, persona, has_whatsapp, marketing_opt_out, rules
DELETE /v1/whatsapp/{slug}/contacts/{wa_id}Removes the number
POST /v1/whatsapp/{slug}/contacts/{wa_id}/replyThe customer sends a message (see below)
POST /v1/whatsapp/{slug}/contacts/{wa_id}/readThe customer reads everything the business sent (read for each message)
POST /v1/whatsapp/{slug}/contacts/{wa_id}/preferences{"value": "stop"} or resume: user_preferences webhook
GET /v1/whatsapp/{slug}/contacts/{wa_id}/messagesThe conversation as the device sees it (limit, default 50)
GET /v1/whatsapp/{slug}/contacts/{wa_id}/otp/latestLast authentication code received (404 if none)

reply bodies:

typeFields
texttext, context.message_id?, referral (true or an object)?
buttonmessage_id and index, title or payload
listmessage_id, row_id
flowmessage_id, response_json
reactionmessage_id, emoji
locationlatitude, longitude, name?, address?
contactscontacts (Graph API format)
image, video, audio, document, stickermedia_id or data (base64) + mime_type; filename, caption, voice

All of them accept phone_number_id to pick the business number. The response is 201 with messages[0].id (the wamid) and the message.

Meta's role

Method and pathPurpose
POST /v1/whatsapp/{slug}/messages/{wamid}/statusForces sent, delivered, read, played or failed (with error_code)
POST /v1/whatsapp/{slug}/templates/{id}/review{"action": "approve"}, reject (reason), pause, disable, reinstate, quality (quality), recategorize (category)
POST /v1/whatsapp/{slug}/webhooks/emitFires any field: {"field", "event"?, "value"?}
PUT /v1/whatsapp/{slug}/phone-numbers/{id}{"registered": false} or {"pin": "123456"}
GET and POST /v1/whatsapp/{slug}/wabasLists or creates businesses ({"name", "display_phone_number"?})

Settings

Method and pathPurpose
GET and PUT /v1/whatsapp/{slug}/settingsmode, otp_scenario, chaos, throughput_mps, messaging_limit, clock_speed (any subset; chaos keys are merged with the current ones)
GET, POST and DELETE /v1/whatsapp/{slug}/audience-rulesSimulated audience rules (upsert by name; DELETE ?name= or all)
GET and POST /v1/whatsapp/{slug}/tokensTokens: {"label", "waba_id"?}
DELETE /v1/whatsapp/{slug}/tokens/{id or token}Revokes (the Graph API starts answering 190/460)
POST /v1/whatsapp/{slug}/app-secret/rotateNew app secret
PUT and DELETE /v1/whatsapp/{slug}/webhooks/callbackVerifies and saves {"url", "verify_token"}, or turns it off
PUT /v1/whatsapp/{slug}/webhooks/fields{"messages": true, "account_update": false}
GET /v1/whatsapp/{slug}/webhooksLast 50 deliveries
POST /v1/whatsapp/{slug}/webhooks/{id}/resendResends a delivery now
POST /v1/whatsapp/{slug}/webhooks/resend-failedResends the failed ones ({"template"?})

The mode, persona, OTP and chaos values are in Sandbox testing.

Clock and scheduled events

Method and pathPurpose
GET /v1/whatsapp/{slug}/clock{now, offset_seconds}
POST /v1/whatsapp/{slug}/clock/advanceAdds seconds, minutes, hours and days
POST /v1/whatsapp/{slug}/clock/resetBack to real time
POST /v1/whatsapp/{slug}/tickProcesses due events now ({processed})

In the CLI: npx mimicr clock whatsapp:docs +25h (+30m, +2h, +1d).

Wait

GET /v1/whatsapp/{slug}/wait answers as soon as something matches the filters, or 408 wait_timeout. While waiting, it processes due events every second.

ParameterValues
onmessage or webhook (required)
timeoutSeconds, default 25, max 50
sinceISO date: only what was created from then on
wa_id, direction, type, statusWith on=message. direction=outbound is what your app sent, inbound what the customer sent
field, status, wamidWith on=webhook. Delivery status: pending, success, failed, skipped

Filters take several comma-separated values.

bash
npx mimicr wait whatsapp:docs message wa_id=5511987654321 direction=outbound
npx mimicr wait whatsapp:docs webhook field=message_template_status_update --timeout 50

MCP server

Agents can use https://api.mimicr.dev/mcp (Streamable HTTP, same mk_… key). The tools cover overview, reference, control API calls, calls to the simulated Graph API, wait and clock; for WhatsApp, pass the sandbox (the slug). npx mimicr mcp prints the command to connect it in Claude Code and the JSON for other clients.

End-to-end test example

bash
SLUG=$(npx mimicr sandbox create "CI $GITHUB_RUN_ID" | jq -r .slug)
npx mimicr put /v1/whatsapp/$SLUG/webhooks/callback url=https://ci.example.com/webhooks/whatsapp verify_token=meu-token-de-verificacao
npx mimicr post /v1/whatsapp/$SLUG/contacts wa_id=5511999990000 profile_name=Ana
SINCE=$(date -u +%Y-%m-%dT%H:%M:%SZ)
npx mimicr post /v1/whatsapp/$SLUG/contacts/5511999990000/reply type=text text="quero comprar"
# your app receives the webhook and answers through the Graph API
npx mimicr wait whatsapp:$SLUG message wa_id=5511999990000 direction=outbound since=$SINCE