Skip to main content
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.

Authentication

All requests require a bearer token:
Tokens are issued from app.mirra.run/settings/tokens. Scope them to a workspace (not global) and give them a descriptive name.

Base URL

All endpoints are HTTPS. Rate limits apply per workspace, documented in response headers:

Sessions

Create a session

string[]
required
Mirrors to provision. Must be names from the mirror catalog.
object
Map of mirror name → fixture name. Mirrors not listed use their default empty fixture.
boolean
default:"false"
Create a persistent session. Requires the Team plan or higher.
string
Human-readable session name. Required for persistent sessions. Ephemeral sessions auto-generate one if omitted.
integer
default:"3600"
Ephemeral-session auto-expire. Capped at your plan’s max session length.
Response:
string
Session identifier like ses_a7k2.
enum
provisioning initially, ready when all mirrors are up, failed on provisioning error.
object[]
One entry per provisioned mirror with vendor, url, and mirror version.
timestamp
timestamp
For ephemeral sessions only.
Example success body:

Get a session

Returns the same shape as create, plus a stats block with request count, webhook count, and error count since creation.

End a session

Tears down ephemeral sessions (state cleared). For persistent sessions, ends the session and archives state — restore via snapshot if you need it back.

List sessions

Paginated. Default sort: createdAt desc.

Scenarios and runs

Execute a scenario

Alternatively, send the raw markdown as scenarioMarkdown and Mirra parses it server-side:
Response:

Get a run

Returns progress while running, final verdict when complete:

Live events

Mirra publishes every request, webhook, state change, and lifecycle event to a per-session event stream. Subscribe via Server-Sent Events:
Response (streaming):
Five event types:
  • traffic.request_completed — after every mirror request
  • webhook.dispatched — when a webhook fires
  • state.changed — when mirror state mutates
  • session.lifecycle — start, end, reset, snapshot, restore
  • evaluation.criterion_graded — during scenario runs, as each criterion resolves
The Vitest plugin subscribes to this stream under the hood for waitForWebhook().

Admin endpoints (per mirror)

Every mirror exposes admin endpoints at /_mirra/* on its mirror URL (not the control plane):

Reset state

Resets this mirror’s state to the seed. seed is optional — defaults to whatever seed the session started with.

Simulate events

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.

Snapshot and restore (persistent sessions only)

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.

State dump

Returns the mirror’s current state as JSON. Used by the MCP server’s introspection tools and by the dashboard’s state view.

Metadata

Returns mirror name, version, target vendor API version, supported endpoints, webhook event types.

Errors

All errors follow a standard shape:
Standard HTTP codes:

Where to go next

CLI reference

The wrapper you probably want instead of raw HTTP.

Coding agents + MCP

How the MCP server wraps this same API for agents.