Mirra’s control-plane HTTP API — sessions, scenarios, runs, webhooks, events.
Mirra’s control plane is a REST API at https://api.mirra.run. Everything the CLI does maps to an API call — and everything the dashboard shows is read through the same API.This page is the bare surface. The CLI and the Vitest plugin wrap it with better UX; reach for the raw API only when you’re building a custom integration.
Tears down ephemeral sessions (state cleared). For persistent sessions, ends the session and archives state — restore via snapshot if you need it back.
POST /v1/runsContent-Type: application/json{ "scenario": { "title": "Send Welcome Email on Signup", "setup": "A Resend account with one verified domain `mail.acme.com`…", "prompt": "When a user signs up with email `alice@example.com`…", "expectedBehavior": "The integration should create the email…", "criteria": [ { "tag": "check", "text": "Exactly 1 email is created in the Resend mirror" }, { "tag": "judge", "text": "Error handling for bounces is implemented" } ], "config": { "mirrors": ["resend"], "fixture": "resend:transactional-busy", "timeout": 60, "runs": 3 } }}
Alternatively, send the raw markdown as scenarioMarkdown and Mirra parses it server-side:
POST /v1/runsContent-Type: application/json{ "scenarioMarkdown": "# Send Welcome Email on Signup\n\n## Setup\n…"}
POST https://stripe-a7k2.mirra.run/_mirra/simulateContent-Type: application/json{ "event": "invoice.payment_failed", "subscription": "sub_Qzp"}
Fires a vendor event as if it occurred naturally. The simulation cascade — state changes, dependent webhooks, timers — runs exactly as it would for the real event. Valid event names are documented on each mirror’s page.
POST /_mirra/state/snapshot→ { "snapshotId": "snap_xyz" }POST /_mirra/state/restore{ "snapshotId": "snap_xyz" }
Snapshots are scoped to the session and the mirror. A 4-mirror session with 10 snapshots uses ~40 snapshot rows; each is a SQLite dump in object storage.
{ "error": { "code": "mirra.session.mirror_not_in_catalog", "message": "Unknown mirror 'github'. Not in the current catalog.", "hint": "See https://mirra.run/docs/mirrors/overview for supported mirrors." }}
Standard HTTP codes:
Code
When
400
Bad request — malformed body, invalid parameter
401
Missing or invalid token
402
Monthly minute quota exhausted and overage disabled
403
Token doesn’t have permission for this workspace
404
Resource (session, run, snapshot) not found
409
Conflict — session name already in use, snapshot already exists