Guides
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.
curl --url https://api.mimicr.dev/v1/whatsapp \ --header 'Authorization: Bearer mk_...'
With the CLI (Node 18+):
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 path | Purpose |
|---|---|
GET /v1/whatsapp | The organization's sandboxes with slug, graph_base, app_id, app_secret, verify_token, callback_url, tokens, WABAs, numbers and clock |
POST /v1/whatsapp | Creates a sandbox: {"name", "business_name"?, "examples"?} (201). Handy for one sandbox per test run |
GET /v1/whatsapp/{slug} | One sandbox |
POST /v1/whatsapp/{slug}/reset | Deletes 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 path | Purpose |
|---|---|
GET /v1/whatsapp/{slug}/contacts | Test numbers |
POST /v1/whatsapp/{slug}/contacts | Creates 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}/reply | The customer sends a message (see below) |
POST /v1/whatsapp/{slug}/contacts/{wa_id}/read | The 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}/messages | The conversation as the device sees it (limit, default 50) |
GET /v1/whatsapp/{slug}/contacts/{wa_id}/otp/latest | Last authentication code received (404 if none) |
reply bodies:
type | Fields |
|---|---|
text | text, context.message_id?, referral (true or an object)? |
button | message_id and index, title or payload |
list | message_id, row_id |
flow | message_id, response_json |
reaction | message_id, emoji |
location | latitude, longitude, name?, address? |
contacts | contacts (Graph API format) |
image, video, audio, document, sticker | media_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 path | Purpose |
|---|---|
POST /v1/whatsapp/{slug}/messages/{wamid}/status | Forces 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/emit | Fires any field: {"field", "event"?, "value"?} |
PUT /v1/whatsapp/{slug}/phone-numbers/{id} | {"registered": false} or {"pin": "123456"} |
GET and POST /v1/whatsapp/{slug}/wabas | Lists or creates businesses ({"name", "display_phone_number"?}) |
Settings
| Method and path | Purpose |
|---|---|
GET and PUT /v1/whatsapp/{slug}/settings | mode, 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-rules | Simulated audience rules (upsert by name; DELETE ?name= or all) |
GET and POST /v1/whatsapp/{slug}/tokens | Tokens: {"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/rotate | New app secret |
PUT and DELETE /v1/whatsapp/{slug}/webhooks/callback | Verifies and saves {"url", "verify_token"}, or turns it off |
PUT /v1/whatsapp/{slug}/webhooks/fields | {"messages": true, "account_update": false} |
GET /v1/whatsapp/{slug}/webhooks | Last 50 deliveries |
POST /v1/whatsapp/{slug}/webhooks/{id}/resend | Resends a delivery now |
POST /v1/whatsapp/{slug}/webhooks/resend-failed | Resends the failed ones ({"template"?}) |
The mode, persona, OTP and chaos values are in Sandbox testing.
Clock and scheduled events
| Method and path | Purpose |
|---|---|
GET /v1/whatsapp/{slug}/clock | {now, offset_seconds} |
POST /v1/whatsapp/{slug}/clock/advance | Adds seconds, minutes, hours and days |
POST /v1/whatsapp/{slug}/clock/reset | Back to real time |
POST /v1/whatsapp/{slug}/tick | Processes 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.
| Parameter | Values |
|---|---|
on | message or webhook (required) |
timeout | Seconds, default 25, max 50 |
since | ISO date: only what was created from then on |
wa_id, direction, type, status | With on=message. direction=outbound is what your app sent, inbound what the customer sent |
field, status, wamid | With on=webhook. Delivery status: pending, success, failed, skipped |
Filters take several comma-separated values.
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
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