MicroVM PlatformDocumentation and API reference
OpenAPI fileOpen the console

Build on MicroVM Platform

A private MicroVM for each of your users: started in milliseconds, paused and resumed with nothing lost, never shared. This page is the whole of it: how to integrate, and every API operation.

Overview

What the platform does

Everything the platform offers, in one screen. Each row leads to where it is explained: the guide for how to use it and design around it, the reference for every option and error.

Sessions

FeatureWhat it doesWhere it is described
A private MicroVM for each sessionEach user session gets its own isolated MicroVM, never one that another session has usedGuide 1 · Reference 2.1
Fast startA session starts from a queue of ready MicroVMs in millisecondsGuide 3 · Reference 2.2
Pause and resumeStops a session in milliseconds and brings it back exactly as it was, with nothing lostGuide 3 · Reference 2.5
Pause when idle, wake on requestA session pauses by itself after a quiet period and wakes on the next requestReference 2.14
Recovery and timed savesA session whose MicroVM stops is brought back from its last saved point; a running session can be saved on a timerGuide 5.5 · Reference 2.13
A copy of a sessionStarts a new session as an exact copy of a paused oneGuide 4.4 · Reference 2.15
Its own sizeGives one session more memory, or a processor limit, than its queue's standardReference 2.2

Using a session

FeatureWhat it doesWhere it is described
The session's own addressSends requests straight to the software running in the sessionGuide 4.1 · Reference 3.2
Run a commandRuns a command inside a session and returns its outputGuide 4.3 · Reference 3.3
Files in and outPuts a file into a session or takes one outGuide 4.3 · Reference 3.4
SecretsHands secrets to a session as files at its start; the platform does not keep themGuide 4.3 · Reference 3.5
The built-in browser agentOpens pages, signs in and takes screenshots in the ready-made browser sessionsGuide 4.2 · Reference 3.1
What a session may reachSets what a queue's sessions may reach on the internet; one session can narrow it furtherGuide 6.3 · Reference 5.1

Files and prepared environments

FeatureWhat it doesWhere it is described
VolumesA folder that outlives a session and is there in the user's next one, with a choice of quickest or safest writesGuide 4.5 · Reference 3.6
Named saved statesKeeps a paused session under a name; any number of new sessions start from itGuide 4.6 · Reference 3.7

Seeing what happened

FeatureWhat it doesWhere it is described
A terminal, live and replayedA shell in a session that several people can watch and type into at once; what it showed can be replayed for 30 daysGuide 4.7 · Reference 3.8
Recording of a sessionRecords every program started, file opened and network connection, from outside the session, with pictures of its screen where it has oneGuide 4.8 · Reference 3.9
Session healthSays whether a session is short of memory or waiting for a processor, and whose it is to fixGuide 8.1 · Reference 2.8
Live and ended sessionsEvery live session's figures at once, and ended sessions' figures and events afterwardsGuide 8.1 · Reference 2.11
What the session's software printedThe last lines a session's software wroteReference 2.10
Audit trailEvery request: who made it, from where, the result and how long it tookGuide 8

Queues and capacity

FeatureWhat it doesWhere it is described
Built-in queuesThree ready-made queues: an empty MicroVM, one with a web agent, one with a browser openGuide 2 · Reference 4.1
Queues of your own imagesRegistering an image creates a queue of your own that keeps MicroVMs of it readyGuide 6 · Reference 5.1
SchedulesMakes a queue larger ahead of a peak you know is coming, every week or onceGuide 7 · Reference 4.2

Account and control

FeatureWhat it doesWhere it is described
API keysKeys with a role, an expiry, the addresses they may be used from and a monthly capGuide 8 · Reference 6.1
Company loginYour people sign in to the console with your own identity provider, each with a roleGuide 8.4 · Reference 7.1
Quotas for your own usersLimits each of your users to minutes a day and sessions at onceGuide 8.5 · Reference 6.7
UsageUsage by day, by label and by API keyGuide 8 · Reference 6.4
Budget and label quotasA monthly budget with alerts; a label's limit can refuse new sessions once it is reachedGuide 8.3 · Reference 6.5
ReportsUsage and budget reports on request, on a schedule or as use grows, by email or to your own addressGuide 8.5 · Reference 6.6
Events pushed to youSession, budget and key events sent to an address of yours, signedGuide 8.2 · Reference 6.3
Your own monitoringFigures, events and traces sent to your own monitoring systemGuide 8.1 · Reference 6.2
Your own encryption keySeals saved states and recordings under a key you give and can withdrawGuide 8.5 · Reference 6.8

Ways in

FeatureWhat it doesWhere it is described
ConsoleA web console for all of the aboveGuide 9
Every call, ready to copyEach operation as one complete call with every option, tested before it is publishedReference 10
Client libraries and a command-line toolFor JavaScript and Python, and from your own terminalGuide 9.1 · Reference 9

Integration guide

How to use the platform and build it into your application. For every field and error code, see the API Reference.

#1. What the platform gives you

Each of your users gets a private machine, called a MicroVM, that runs your software or a browser. Your application controls it through a small API.

You canTypical time
Start a session for a user7 ms
Pause it when the user is idle16 ms
Resume it exactly as it was14 ms
End itabout 10 ms

Times are measured inside the platform. The time your request spends on the network is extra. At least 99 in 100 starts, pauses and resumes finish within 50 ms.

Three properties to rely on:

  • Private. A MicroVM serves one session and is then destroyed. It is never shared with another user and never reused.
  • Nothing is lost on pause. Memory, open pages, logins, and even text typed but not sent come back exactly.
  • You pay attention to sessions, not machines. The platform keeps MicroVMs ready and adds capacity by itself.
Your usersPeople using your product,each with their own sessionYour applicationHolds your API key.Starts, pauses, resumes andends a session for each user.The MicroVM platformOne address, one APIEvery request carries your API keyPoolsReady MicroVMs,one pool for each kindSessionsOne private MicroVM each.Never shared, never reusedHTTPSYour own systemsReached by a session only ifits outbound rule allows itoutbound: none, internet, or a listA start takes a MicroVM from a pool. The platform keeps each pool full by itself.
How your application, the API and your users' sessions fit together

#2. The ideas, in one page

IdeaWhat it means for you
SessionOne user's MicroVM, from start to end. You hold its ID
PoolA set of ready MicroVMs of one kind. A start takes one from a pool
ImageYour own container image. Register it once and it gets a pool of its own
PauseThe session stops exactly where it is. Nothing runs inside it. It is also saved in two copies in the background
ResumeThe session carries on exactly where it stopped. Within about five minutes of a pause it resumes in milliseconds; later, in a few hundred milliseconds
Session's own addressA web address that reaches your software inside the session, for HTTP and WebSocket

A session is in one of these states: running, paused, resuming, failed, terminated.

startPOST /v1/sessionsrunningin usepausednothing runsterminatedended; MicroVM destroyedfailedlost; see "reason"resumingtakes a little longer7 mspause16 msresume14 msresume, after a few minutes pausedabout 0.3 sits machine failedend (DELETE)endTimes are typical values measured inside the platform. A pause or a resume that is repeated answers "ok" with already: true.
The states of a session, and the typical time of each change

#3. Quick start

You need the platform's address and an API key. Keep the key in a secret store, never in code.

export BASE=https://<your-platform-address>
export KEY=<API key>

# 1. Start a session
curl -s -X POST $BASE/v1/sessions -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: $(uuidgen)" -d '{"pool": "browser-ready", "label": "user-42"}'
# -> {"id": "ses-6bf349e68de3", "state": "running", ...}

# 2. Pause it when the user goes idle
curl -s -X POST $BASE/v1/sessions/ses-6bf349e68de3/pause -H "Authorization: Bearer $KEY"

# 3. Resume it when the user returns
curl -s -X POST $BASE/v1/sessions/ses-6bf349e68de3/resume -H "Authorization: Bearer $KEY"

# 4. End it
curl -s -X DELETE $BASE/v1/sessions/ses-6bf349e68de3 -H "Authorization: Bearer $KEY"

Check the service and your limits at any time:

curl -s $BASE/v1/status  -H "Authorization: Bearer $KEY"
curl -s $BASE/v1/account -H "Authorization: Bearer $KEY"

#4. Two ways to use a session

#4.1 Your own software, through the session's own address

This is the normal way. Your image runs your software, listening on one port. Everything you send to

$BASE/v1/sessions/<session id>/proxy/<any path>

is passed to that port inside the session's MicroVM, with any method, headers and body up to 16 MB. The answer comes back unchanged. WebSocket connections pass too, so you can drive a browser or stream events.

  • Send your API key as usual. It is checked and removed before the request reaches your software.
  • A paused session is woken by the request itself, if the session was started to wake on request (the default whenever idlePauseSeconds is set: API reference, section 2.14). The request is held for the few tens of milliseconds the waking takes and is then answered as usual, so your application needs no "wake up" step: it simply sends its requests. Looking at a session (GET/v1/sessions/<id>, its figures, its recording) does not wake it and does not keep it awake.
  • A session started with "autoResume": false, or one you paused yourself without an idle time set, answers 409 not_running until you resume it.
  • Send these requests from your own application, with your API key. Never give the key to a user's browser or device: whoever holds it can start, end and read your sessions. Your users talk to your application; your application talks to the session.
curl -s $BASE/v1/sessions/ses-6bf349e68de3/proxy/health -H "Authorization: Bearer $KEY"

#4.2 The built-in demonstration agent

The pools agent-ready and browser-ready run a demonstration agent that drives a browser against a demonstration shop. Use it to try the platform before your own image is ready. Its tasks are open, login, add, draft, order, state and screenshot:

curl -s -X POST $BASE/v1/sessions/ses-6bf349e68de3/actions/state -H "Authorization: Bearer $KEY" -d '{}'

#4.3 Commands, files and secrets

Three operations work on any session, whatever image it runs, without your software having to offer an endpoint for them:

NeedOperation
Run a program inside the session and get its output and exit statusPOST/v1/sessions/{id}/exec with {"command": ["python3", "job.py"]}
Put a file in, or take one out (up to 16 MB)PUT and GET/v1/sessions/{id}/files?path=/tmp/input.json
Give one session its own user's credentials"secrets": {"API_TOKEN": "..."} when starting it. Inside the session they are files at /run/secrets/API_TOKEN, readable only by your software

Secrets are what lets one image serve every user: the image holds no credentials, and each session is handed its own when it starts. The platform passes them through and does not keep them. They are part of the session's memory from then on, so they survive a pause, and a copy of the session has them too.

All three need a shell (sh) in the image.

#4.4 Starting from where another session stopped

POST/v1/sessions/{id}/fork starts a second session that begins as an exact copy of the first one's saved state: the same pages open, the same sign-ins, the same files. From then on the two are separate.

Uses: try several continuations from one prepared state; keep a "golden" session that is signed in and set up, paused, and start each user's session as a copy of it; reproduce a problem on a copy while the user carries on. The session copied from must be paused with its snapshot saved, or be a running session that has a recovery point. A copy takes a few tenths of a second, and is counted as a session like any other.

#4.5 Files that stay: volumes

A session's own disk lives in its memory and is gone when the session ends. A volume is the part that stays. Give each user a volume named after them and start their sessions with it:

curl -s -X POST https://<your-platform-address>/v1/sessions -H "Authorization: Bearer <API key>" \
  -d '{"pool": "my-agent", "label": "user-42", "volume": "user-42-home", "idlePauseSeconds": 300}'

Inside the session the user's files are at /volumes/user-42-home. End the session, start another next week on a different machine, and they are there. Register the image with "storage": true to allow this.

What to know when designing around it:

One session holds a volume at a timeDesign for one session a user. A second start for the same user is refused until the first has ended
Put in the volume what must last; leave the rest on the session's own diskThe session's own disk is faster, and nothing there costs storage
Choose the mode by what the data issafe (the default) for documents, databases, anything the user would miss. fast for caches and build folders: several times quicker for software that forces its writes, at the price that the last seconds can be lost with a machine
Many small files are slow in safe modeUnpacking a package of thousands of files takes much longer than on a local disk. Do that on the session's own disk, or in a fast volume
A recovered session's volume goes back with itAfter session_recovered, the files are as they were at the moment the session went back to, like its memory. If that is wrong for your data, set rollBack: false on the volume

#4.6 A prepared environment: named saved states

Prepare a session once (software loaded, a model warmed up, a user signed in), pause it, and keep its saved state under a name. Any number of new sessions can then start from it, each a separate copy of the session as it was, today or next month.

curl -X POST https://<your-platform-address>/v1/sessions/$ID/pause -H "Authorization: Bearer <API key>"
curl -X POST https://<your-platform-address>/v1/sessions/$ID/save  -H "Authorization: Bearer <API key>" -d '{"name": "prepared"}'
curl -X POST https://<your-platform-address>/v1/sessions           -H "Authorization: Bearer <API key>" -d '{"fromState": "prepared", "user": "user-42"}'

A start from a named saved state takes a few hundred milliseconds rather than a few, because the state is fetched first: use it for environments that are costly to prepare, and an ordinary queue where a fresh session will do. API reference, section 3.7.

#4.7 Seeing a session: a terminal, live and replayed

Start a session with "terminal": true and you can open a shell in it, from the console, the API, or your own terminal with the small program in the API reference. Several of your people can be in the same terminal and see the same thing, which suits support and teaching. Everything a terminal showed is kept as a recording for 30 days and can be played back.

Design points:

  • It is off unless the session asks for it at its start. Decide per session: for example, on for sessions your support team may need to join, off for the rest.
  • A key with the read role can watch and replay but not type. Give your support staff read keys.
  • Whoever watches is named in your audit trail and on the recording.
  • The recording holds what the terminal showed, commands included. What it did not show as it was typed (a password) is not in it.

API reference, section 3.8.

#4.8 Recording what happens inside a session

Start a session with "record": true and the platform writes down, from outside the session, every program it starts (with its arguments), every file it opens or makes, and every network connection it attempts, each with its time, the program that did it and the user it ran as. Where the session has a screen (a virtual display your software starts, or the browser of the service's own browser queue), it also keeps pictures of the screen whenever it changes.

curl -s -X POST https://<your-platform-address>/v1/sessions -H "Authorization: Bearer <API key>" \
  -d '{"pool": "my-agent", "user": "user-42", "record": true}'
curl -s "https://<your-platform-address>/v1/sessions/$ID/recording?kind=run,connect" -H "Authorization: Bearer <API key>"

Why it is useful, and how to design around it:

  • Nothing to add to your image. It works whatever runs in the session, and nothing inside the session can switch it off, see it or change it. That is what makes it usable as evidence of what a user or an agent did.
  • It records what was done, not the contents. Not what is inside a file, not what was sent, and never a program's environment. A secret passed as a command's argument is recorded, so pass secrets in the environment or in files (section 4.3).
  • Choose which sessions to record. A recorded session starts about 15 ms slower; sessions you do not record are not affected. Record where you need the evidence: agents acting for a user, privileged work, a sample for quality.
  • Follow a running session by asking again with after set to the last number you have; read an ended one for 30 days by its session id.
  • Recordings are yours. They are kept encrypted (under your own key too, if you have given one: section 8.5), your read-only users can read them, and the service's operators cannot.

API reference, section 3.9.

#5. How your client should behave

  1. User arrives. Start a session with an Idempotency-Key that is unique to this attempt. Store the session ID against the user.
  2. User is active. Send requests to the session's own address.
  3. User goes idle. Pause the session. A paused session costs less to hold and loses nothing.
  4. User returns. Resume the session, then continue.
  5. User leaves. End the session. Do not leave sessions to expire: each one counts against your limit of sessions at once.

The shorter way: let the platform do steps 3 and 4. Start the session with "idlePauseSeconds": 300 and it is paused by itself once five minutes pass without a request, and woken by the next request, which is then served as usual. Your code neither pauses nor resumes; it only starts and ends. The waking request waits for the resume: 10 to 20 ms if the pause was under five minutes ago, about a quarter of a second after that. Use the explicit calls when you know better than a timer when a user has gone, and the automatic way when you do not want to track it.

#5.2 Timeouts and retries

RuleWhy
Set a client timeout of a few seconds on start, pause, resume and endThey normally take milliseconds; a longer wait means something is restarting
On a Retry-After header, wait that many seconds, then double the wait on each further try, up to about 30 seconds in all, with a little randomnessSo that many clients do not retry at the same instant
Always send Idempotency-Key on startIf the reply is lost, a retry returns the same session instead of making a second one
Use a new key for each new sessionFor a day, the same key always returns the session it first made, with "repeated": true, even after that session has ended. A key is for retrying one start, not for naming a user
Repeat a pause or resume freelyA pause of a paused session, or a resume of a running one, answers 200 with already: true
Treat a network error like unavailableRetry with the same rules
Send the requestwith a timeout of a few secondsAnswer 200Done"Ask again shortly"503 no_capacity, unavailable409 busy 429 rate_limitedWaitRetry-After seconds, thendouble it each timeAny other error400, 401, 403, 404, most 409s,429 limit_reachedDo not retryAct on error.codeGive upafter about 30 stry againSend an Idempotency-Key when starting a session, so that a retry after a lost reply returns the same session.
How a client should retry

#5.3 Connections: getting the best out of the platform

How your application connects matters as much as what it sends. A start that takes 7 ms on the platform takes several times that if your client opens a new secure connection for it first.

DoWhy
Reuse connections (keep-alive). Create one HTTP client when your application starts, and use it for every requestOpening a secure connection costs two to three round trips before your request is even sent. A reused connection costs none. Most HTTP libraries reuse connections if you keep one client object; they do not if you make a new client for each request
Keep a pool sized to your concurrency, not to your usersA connection carries one request at a time. You need about as many connections as you have requests in flight at the same moment, which is far fewer than your users: about 4 connections for every 100 active users in our own measurements
Call the platform from your servers, close to itEach request's time, as you see it, is the platform's time plus the network between us. From the same region that adds a few milliseconds
Let idle connections be closed, and expect itA connection that has been idle may be closed by either side. A good client opens another without your code noticing; make sure yours retries a request whose connection was closed under it
After any failure, reconnect with a random delayIf the service restarts, every client reconnects. Spread over a few seconds that is nothing; all in the same instant it is a surge. Wait a random time between 0 and a few seconds before reconnecting, and longer on each further failure
Do not open a connection per user from end users' devices unless you have told usA long-lived connection for every user, such as a WebSocket from each device straight to its session, is a different load from the one above. It works, but tell us first so the entry point is sized for it

What to avoid:

  • A new HTTP client, or a new connection, for each request.
  • Retrying at once, in a tight loop, after a refused or failed connection.
  • A very short idle timeout on your side, which throws away connections you are about to need.

A quick check: your client's count of connections opened should stay nearly flat while your request count climbs. If the two rise together, connections are not being reused.

In Node.js the built-in fetch reuses connections by itself. In Python, use one requests.Session() or httpx.Client() for the life of the process, as in the example below, not requests.post(...) for each call. In Java, share one HttpClient. In Go, share one http.Client and always read and close the response body.

#5.4 What each "not now" answer means

AnswerMeaningYour client should
503 no_capacityEvery machine is full at this moment and more are being addedWait and retry. Show the user "preparing your session"
503 unavailable, 503 node_unavailableA part of the service is restarting. Your session is intactWait and retry
409 busyAnother change to the same session is in progressRetry in a second
429 rate_limitedYou are sending more requests per second than your account allowsSlow down
429 limit_reachedYou have as many sessions as you are allowed at onceDo not retry. End idle sessions, or ask for a higher limit

#5.5 When a session is lost

A running session lives in the memory of one machine. If that machine fails, or the software inside crashes the whole MicroVM, one of two things happens:

The sessionWhat the platform doesWhat your client sees
Has been paused at least once (or is saved on a timer)Brings it back by itself, within a second or two, exactly as it was at that pause or save. What was done inside it afterwards is lostThe request that met the stopped MicroVM gets 409 session_recovered: send it again. The session shows recoveredAt and stateAsOf
Has never been paused or savedNothing to bring back: its state becomes failed409 session_failed. Start a new session for the user

Two things follow for your design. First, a recovered session has gone back in time, but only inside itself: whatever your software wrote to your own database or another service is still there. Make sure a session that is behind your other systems does no harm, for example by having it re-read what it needs after session_recovered. Second, if going back in time is worse for your software than failing, switch recovery off for that image (recover: false). If losing even the time since the last pause is too much, have running sessions saved on a timer (saveEverySeconds): each save freezes the session for about a tenth of a second per 90 MB of memory in use.

A paused session is safer. Once its snapshot is ready with two copies (a few seconds after the pause), it survives the loss of a machine and resumes from a saved copy.

at oncePausedThe session stops where itstands. Your reply is sent.Not yet protected.a few seconds laterSaved, in two copiesIts memory is saved, encrypted,on two machines. It now survivesthe loss of a machine.a few minutes laterMemory releasedOnly the saved copies remain.A resume now takes about 0.3 sinstead of milliseconds.What happens after you pause a sessionsnapshot.status in the session shows "saving", then "ready"; snapshot.copies shows how many copies exist.
What happens after a pause

Design for this: keep anything you cannot afford to lose in your own systems, and pause sessions that are not in active use.

#5.6 Example: JavaScript

const BASE = process.env.PLATFORM_URL, KEY = process.env.PLATFORM_KEY;
const sleep = ms => new Promise(r => setTimeout(r, ms));
const RETRY = new Set(['no_capacity', 'unavailable', 'node_unavailable', 'busy', 'rate_limited']);

async function call(method, path, body, headers = {}) {
  let wait = 0;
  for (let attempt = 0, spent = 0; ; attempt++) {
    let res, data;
    try {
      res = await fetch(BASE + path, { method, signal: AbortSignal.timeout(5000),
        headers: { authorization: 'Bearer ' + KEY, ...headers }, body: body ? JSON.stringify(body) : undefined });
      data = await res.json().catch(() => ({}));
      if (res.ok) return data;
    } catch (e) { data = { error: { code: 'unavailable' } }; }
    const code = data.error && data.error.code;
    if (!RETRY.has(code) || spent > 30000) throw Object.assign(new Error(code), { code, requestId: data.error && data.error.requestId });
    const hinted = res && +res.headers.get('retry-after') * 1000;
    wait = Math.min(8000, hinted && attempt === 0 ? hinted : Math.max(500, wait * 2)) * (0.8 + Math.random() * 0.4);
    await sleep(wait); spent += wait;
  }
}

const start  = (user, attempt) => call('POST', '/v1/sessions', { pool: 'browser-ready', label: user }, { 'idempotency-key': `${user}-${attempt}` });
const pause  = id => call('POST', `/v1/sessions/${id}/pause`);
const resume = id => call('POST', `/v1/sessions/${id}/resume`);
const end    = id => call('DELETE', `/v1/sessions/${id}`);

#5.7 Example: Python

import os, time, random, requests

BASE, KEY = os.environ["PLATFORM_URL"], os.environ["PLATFORM_KEY"]
RETRY = {"no_capacity", "unavailable", "node_unavailable", "busy", "rate_limited"}

HTTP = requests.Session()   # one for the life of the process: it keeps connections open and reuses them

def call(method, path, body=None, headers=None):
    wait, spent, attempt = 0.0, 0.0, 0
    while True:
        res, code, data = None, "unavailable", {}
        try:
            res = HTTP.request(method, BASE + path, json=body, timeout=5,
                                   headers={"Authorization": "Bearer " + KEY, **(headers or {})})
            data = res.json() if res.content else {}
            if res.ok:
                return data
            code = data.get("error", {}).get("code")
        except requests.RequestException:
            pass
        if code not in RETRY or spent > 30:
            raise RuntimeError(f"{code} (request {data.get('error', {}).get('requestId')})")
        hinted = float(res.headers.get("Retry-After", 0)) if res is not None else 0
        wait = min(8.0, hinted if hinted and attempt == 0 else max(0.5, wait * 2)) * random.uniform(0.8, 1.2)
        time.sleep(wait); spent += wait; attempt += 1

def start(user, attempt):  return call("POST", "/v1/sessions", {"pool": "browser-ready", "label": user}, {"Idempotency-Key": f"{user}-{attempt}"})
def pause(sid):            return call("POST", f"/v1/sessions/{sid}/pause")
def resume(sid):           return call("POST", f"/v1/sessions/{sid}/resume")
def end(sid):              return call("DELETE", f"/v1/sessions/{sid}")

#6. Bringing your own image

#6.1 Register it

curl -s -X POST $BASE/v1/images -H "Authorization: Bearer $KEY" -d '{
  "name": "my-agent",
  "image": "registry.example.com/team/agent:1.4",
  "port": 8080,
  "readyPath": "/health",
  "memoryMb": 1024,
  "ready": 10,
  "registry": {"username": "pull-only", "password": "<registry password>"},
  "outbound": {"allow": ["api.example.com:443"]}
}'

Then watch GET/v1/images until status is ready. If it is failing, problem says what to change. Start sessions from it with "pool": "my-agent".

#6.2 What your image must do

RuleWhy
Listen on one port, on all addresses (0.0.0.0)That port is what the session's own address reaches
Report ready as soon as it can serve a request (readyPath)The platform hands a MicroVM over only once it is ready
Tolerate being stopped and continued at any momentThat is what pause and resume do
Create nothing unique before it reports readySessions of your image may begin from the same prepared state. Random identifiers, keys and tokens made before your software reports ready could then be the same in more than one session. Make them on a session's first request
Expect connections opened before ready to be closedOpen connections to other services on first use, or reconnect
Keep per-user secrets out of envEvery session of the image gets the same environment

If your image cannot meet the two rules in bold, register it with "copyFromTemplate": false. Each MicroVM of it then takes as long to prepare as your software takes to start. Keep a larger pool (ready) to make up for it.

#6.3 What it may reach on the internet

Chosen with outbound when you register the image:

ValueMeaning
"none" (default)Nothing
"internet"Any public address on ports 80 and 443, with name lookups
{"allow": ["host:port", ...]}Only those destinations: a name, an address or a range, 1 to 50 of them

In every case a MicroVM cannot reach other MicroVMs, the platform's own network, or any private address range.

#6.4 Making your image start fast

A session normally comes from a pool in a few milliseconds whatever your image contains. What is in your image matters in two places: when a pool is empty and a MicroVM has to be made on the spot, and in how quickly a pool refills after a burst.

The less memory in use and the fewer processes running at the moment your software reports ready, the quicker a MicroVM of your image is prepared.

  • Report ready as soon as you can serve a first request, and no later.
  • Load ahead only what every session needs. Leave large data, caches and optional libraries to first use.
  • Start as few processes as you can before reporting ready.
  • Set memoryMb to what one session really needs. It decides how many sessions fit on a machine.

#6.5 Updating an image

Send POST/v1/images again with the same name. MicroVMs still waiting are replaced with the new version. Sessions already running finish on the version they started from. Pin a tag or a digest, so that you always know which version is running.

#7. Capacity

QuestionAnswer
How many MicroVMs are ready right now?GET/v1/pools: ready for each pool
What if many users arrive at once?Pool sizes follow demand automatically and rise within a second of a surge
What if I know a peak is coming?Book it with a schedule (below). Capacity is brought up a few minutes early
What if a pool is empty?A MicroVM from another pool is handed over, or one is made on request. Both take longer than a normal start. The reply says so: servedFrom, or fromPool: false
What does no_capacity mean?Every machine is full at that moment. More are being added. Retry

Booking a peak

# Every weekday morning, keep 500 browser sessions ready
curl -s -X POST $BASE/v1/schedules -H "Authorization: Bearer $KEY" -d '{
  "pool": "browser-ready", "target": 500,
  "days": [1,2,3,4,5], "from": "08:30", "to": "11:00", "timezone": "Asia/Kolkata", "label": "morning peak"}'

Your limits. GET/v1/account shows the most sessions you may have at once, your requests per second, the longest a session may live, and the largest pool size a schedule may ask for. A session counts against the first limit whether it is running or paused, until it ends.

#8. Usage, audit and keys

NeedOperation
What was used, per dayGET/v1/usage: sessions started and ended, time running and paused, snapshot storage
Who did whatGET/v1/audit: every change and refused request, with the key used and its name, the result and the caller's address, for 30 days. Filter it by key, session, operation, period, or failures only
What was used this month, by team or by systemGET/v1/usage/summary: the account, each label and each key, in hours and, where prices are agreed, in money
A key for another systemPOST/v1/keys with a label (its name, shown in the audit trail), a role (admin, developer or read) and optionally an expiry, the addresses it may be used from, and a monthly cap. The key is shown once
Remove a keyDELETE/v1/keys/{id}. It stops working everywhere within 15 seconds
Be told when something happensPUT/v1/webhooks: events pushed to your own address (section 8.2)
Keep spending in boundsPUT/v1/budget: alerts at 50, 80 and 100 per cent, and optionally a stop (section 8.3)
Let your people into the console with their company accountsPUT/v1/signin (section 8.4)

Use one key per system, so that a leaked key can be revoked without stopping the others. Give each key the least it needs: read for dashboards and monitoring, developer for anything that only runs sessions, admin only where keys, people or budgets are managed. Limit a production key to the addresses your servers call from (allowedSources), so that a copy of it is useless anywhere else.

#8.1 Watching your sessions

Seven ways to see how your sessions and requests are doing, from the quickest look to a lasting record:

You want toUse
Know whether one session has the memory and processor it needs, nowhealth on GET/v1/sessions/{id}, and the session's page in the console
See how that changed over the last half hourGET/v1/sessions/{id}/metrics, drawn as charts in the console
Read what your software printedGET/v1/sessions/{id}/logs, also on the session's page
See all your live sessions together, the unwell firstThe console's Observability page, or GET/v1/observability
See what a session was doing after it has ended or been lostThe same page, under Ended sessions, or GET/v1/history: each ended session is kept for 7 days with its last figures, its last output and why it ended
Keep figures and events, chart them your way, and be alertedHave them sent to your own monitoring: PUT/v1/telemetry, or the console's Telemetry page
See the platform's part of a request inside your own trace of itSend a traceparent header with your requests, with traces switched on in the same setting

The first three describe a session while its MicroVM exists. What a session leaves when it ends is kept for some days by the platform; for a record of your own that you keep as long as you like, use the last two: the first of them sends OpenTelemetry to an address you give, every half minute, and your alerts are then rules in your own monitoring. The API Reference, section 6.2, lists exactly what is sent.

Two habits worth having: give every session a label (your own user or job reference), since it travels with every figure and event; and write the logs you must keep to your own log service from inside the image, because the platform keeps only the most recent output of a running session.

#8.2 Being told: events pushed to your address

Polling GET/v1/sessions to find out that a session was lost or paused is slow and wasteful. Give an HTTPS address instead and the platform sends each event within a few seconds:

curl -s -X PUT https://<your-platform-address>/v1/webhooks -H "Authorization: Bearer <API key>" \
  -d '{"url": "https://example.com/microvm-events", "events": ["session.lost", "session.recovered", "session.paused", "session.short_of_memory", "budget.alert"]}'
# -> {"webhook": {...}, "secret": "whsec_..."}     the secret is shown this once: store it

A receiver must do three things: check the signature before trusting anything, answer 2xx quickly, and tolerate an event arriving twice.

from microvm_platform import verify_webhook

def handle(request):
    raw = request.body                                    # exactly as received, before parsing
    if not verify_webhook(SECRET, request.headers["X-MicroVM-Signature"], raw):
        return 400
    for event in json.loads(raw)["events"]:
        if already_handled(event["id"]):                  # the same id comes again if a delivery is retried
            continue
        if event["type"] == "session.lost":
            start_a_new_session_for(event["label"])
    return 204                                            # within 5 seconds; do slow work afterwards

If your address is down, events are kept and sent again for up to an hour. For anything you must never miss, treat events as a prompt and the API as the truth: on session.lost, read the session before acting.

#8.3 Costs by team, and a budget

Give every session a label. GET/v1/usage/summary then shows the month so far for each label, and for each API key, in session-hours and memory GB-hours, and in money where prices have been agreed for your account. If you want costs by team, project or tenant, use that as the label: a day keeps separate figures for 200 different labels.

A budget turns those figures into a warning, and if you want, a stop:

curl -s -X PUT https://<your-platform-address>/v1/budget -H "Authorization: Bearer <API key>" \
  -d '{"monthly": {"sessionHours": 2000}, "labels": {"team-red": {"sessionHours": 500}}, "alertAt": [50, 80, 100], "enforce": false}'

Each level raises one alert a month, shown in the console and pushed as a budget.alert event. With "enforce": true, new sessions are refused once the account's limit is reached; sessions already running are never stopped by a budget. To limit one system rather than the whole account, give its API key a cap instead (caps on the key).

#8.4 Your people in the console, with their company accounts

An admin connects the account to your identity provider once (PUT/v1/signin, or the console's Team page): the provider's issuer address, and the client ID and secret of the application you registered there for the console. Who gets which role can follow the groups your provider reports, an email domain, or a list of people. Three roles exist: admin, developer and read. Taking a person out of the group or the list ends their access; you do not manage passwords here at all.

#8.5 Limits for each of your own users, and your own encryption key

A quota for every end user. Name your own user in "user" when you start a session. One call then sets a quota that applies to every user (minutes a day, sessions at once), with other figures for named users where needed. A user over the quota is refused new sessions with 403 user_quota_reached; what is running carries on. GET/v1/users/{user} says what one user has used today. It is built for very large numbers of users: nothing is kept for a user who is not active. API reference, section 6.7.

Your own encryption key. Everything the platform keeps for you is encrypted: saved states, terminal recordings, session recordings. Give a key of your own (POST/v1/encryption-keys, 32 random bytes in base64) and the key of each is sealed under yours as well. Withdraw your key and nothing sealed under it can be opened again, by anyone. Keep your own copy of the key: it is never shown back. API reference, section 6.8.

Reports. Usage and the budget report can be exported as files, on request, on a schedule, or when use passes a step, and sent by email or to your own address. API reference, section 6.6.

#9. The console

A web console at the platform's address shows your pools, sessions, schedules, images, usage and audit trail, and can start, pause, resume and end sessions by hand. It also has pages for the month's usage by label and key with the budget, for events pushed to your address, for your team and company sign-in, and for API keys with their limits; a session's page can run a command in it, open or join a terminal, and show what has happened in a recorded session and its screen. Further pages: Volumes, Saved states (keep, start from, remove), End users (the quota for every user, figures for named users, what one user has used today), and Encryption (your own key: give, list, withdraw). Terminal recordings and session recordings are listed at the foot of the Sessions page. People sign in with a company login (your own identity provider, once an admin has connected it: section 8.4); programs use API keys.

#9.1 Client libraries and a command-line tool

Libraries for Python and JavaScript and a command-line tool (microvm) are supplied as package files. They cover every operation, retry the "not now" answers for you, and check webhook signatures. The examples in section 5 show the bare HTTP calls so that you can see what happens; in practice the libraries are less code:

from microvm_platform import Client
mv = Client("https://<your-platform-address>", "<API key>")
s = mv.sessions.start(pool="my-agent", label="user-42", idle_pause_seconds=300, secrets={"API_TOKEN": token})
result = s.exec(["python3", "job.py"])

#10. Go-live checklist

  • Your image is registered, status is ready, and its outbound rule lists everything it must reach.
  • Your software creates nothing unique before it reports ready, and reconnects to other services after a copy.
  • Start requests carry an Idempotency-Key.
  • Retries honour Retry-After and stop after about 30 seconds.
  • session_failed is handled by starting a new session.
  • Sessions are paused when idle and ended when the user leaves.
  • Known peaks are booked with schedules.
  • Your limits (GET /v1/account) cover your expected number of sessions at once and requests per second.
  • API keys are held in a secret store, one per system.
  • The x-request-id of failed requests is logged, for support.

#11. Troubleshooting

When a user says their session is slow, look at that session's health first (GET/v1/sessions/{id}, or the Health card in the console). short_of_memory means your image needs more memory; waiting_for_processor means the fault is on our side.

SymptomLikely causeWhat to do
A session is slow, health says short_of_memoryThe session is close to its memory limitRegister the image with more memoryMb
A session is slow, health says waiting_for_processorIt is not getting the processor it asks forOurs to fix: send support the request's x-request-id
401 unauthorizedThe key is missing, mistyped, expired or revokedCheck the Authorization: Bearer header; list keys with a working key
403 read_onlyA read key was used for a changeUse a full key
404 unknown_poolThe pool name is wrong, or the image is not registeredGET/v1/pools
409 not_running on a request to a sessionThe session is paused and was not started to wake on requestResume it first, or start such sessions with idlePauseSeconds (waking on the next request is then the default)
409 busyTwo changes to one session at onceRetry in a second; avoid changing one session from two places at once
429 limit_reached on startToo many sessions existEnd idle sessions; check GET/v1/account
429 rate_limitedToo many requests per secondSlow down; batch or cache GET requests
503 no_capacityA surge beyond what is readyRetry; book known peaks with a schedule
Starts report fromPool: false or servedFromThe pool was emptyRaise the image's ready, or add a schedule
An image stays failingIt cannot be pulled, does not become ready on its port, or has no start commandRead problem in GET/v1/images
A resumed session has lost its connection to another serviceConnections do not survive in a copy or a restore from a saved copyReconnect on demand
Every session has the same "random" IDIt was created before your software reported readyCreate it on the session's first request
A session shows failedThe machine holding it failed while it was runningStart a new session; pause sessions that are not in active use

When you ask for support, send the requestId from the error (or the x-request-id header) and the session ID.

API reference

This document describes every operation a customer can call. For how to build it into an application, read the Integration Guide.

#1. Basics

Base addresshttps://<your-platform-address>
FormatJSON in requests and replies
AuthenticationAuthorization: Bearer <API key> on every request
TimesDurations are in milliseconds and are measured inside the platform. Dates are ISO 8601, in UTC
Request sizeUp to 100 KB, except requests to a session's own address (16 MB)
Your usersPeople using your product,each with their own sessionYour applicationHolds your API key.Starts, pauses, resumes andends a session for each user.The MicroVM platformOne address, one APIEvery request carries your API keyPoolsReady MicroVMs,one pool for each kindSessionsOne private MicroVM each.Never shared, never reusedHTTPSYour own systemsReached by a session only ifits outbound rule allows itoutbound: none, internet, or a listA start takes a MicroVM from a pool. The platform keeps each pool full by itself.
How your application, the API and your users' sessions fit together

#1.1 Terms

TermMeaning
MicroVMA private, isolated machine for one session. It is never shared and never reused
SessionOne user's use of one MicroVM, from start to end
PoolA set of ready MicroVMs of one kind, from which sessions are started
ImageYour own container image. Each registered image gets a pool of its own
SnapshotThe saved copy of a paused session

#1.2 Request IDs

Every reply carries an x-request-id header. Quote it when you ask for support. You may send your own x-request-id to follow a request end to end.

#1.3 Errors

Every error has the same shape:

{"error": {"code": "not_running", "message": "The session is not running", "requestId": "3767e7fc74a89a16"}}

Act on code, not on message.

StatusCodeMeaningWhat to do
400bad_requestThe request is not valid. The message says which fieldCorrect the request
401unauthorizedNo API key, or an unknown oneCheck the key
403read_onlyThe key can only readUse a key with the full role
403suspendedThe account is suspendedContact support
403forbiddenThe operation is not open to customersDo not retry
404not_foundNo such session, key, schedule or imageCheck the ID
404unknown_poolNo such poolCheck the pool name with GET/v1/pools
404unknown_actionNo such taskCheck the task name
409busyAnother change to the same session is in progressRetry after the Retry-After seconds
409not_runningThe session is ended, or paused and not set to wake on the next request (section 2.14)Resume it first
409not_pausedThe session is ended or failed, and cannot be resumedStart a new session
409session_failedThe session was lost: its MicroVM stopped unexpectedlyStart a new session
409snapshot_unavailableThe session has no usable snapshot to resume fromStart a new session
409too_manyThe account already has 20 keys or 20 schedulesRemove one
413too_largeThe request is larger than allowedSend less
429rate_limitedMore requests per second than the account allowsSlow down; retry after Retry-After
429limit_reachedThe account is at a limit: sessions at once, images registered, or the size a schedule may ask for. The message says whichRetrying does not help until the limit is no longer reached
400secrets_failedThe secrets could not be placed in the session, so it was not startedSecrets need a shell (sh) inside the image
403forbiddenThe key's or person's role does not allow thisUse an admin key (section 6.1)
403source_not_allowedThe key is limited to other addressesCall from an allowed address, or change the key's allowedSources
403cap_reachedThe key has reached its cap for the monthUse another key, raise the cap, or wait for the next month. Running sessions are not affected
403budget_reachedThe account's budget for the month is used up and is set to stop new sessionsRaise or remove the budget (section 6.5)
404no_such_fileNo such file in the session, or it cannot be readCheck the path
409no_saved_stateThe session has no saved state to start a copy fromPause it and wait for snapshot.status to be ready
409session_recoveredThe session's MicroVM stopped and the session was brought back as it was at an earlier moment (section 2.13)Send the request again
500internalSomething went wrong on our sideRetry once; if it repeats, contact support with the requestId
502action_failedThe task failed inside the sessionCheck the session with GET; retry if it is still running
502exec_failedThe command could not be run inside the sessionCheck the session with GET; retry if it is still running
503no_capacityEvery machine is full at this moment and more are being addedRetry after Retry-After
503unavailable, node_unavailableA part of the service is restarting. An existing session is intactRetry after Retry-After

Replies that mean "ask again shortly" (busy, rate_limited, no_capacity, unavailable, node_unavailable, and session_recovered, which needs no wait) carry a Retry-After header with the number of seconds to wait.

#1.4 Account limits

Each account has limits. Read yours with GET/v1/account.

LimitMeaning
maxActiveSessionsSessions that may exist at once, running or paused
requestsPerSecondRequests per second across all your keys
maxSessionHoursThe longest a session may live
historyDaysHow many days an ended session stays to be looked at (section 2.12). 7 unless a different number has been agreed, 30 at most
maxScheduleTargetThe largest pool size a schedule may ask for
maxSessionMemoryMbThe most memory one session may ask for when it starts (section 2.2). 4,096 unless agreed otherwise
maxSessionProcessorsThe most processors one session may ask for. 4 unless agreed otherwise
maxVolumesHow many volumes the account may have (section 3.6). 100 unless agreed otherwise

#1.5 Safe retries

OperationSafe to repeat?
Any GETYes
POST/v1/sessionsYes, if you send an Idempotency-Key header. The same key within a day returns the first session and does not make a second. The reply then carries "repeated": true and shows that session as it is now, which may be terminated: use a new key for each new session
PauseYes. Pausing a paused session answers 200 with already: true
ResumeYes. Resuming a running session answers 200 with already: true
EndYes

#2. Sessions

#2.1 The session object

{
  "id": "ses-6bf349e68de3",
  "state": "paused",
  "pool": "browser-ready",
  "label": "user-42",
  "address": "/v1/sessions/ses-6bf349e68de3/proxy/",
  "fromPool": true,
  "createdAt": "2026-11-26T08:00:29.309Z",
  "pausedAt": "2026-11-26T08:00:29.839Z",
  "expiresAt": "2026-11-27T08:00:29.309Z",
  "resumesFrom": "memory",
  "snapshot": {"status": "ready", "bytes": 91054096, "copies": 2},
  "events": [
    {"at": "2026-11-26T08:00:29.309Z", "type": "started", "fromPool": true},
    {"at": "2026-11-26T08:00:29.839Z", "type": "paused"}
  ],
  "ms": 22.2
}
FieldMeaning
idThe session's ID
staterunning, paused, resuming, failed or terminated
poolThe pool it was started from
labelYour own reference, if you gave one
addressThe path of the session's own address (section 3.2)
fromPooltrue if a ready MicroVM was handed over. false if one had to be made on request, which takes longer
servedFromPresent when the named pool was empty and a MicroVM from another pool was handed over
createdAt, pausedAt, expiresAtWhen it started, when it was paused, and when it will end by itself
resumesFromWhile paused: memory (resume takes milliseconds) or snapshot (a few hundred milliseconds)
healthHow the session's MicroVM is doing: see section 2.8. Present on GET/v1/sessions/{id} while the session is running or paused in memory
resumedFromAfter a resume: where it came back from
snapshotWhile paused: status is saving then ready; copies is how many saved copies exist
memoryMb, processorsThe session's own size, where it asked for one (section 2.2)
idlePauseSeconds, autoResumePresent when the session pauses by itself when idle, and whether the next request wakes it (section 2.14)
recoverableToWhile running: the time of the saved state the session would come back to if its MicroVM stopped (section 2.13). Absent if there is none
recoveredAt, stateAsOfPresent once a session has been brought back: when that happened, and the time its state is from. stateAsOf is also set on a session started as a copy
forkedFromFor a session started as a copy: the session it was copied from (section 2.15)
reasonFor a failed session: why
eventsThe session's history
msHow long this operation took inside the platform
alreadytrue when a pause or resume changed nothing because the session was already in that state

States

StateMeaningAllowed next
runningIn usepause, end
pausedStopped exactly where it was. Nothing runs and no task is acceptedresume, end
resumingBeing restored from a snapshot. Other requests get busy(wait)
failedLost. See reasonend
terminatedEnded. The record stays readable for an hournone
startPOST /v1/sessionsrunningin usepausednothing runsterminatedended; MicroVM destroyedfailedlost; see "reason"resumingtakes a little longer7 mspause16 msresume14 msresume, after a few minutes pausedabout 0.3 sits machine failedend (DELETE)endTimes are typical values measured inside the platform. A pause or a resume that is repeated answers "ok" with already: true.
The states of a session, and the typical time of each change

Event types: started, paused, snapshot_saved, snapshot_copied, moved_to_snapshot, resumed, recovered, short_of_memory, expired, failed, terminated. A paused event carries cause: "idle" when the session paused by itself; a resumed event carries cause: "request" when a request woke it.

#2.2 Start a session

POST/v1/sessions

Body fieldTypeMeaning
poolstringstandard, agent-ready, browser-ready, or the name of one of your images. Default browser-ready
labelstringYour own reference, up to 100 characters
maxLifetimeSecondsintegerThe session ends by itself after this long. Default and maximum: your account's limit
memoryMbintegerMemory for this session, from the pool's own size (1,024 for the built-in pools; what the image declares for yours) up to your account's maxSessionMemoryMb. Left out: the pool's size
processorsnumberThe most processors this session may use, from 0.25 up to your account's maxSessionProcessors. Left out: not limited
idlePauseSecondsintegerPause the session by itself after this many seconds without a request (30 to 86,400). Left out or 0: never. Section 2.14
autoResumebooleanWake a paused session when the next request for it arrives. Default: true when idlePauseSeconds is set, otherwise false
recoverbooleanWhether the session is brought back from its last saved state if its MicroVM stops (section 2.13). Left out: as its pool or image says, which is yes unless you chose otherwise
saveEverySecondsintegerSave the running session on a timer (30 to 3,600), so that even a session that never pauses has a recent state to come back to. Each save freezes the session briefly. Left out: as its image says, which is never unless you chose otherwise
healthobjectThis session's own thresholds, as for an image: {"memoryPercent": 90, "waitingPercent": 10} (section 2.8)
secretsobjectUp to 20 names and values handed to the session as files (section 3.5). They are not kept by the platform
outboundstring or objectWhat this one session may reach, where that should be less than its image allows: "none", or {"allow": ["host:port", ...]}. Every destination must be one the image's own rule allows (for an image open to the internet: any public name or address on ports 80 and 443). A session can never reach more than its image. The rule is in place before the start is answered, stays through pause, resume and recovery, and a copy of the session carries it. On the platform's own pools only "none" is accepted
userstringOne of your own users, for quotas and usage per user (section 6.7)
volumestringA folder that outlives the session, found inside it at /volumes/<name> (section 3.6). Made if it does not exist yet. One session holds a volume at a time
fromStatestringStart from a named saved state instead of a queue (section 3.7)
terminalbooleantrue to allow terminals in this session (section 3.8). Without it the session has none
recordbooleantrue to record what happens inside this session (section 3.9). Off unless asked for
fromstringStart as a copy of this session's saved state instead of from a pool (section 2.15). pool is then not used

Everything a pool or an image decides for its sessions and that can be changed on a MicroVM that is already running can be chosen here for one session: its size, when it pauses, whether it is recovered and saved on a timer, and its health thresholds. What a MicroVM is made with (the image, its start command and variables, its port, what it may reach on the internet) belongs to the image and cannot be changed for one session.

A session with its own memoryMb is counted in your usage at that size (section 6.4). Starting with secrets takes about 15 ms longer for each secret.

Header: Idempotency-Key (optional, recommended).

curl -s -X POST https://<your-platform-address>/v1/sessions \
  -H "Authorization: Bearer <API key>" \
  -H "Idempotency-Key: 7f3c1a52-user-42" \
  -d '{"pool": "browser-ready", "label": "user-42"}'
{"id": "ses-6bf349e68de3", "state": "running", "pool": "browser-ready", "label": "user-42",
 "address": "/v1/sessions/ses-6bf349e68de3/proxy/", "fromPool": true,
 "createdAt": "2026-11-26T08:00:29.309Z", "expiresAt": "2026-11-27T08:00:29.309Z",
 "events": [{"at": "2026-11-26T08:00:29.309Z", "type": "started", "fromPool": true}], "ms": 8.4}

Every option at once. A recorded session with a terminal, a volume, more memory than the queue's own, a pause when idle and a save on a timer:

curl -s -X POST https://<your-platform-address>/v1/sessions \
  -H "Authorization: Bearer <API key>" \
  -H "Idempotency-Key: order-7731-start" \
  -d '{
    "pool": "standard",
    "label": "order-7731",
    "user": "user-42",
    "record": true,
    "terminal": true,
    "volume": "user-42-home",
    "memoryMb": 2048,
    "processors": 1,
    "maxLifetimeSeconds": 7200,
    "idlePauseSeconds": 300,
    "autoResume": true,
    "saveEverySeconds": 120,
    "recover": true,
    "health": {"memoryPercent": 90, "waitingPercent": 10},
    "secrets": {"API_TOKEN": "<value>"}
  }'

The reply repeats what was set (record, terminal, volume and volumePath, memoryMb, processors, idlePauseSeconds, saveEverySeconds, user), so a client can check it got what it asked for. Three things to know:

  • memoryMb is never less than the queue's own size (1,024 for the built-in queues). A session given a different size, or started with secrets, is prepared when asked for and so takes a few hundred milliseconds to start, not a few.
  • outbound is left out above. On the built-in queues it can only be "none"; a list of allowed destinations ({"allow": ["host:port"]}) is for sessions of your own images, and can only narrow what the image allows.
  • fromState and from start the session from a saved state instead of a queue (sections 3.7 and 2.15); pool is then left out.

Errors: unknown_pool (404), limit_reached or rate_limited (429), no_capacity or unavailable (503), cap_reached or budget_reached (403), secrets_failed (400), no_saved_state (409, with from).

#2.3 Get a session

GET/v1/sessions/{id} returns the session object, with its history and, while paused, the state of its snapshot.

curl -s https://<your-platform-address>/v1/sessions/ses-6bf349e68de3 -H "Authorization: Bearer <API key>"

#2.4 List sessions

GET/v1/sessions returns {"sessions": [...]}: your sessions, without their event histories. Recently ended sessions are included.

#2.5 Pause a session

POST/v1/sessions/{id}/pause

Stops the session at once and replies. Everything is kept: memory, open pages, logins, and text typed but not sent. A snapshot is then saved and copied in the background; snapshot.status becomes ready when it is safe.

curl -s -X POST https://<your-platform-address>/v1/sessions/ses-6bf349e68de3/pause -H "Authorization: Bearer <API key>"

Errors: not_found (404); not_running (409) if the session is ended or failed; busy (409); node_unavailable (503).

#2.6 Resume a session

POST/v1/sessions/{id}/resume

Brings the session back exactly as it was. resumedFrom in the reply is memory or snapshot.

curl -s -X POST https://<your-platform-address>/v1/sessions/ses-6bf349e68de3/resume -H "Authorization: Bearer <API key>"
{"id": "ses-6bf349e68de3", "state": "running", "pool": "browser-ready", "resumedFrom": "memory", "ms": 15.1}

Errors: not_found (404); not_paused, busy, snapshot_unavailable, session_failed (409); no_capacity, node_unavailable (503).

#2.7 End a session

DELETE/v1/sessions/{id}

Removes the MicroVM and every snapshot of it. The record stays readable for an hour, with state terminated.

curl -s -X DELETE https://<your-platform-address>/v1/sessions/ses-6bf349e68de3 -H "Authorization: Bearer <API key>"

#2.8 A session's health

GET/v1/sessions/{id} carries a health block while the session is running or paused in memory. It tells you whether that session's MicroVM has the memory and processor it is asking for.

"health": {
  "verdict": "healthy",
  "note": "This session has the memory and processor it is asking for.",
  "memory":    {"usedMb": 312, "peakMb": 388, "limitMb": 512, "usedPercent": 60.9},
  "processor": {"inUse": 0.14, "waitingPercent": 0.2, "overSeconds": 30},
  "thresholds": {"memoryPercent": 90, "waitingPercent": 10},
  "measuredAt": "2026-11-27T02:14:07.000Z"
}
FieldMeaning
verdicthealthy, short_of_memory, waiting_for_processor, paused, or unknown (the figures could not be read just now)
noteThe verdict in plain words, and what to do
memory.usedMb, peakMb, limitMbMemory in use now, the most it has used, and the session's limit
processor.inUseProcessors in use over the last half minute: 0.14 is 14% of one processor
processor.waitingPercentThe share of that time the session wanted a processor and had to wait
thresholdsThe values the verdict was judged against
VerdictWhose to fixWhat to do
short_of_memoryYoursRegister the image with more memoryMb
waiting_for_processorOursNothing in your image is wrong. Quote the request's x-request-id to support

The thresholds are 90% of the memory limit and 10% of the time waiting unless your image sets its own (section 5.1). For a list, GET/v1/sessions?health=1 adds health to the first 60 live sessions.

Only your own session is described: nothing about the machine it runs on, or about any other session.

#2.9 A session's figures over time

GET/v1/sessions/{id}/metrics

The last half hour of the same figures, one reading every 5 seconds, oldest first. Use it to draw a chart, or to see what a session was doing just before it slowed down.

{
  "session": "ses-6bf349e68de3", "state": "running", "limitMb": 512, "everySeconds": 5,
  "points": [
    {"at": "2026-11-27T02:13:55.000Z", "memoryMb": 310.2, "processor": 0.12, "waitingPercent": 0},
    {"at": "2026-11-27T02:14:00.000Z", "memoryMb": 312.0, "processor": 0.14, "waitingPercent": 0.2}
  ]
}
FieldMeaning
limitMbThe session's memory limit, for scale
points[].memoryMbMemory in use at that moment
points[].processorProcessors in use over the 5 seconds before it: 0.14 is 14% of one processor
points[].waitingPercentThe share of those 5 seconds the session wanted a processor and had to wait

points is empty for a session that is not running or paused in memory. The readings are kept only while the session's MicroVM exists; to keep them longer, have them sent to your own monitoring (section 6.2).

#2.10 What a session's software printed

GET/v1/sessions/{id}/logs?tail=200

The last lines your software wrote to its standard output and standard error, oldest first. tail is how many lines, 1 to 1000, default 200.

{"session": "ses-6bf349e68de3", "state": "running", "earlierDropped": false,
 "lines": ["server listening on 8080", "GET /cart 200 3ms"]}
FieldMeaning
linesThe lines, as your software wrote them
earlierDroppedtrue when there were more lines than were returned

Only the most recent output is kept for each session, up to 1,000 lines, and it is gone when the session ends. This is for looking at a session while it runs: for a lasting record, write your logs to your own log service from inside the image. lines is empty for a session that is not running or paused in memory.

#2.11 Every live session at once

GET/v1/observability

All your live sessions with their figures in one reply, the unwell first: the ones that are lost, then short of memory, then waiting for a processor, then the healthy and the paused.

{
  "measuredAt": "2026-11-27T09:40:12.000Z",
  "totals": {"live": 412, "running": 388, "paused": 24, "failed": 0, "shortOfMemory": 2, "waitingForProcessor": 0},
  "sessions": [
    {"id": "ses-6bf349e68de3", "label": "user-42", "pool": "my-agent", "state": "running", "startedAt": "2026-11-27T09:12:44.000Z",
     "verdict": "short_of_memory", "usedMb": 471, "peakMb": 480, "limitMb": 512, "memoryPercent": 92, "processor": 0.31, "waitingPercent": 0}
  ],
  "more": 0
}
FieldMeaning
totalsCounts across all your live sessions
sessions[].verdictAs in section 2.8, or failed for a session that was lost and has not been ended yet
sessions[].usedMb, peakMb, limitMb, memoryPercentMemory now, the most it has used, its limit, and the share of the limit in use
sessions[].processor, waitingPercentOver the last half minute, as in section 2.8
moreHow many sessions were left out: at most 2,000 are returned

Add ?find= with part of a label or of a session's ID to get only the sessions that match, for example ?find=user-48; totals still counts all of them.

The figures are for the half minute before measuredAt. This is the reply behind the console's Observability page.

#2.12 Sessions that have ended

A session's figures and printed output go with its MicroVM. So that you can still see what a session was doing after it has gone, each session is filed when it ends or is lost, with:

  • how it ended (ended, expired or failed) and, for a lost one, why;
  • when it started, how long it lasted and how much of that it was running;
  • its last half hour of memory and processor, as up to 40 points, and the most memory it used;
  • the last lines its software printed, up to 40 (for sessions of your own images);
  • what happened to it: started, paused, resumed, ended, with times.

It is kept for historyDays days (section 1.4): 7 unless a different number has been agreed.

GET/v1/history lists them, newest first.

QueryMeaning
limit1 to 500, default 100
beforeThe at of the last row you have: returns the ones before it
statefailed, expired or ended: only those
labelOnly sessions with exactly this label
findOnly sessions whose label or session ID contains this text, for example user-48
{"keptDays": 7, "sessions": [
  {"at": "2026-11-27T09:31:02.118Z", "session": "ses-6bf349e68de3", "pool": "my-agent", "label": "user-42", "state": "failed",
   "reason": "The MicroVM stopped unexpectedly", "startedAt": "2026-11-27T09:12:44.000Z", "seconds": 1098,
   "runningSeconds": 960, "limitMb": 512, "peakMb": 480, "hasFigures": true, "printedLines": 31}
]}

GET/v1/history/{id} returns one in full: the same fields, with points (as in section 2.9), lines and events. Adding ?at= with the row's at makes it quicker. A session older than the days kept answers 404.

A lost session's reason is The MicroVM stopped unexpectedly or The paused session was lost before its snapshot was saved. When it is the first and the image is your own, look at lines: if your software ended by itself, the last it printed is usually the explanation.

#2.13 When a session's MicroVM stops: recovery

A MicroVM can stop without being asked to: the machine under it fails, or the software inside it crashes the whole MicroVM. A paused session is not affected, because it has a saved copy. For a running session the platform keeps the saved copy from its last pause as a recovery point, and brings the session back from it by itself, usually within a second or two.

What comes backThe session exactly as it was at its last pause: memory, open pages, sign-ins, files inside the MicroVM
What is lostEverything done inside the session after that pause
What is not rolled backAnything your software stored outside the session (in your own database or another service). Design for that: after a recovery the session may be behind what your other systems remember
How you are toldThe request that met the stopped MicroVM gets 409 session_recovered; send it again. The session shows recoveredAt and stateAsOf, has a recovered event, and a session.recovered event is pushed if you asked for it (section 6.3)
A session that never pausedHas no recovery point. It is reported lost (failed), as before, unless it is saved on a timer

While a session runs, recoverableTo shows the time of the state it would come back to.

Saving on a timer. Set saveEverySeconds (on the image, or on one session) and a running session is saved that often without being paused, so the most that can be lost is that many seconds. Each save freezes the session for as long as its memory takes to write: measured at about 0.1 s for a session using 90 MB, and proportionally longer for more. A request that arrives during a save waits for it; none is refused. It is off unless you ask for it.

Switching recovery off. Going back in time without being asked is wrong for some software. Register the image with recover: false, or start a session with recover: false, and such a session is reported lost instead.

#2.14 Pausing when idle, waking on the next request

Start a session with idlePauseSeconds (or set it on an image, for every session of that image) and the platform pauses it once that long has passed with no request to it. A request is a task, a command, a file, or anything through the session's own address; a connection held open counts only while you send something on it.

With autoResume (on by default when idlePauseSeconds is set) the next request to the paused session wakes it first and is then served. Your code does not need to call resume.

The pauseHappens within a few seconds after the idle time has passed. The session's paused event has cause: "idle"
The waking requestWaits for the resume: typically 10 to 20 ms if the session was paused less than five minutes ago, about a quarter of a second after that. The resumed event has cause: "request"
autoResume: falseThe session stays paused until you call resume; requests to it get 409 not_running
autoResume: true without idlePauseSecondsThe session is paused only when you pause it, and wakes on the next request
UsageA paused session is counted as paused, not running

#2.15 Starting a session as a copy of another

POST/v1/sessions/{id}/fork (or POST/v1/sessions with "from": "<id>")

Starts a new session that begins as a copy of another session's saved state: everything in memory, every open page, every file inside the MicroVM. The two are then separate; what happens in one does not touch the other. The body takes the same options as a start (label, maxLifetimeSeconds, idlePauseSeconds, secrets and so on); what is left out follows the session copied from.

The session copied from isThe copy begins as
Paused, with its snapshot saved (snapshot.status is ready)It was at that pause
Running, with a recovery point (recoverableTo is present)It was at the time recoverableTo shows
Anything elseRefused: 409 no_saved_state
curl -s -X POST https://<your-platform-address>/v1/sessions/ses-6bf349e68de3/fork \
  -H "Authorization: Bearer <API key>" -d '{"label": "experiment-2"}'
{"id": "ses-70b1a698c855", "state": "running", "forkedFrom": "ses-6bf349e68de3",
 "stateAsOf": "2026-11-28T09:14:02.120Z", "fromPool": false, "ms": 397.1}

A copy takes a few tenths of a second, not milliseconds: it is restored from the saved state, not taken from a pool. It counts as a session like any other. Secrets the first session was given are part of its memory and so are in the copy too.

#3. Using a session

#3.1 Tasks of the built-in agent

POST/v1/sessions/{id}/actions/{name}

The built-in pools (agent-ready, browser-ready) run a demonstration agent that drives a browser against a demonstration shop. Its tasks are open, login, add, draft, order, state and screenshot. They exist to try the platform out. Your own software, in your own image, is reached through the session's own address (3.2).

curl -s -X POST https://<your-platform-address>/v1/sessions/ses-6bf349e68de3/actions/state \
  -H "Authorization: Bearer <API key>" -d '{}'
{"url": "blank", "who": "Not logged in", "cart": [], "draft": null, "ms": 504.7}

Errors: unknown_action (404); not_running (409) on a paused session that is not set to wake on request (section 2.14); action_failed (502).

#3.2 The session's own address

ANY/v1/sessions/{id}/proxy/{path}

Everything after /proxy/ is passed, with any method, headers and body (up to 16 MB), to the port your software listens on inside this session's MicroVM. Its answer is passed back unchanged. Connections that stay open (WebSocket) pass too.

  • Your API key is checked and is not passed on to your software.
  • A paused session that was started to wake on request (section 2.14) is woken by the request, which is then answered as usual. Otherwise a paused session answers 409 not_running.
  • The session object gives this path as address.
curl -s https://<your-platform-address>/v1/sessions/ses-6bf349e68de3/proxy/health -H "Authorization: Bearer <API key>"

#3.3 Run a command inside a session

POST/v1/sessions/{id}/exec

Body fieldTypeMeaning
commandlist of stringsThe program and its arguments, for example ["ls", "-la", "/tmp"]. For a shell line: ["sh", "-c", "..."]
cwdstringThe folder to run it in
envlist of stringsExtra variables, as NAME=value
stdinstringText given to the command as its input
timeoutSecondsnumberThe command is stopped if it runs longer. 1 to 600; default 60
{"exitCode": 0, "stdout": "total 4\n...", "stderr": "", "ms": 15.9}

The command runs inside the session's MicroVM as the user the session's software runs as, and sees the files that software sees. Up to 1 MB of each kind of output is returned (truncated: true if there was more). A command that ran too long comes back with timedOut: true and no exit status. A command takes about 15 ms to start. A paused session with autoResume is woken first; otherwise the answer is 409 not_running.

#3.4 Files in and out of a session

OperationNotes
PUT/v1/sessions/{id}/files?path=/full/pathThe request body is the file itself, up to 16 MB. Folders on the way are made. Add &mode=640 to set its permissions. Returns {"path", "bytes"}
GET/v1/sessions/{id}/files?path=/full/pathReturns the file, up to 16 MB, as application/octet-stream

Reading a file is recorded in the audit trail, like every change. Both need a shell (sh) and the usual basic commands inside the image; almost every image has them. A read key can do neither.

#3.5 Secrets handed to a session at its start

Give secrets when you start a session and each one becomes a file inside the session at /run/secrets/<NAME>, readable only by the user your software runs as:

curl -s -X POST https://<your-platform-address>/v1/sessions \
  -H "Authorization: Bearer <API key>" \
  -d '{"pool": "my-agent", "label": "user-42", "secrets": {"API_TOKEN": "...", "DB_URL": "..."}}'
How manyUp to 20 for a session; each value up to 8 KB. Names are letters, digits and underscores
Where they liveIn the session's memory only. The platform passes them straight to the session and does not keep them: they are not in the session's record, the audit trail, usage, or anything sent to your monitoring
Pause and resumeThey are part of the session's memory, so they are there after a resume. Saved copies of a session are encrypted
A copy of the sessionHas them too (section 2.15)
If they cannot be placedThe session is not started: 400 secrets_failed. The image needs a shell (sh)

This is how one image serves many users: the image is the same for all, and each session is given its own user's credentials when it starts.

#3.6 Volumes: files that outlive a session

A volume is a folder that belongs to your account and has a name. Start a session with a volume and its software finds it at /volumes/<name>; whatever it writes there is in the next session that uses the volume, on whichever machine that session runs.

OperationNotes
GET/v1/volumesYour volumes: name, mode, rollBack, inUseBy (the session that holds it), bytes and files as last measured (every ten minutes)
PUT/v1/volumes/{name}Makes a volume, or changes one. Body: mode (safe, the default, or fast) and rollBack (default true)
GET/v1/volumes/{name}One volume, with its size measured now
DELETE/v1/volumes/{name}Removes the volume and everything in it. Refused while a session holds it
POST/v1/sessions with "volume": "<name>"Starts a session with the volume. A volume that does not exist yet is made, in safe mode
curl -s -X POST https://<your-platform-address>/v1/sessions -H "Authorization: Bearer <API key>" \
  -d '{"pool": "my-agent", "label": "user-42", "volume": "user-42-home"}'
Which poolsOnly an image registered with "storage": true can carry a volume. Any other pool answers 400 no_storage
One session at a timeA second session asking for a volume that is held gets 409 volume_in_use. The volume is free again a few seconds after its session ends
Pause and resumeThe volume stays with the session, also when the session is resumed from its saved copy on another machine
StartingA start with a volume takes longer than one without, because the volume is attached before the reply: about 25 ms more. Under heavy load some starts with a volume take longer than 50 ms
LimitsUp to 100 volumes an account unless agreed otherwise
UsageWhat your volumes hold is counted as volumeGbSeconds in the daily usage and storedGbHours in the month's summary

Safe and fast. In safe mode a write your software forces to be kept (fsync, or closing a file opened for synchronous writing) is confirmed only when it is kept where the loss of a machine cannot touch it: about 15 to 20 ms for a small write. In fast mode it is confirmed from the machine the session runs on and kept a moment later: about 4 ms. If that machine is lost in between, the last few seconds written to a fast volume can be lost, and files touched in those seconds may be unreadable until the volume is put back to its last snapshot. Use fast mode for caches, build folders and installs of many small files; use safe mode for anything that must not lose what it was told is saved. Writes that are not forced are quick in both modes.

Going back together. When a session is brought back from a saved state after its MicroVM stopped (section 2.13), its volume is put back to the same moment, so that memory and files agree. A snapshot of the volume is taken beside every pause for this; it copies no data. Set rollBack: false on a volume and it always keeps its latest contents instead. With saving on a timer, a volume of up to about 2,000 files is included in every timed save; a larger one is not, and the session then shows two times: recoverableTo for its memory and volumeRecoverableTo for its files, which is its last pause.

A copy of a session that holds a volume (section 2.15) needs a volume of its own: give "volume": "<a new name>" in the fork. The new volume begins as the snapshot beside the saved state, and inside the copy it is found where the original's software expects it (volumePath in the reply).

Errors: no_storage (400), volume_in_use (409), limit_reached (429), volume_unavailable (503: the volume is still being put away after its last session, or the storage that holds it is not answering just now. Nothing is lost in either case; try again in a few seconds).

#3.7 Named saved states

A paused session's saved state normally lasts as long as its session. Kept under a name, it outlasts the session: new sessions can be started from it at any time, as many as you like, each a separate copy of the session as it was when paused. Use it for a prepared environment (software loaded, a user signed in, a model warmed up) that many sessions should begin from.

CallWhat it does
POST/v1/sessions/{id}/saveKeeps the session's saved state under a name: {"name": "<name>"}, with "replace": true to put it in the place of an existing one. The session must be paused and its saved state finished (snapshot.status is ready). The answer comes at once with "state": "saving"; a moment later it is ready
GET/v1/saved-states, GET/v1/saved-states/{name}Your saved states: name, state, bytes, fromSession, savedAt
DELETE/v1/saved-states/{name}Removes one. Sessions already started from it are not affected
POST/v1/sessions with "fromState": "<name>"Starts a session from it. label, user, memoryMb, outbound and the other start options may be given as usual; pool is not needed
curl -X POST $BASE/v1/sessions/$ID/pause  -H "Authorization: Bearer $KEY"
curl -X POST $BASE/v1/sessions/$ID/save   -H "Authorization: Bearer $KEY" -d '{"name": "prepared"}'
curl -X POST $BASE/v1/sessions            -H "Authorization: Bearer $KEY" -d '{"fromState": "prepared"}'

A start from a named saved state takes longer than a start from a queue (a few hundred milliseconds for a small session, more for a large one), because the state is fetched first. Up to 20 saved states an account and 50 GB together unless agreed otherwise. A session that holds a volume cannot be kept this way yet (409 has_volume).

Errors: no_saved_state (409), exists (409), has_volume (409), limit_reached (429), not_found (404).

#3.8 A terminal in a session, watched live and replayed

A terminal is a shell inside the session, running as the user the session's software runs as. It works with any image that has a shell (bash where there is one, otherwise sh); it asks nothing else of your software. Several people can be in the same terminal at once and see the same thing, and everything a terminal showed is kept as a recording that can be played back for 30 days.

A terminal is a window into what may be one of your users' sessions, so it is guarded:

  • A session has no terminal unless it was started with "terminal": true. It cannot be switched on afterwards.
  • Only your own API keys and console users reach a terminal or a recording. The service's operators cannot open, watch or replay one.
  • Whoever watches says so first, with a call of its own. That call is in your audit trail, and the watcher is named on the terminal and on its recording.
  • A key with the read role can watch and replay. It cannot open a terminal, type, resize or close.
  • A recording holds what the terminal showed. That includes the commands people typed, as they appeared on the screen, and everything programs printed. Keystrokes are not recorded separately, so what the terminal does not show as it is typed (a password at a prompt) is not in the recording. A secret typed as part of a visible command, or printed by a program, is. A recording covers its own terminal only: nothing else that happens in the session is in it.
  • A recording is encrypted before it is kept, under a key of its own. If you have set your own encryption key (section 6.8), recordings are sealed under it too, and withdrawing your key makes them unreadable.
CallWhat it does
POST/v1/sessions/{id}/terminalsOpens a terminal. Optional rows (5 to 300, default 30) and cols (20 to 500, default 120). Answers {"id": "term-…", "rows", "cols"}. The session must be running. At most four open at a time in a session
GET/v1/sessions/{id}/terminalsThe session's open terminals: id, openedAt, openedBy, watchedBy
POST/v1/sessions/{id}/terminals/{terminal}/viewers"I am watching this terminal." Answers {"viewer": "view-…"}, which the next call needs
GET/v1/sessions/{id}/terminals/{terminal}/output?viewer=…&after=…&waitMs=…What the terminal has shown since position after (start with 0). Answers data (base64), seq (the position to ask from next time), closed, rows, cols. With waitMs (up to 25000) the call waits that long for something new, so a watcher simply asks again as soon as it is answered
POST/v1/sessions/{id}/terminals/{terminal}/inputTypes into the terminal: {"text": "ls -la\n"}, or bytes as {"data": "<base64>"} (Ctrl-C is "Aw=="). Up to 64 KB at a time. Not recorded as such; what the terminal shows of it is
POST/v1/sessions/{id}/terminals/{terminal}/size{"rows": 50, "cols": 132} when the watcher's window changes
DELETE/v1/sessions/{id}/terminals/{terminal}Closes the terminal and keeps its recording
GET/v1/terminal-recordingsYour recordings, newest first: id, session, openedAt, openedBy, closedAt, seconds, watchedBy, recording, keptUntil
GET/v1/terminal-recordings/{terminal}One recording, with cast: its contents in the asciicast version 2 format, which terminal players read
DELETE/v1/terminal-recordings/{terminal}Removes one before its 30 days are over
SID=$(curl -s -X POST $BASE/v1/sessions -H "Authorization: Bearer $KEY" -d '{"pool": "standard", "terminal": true}' | jq -r .id)
TID=$(curl -s -X POST $BASE/v1/sessions/$SID/terminals -H "Authorization: Bearer $KEY" -d '{}' | jq -r .id)
VIEW=$(curl -s -X POST $BASE/v1/sessions/$SID/terminals/$TID/viewers -H "Authorization: Bearer $KEY" | jq -r .viewer)
curl -s -X POST $BASE/v1/sessions/$SID/terminals/$TID/input -H "Authorization: Bearer $KEY" -d '{"text": "uname -a\n"}'
curl -s "$BASE/v1/sessions/$SID/terminals/$TID/output?viewer=$VIEW&after=0&waitMs=2000" -H "Authorization: Bearer $KEY" | jq -r .data | base64 -d

To use a terminal from your own terminal, with full-screen programs and your own window size, there is a small program that needs only Python 3:

export MICROVM_URL=$BASE MICROVM_KEY=$KEY
python3 terminal.py $SID              # open a terminal and use it
python3 terminal.py $SID $TID         # join one that is open (with a read key: watch it)
python3 terminal.py --replay $TID     # play a recording back as it happened

The console has the same under Sessions: tick "Allow a terminal" when starting a session, then "Open a terminal" on the session; "Join" on a terminal someone else opened; and "Play" in the list of recordings. The console's terminal draws text and the cursor, which is enough for a shell; for full-screen programs such as an editor, use the program above.

What to know:

  • A terminal closes when its shell leaves (exit), when it is closed with DELETE, or when its session is paused or ended. Its recording is kept in each case. A session that is resumed has no open terminals; open a new one.
  • A watcher who falls more than 256 KB behind is answered from the oldest output still held, with "missed": true. The recording still has all of it.
  • A recording holds up to 8 MB of output. Beyond that the terminal goes on working and the recording is marked "cut": true.
  • Reading a terminal's output counts as use of the session, so a session set to pause when idle does not pause while someone is watching.

Errors: terminal_not_enabled (403), not_watching (403), read_only (403), forbidden (403, an operator), not_running (409), terminal_closed (409), limit_reached (409), terminal_failed (502, the image has no shell), not_found (404).

#3.9 Recording what happens inside a session

A session started with "record": true is recorded from the outside, by the sandbox it runs in. It does not matter what image the session uses or how it is used (through its own software, the agent, commands, a terminal): nothing has to be added to the image, and nothing inside the session can switch the recording off or change it.

What is recorded, each with its time, the program that did it, its process number and the user it ran as:

KindWhatExample
runEvery program started, with its arguments and working folder/usr/bin/python3 report.py --month 11
fileEvery file opened: to read, to write, or newly made (make)make /tmp/out/report.csv
connectEvery network connection attempted, with address and port, and whether it was refused10.20.0.5:5432

What is not recorded: the contents of files, of what is sent or received, and of what is typed; a program's environment (it often holds secrets); and the routine reading of system libraries, which is left out as noise. A secret passed as a program's argument is recorded, as an argument is part of what was run. For what a terminal showed, see section 3.8, which can be used in the same session.

Pictures of the screen. Where a recorded session has a screen, the recording also holds pictures of it, taken every two seconds and kept only when the screen has changed. Two kinds of screen are pictured, in both cases with nothing added to your image:

  • a virtual display that your own software starts inside the session (an X display such as Xvfb gives, which is what graphical programs and browsers with a window draw on). The whole display is pictured, whatever is drawn on it;
  • the page of the browser in a session of the service's own browser queue.

A session with neither (a script, a server, a browser with no window in your own image) has no pictures; its recording is the list of what it did. To take the picture of a virtual display, one small program of ours is placed in the session's /tmp as .screen-capture and does not appear in the recording.

Recording is off unless asked for, and cannot be switched on or off after the session has started. If the recording cannot be switched on, the session is not started (503 unavailable): you are never given an unrecorded session where you asked for a recorded one.

CallWhat it does
POST/v1/sessions with "record": trueStarts a recorded session. A copy of a recorded session is recorded too
GET/v1/sessions/{id}/recordingThe recording, while the session runs or after it has ended. after (the number of the last event you have), limit (up to 5000, default 1000), kind (run, file, connect, several with commas). Answers list, next, more, and the recording's summary
GET/v1/session-recordingsYour recordings: session, label, user, startedAt, endedAt, events, bytes, keptUntil
GET/v1/session-recordings/{session id}The same as the first, by the session's id (for a session long ended)
GET/v1/session-recordings/{session id}/picturesThe pictures of the session's screen: n, at, type (image/png, or image/qoi for a virtual display)
GET/v1/session-recordings/{session id}/pictures/{n}One picture: data is the image in base64. QOI is a simple open format; the console shows both kinds
DELETE/v1/session-recordings/{session id}Removes a recording and its pictures before its 30 days are over. The session must have ended
SID=$(curl -s -X POST $BASE/v1/sessions -H "Authorization: Bearer $KEY" -d '{"pool": "standard", "record": true, "user": "asha"}' | jq -r .id)
curl -s -X POST $BASE/v1/sessions/$SID/exec -H "Authorization: Bearer $KEY" -d '{"command": ["sh", "-c", "date > /tmp/now.txt"]}'
curl -s "$BASE/v1/sessions/$SID/recording?kind=run,file" -H "Authorization: Bearer $KEY" | jq -c '.list[]'
{"n":7,"at":"2026-11-29T07:02:11.412Z","kind":"run","program":"/usr/bin/date","args":["date"],"by":"sh","pid":41,"uid":1001,"cwd":"/app"}
{"n":8,"at":"2026-11-29T07:02:11.409Z","kind":"file","path":"/tmp/now.txt","how":"make","by":"sh","pid":41,"uid":1001}

What to know:

  • Events are numbered from 1 in the order they were recorded. To follow a running session, ask again with after set to the last next.
  • One session has one recording, across pauses and resumes. What is recorded is put away every minute, so if a session's MicroVM stops and the session is brought back from its recovery point, at most the last minute before the stop is missing; the recording then carries a gaps entry saying so.
  • Up to 1,500 pictures are kept for a session (picturesCut says when that was reached). A picture of a 1024 by 768 screen is typically 20 to 300 KB.
  • A recorded session starts more slowly than an unrecorded one, by about 15 milliseconds, and each program it starts costs slightly more. Sessions that are not recorded are not affected at all.
  • Recordings are kept encrypted for 30 days after the session ends, up to 64 MB a session (roughly half a million events). Beyond that the session runs on and the recording is marked "cut": true. If you have set your own encryption key (section 6.8), recordings are sealed under it, and withdrawing the key makes them unreadable.
  • Only your own API keys and console users read a recording; a read key can read and list but not remove. The service's operators cannot read or list recordings.
  • In the console: tick "Record what happens in it" when starting a session; "Show what has happened" and "Show its screen" on the session; and "Session recordings" at the foot of the Sessions page, where "Screen" plays the pictures one after another.

Errors: recording_unavailable (409), unavailable (503), forbidden (403, an operator), in_use (409, removing the recording of a session still there), key_withdrawn (409), not_found (404).

#4. Capacity

A pool is a queue of MicroVMs kept ready, so that a session starts in milliseconds; the console calls it a queue. This is everything you can do with one:

ToCallSection
Create a queue of your ownPOST/v1/images: registering an image creates a queue with the image's name; "ready" is how many MicroVMs it keeps waiting5.1
See the queues and how full each isGET/v1/pools4.1
Make a queue larger for a periodPOST/v1/schedules, with the queue's name and a target4.2
Change how many your own queue keeps readyPOST/v1/images again with the same name and a new "ready"5.1
Remove a queue of your ownDELETE/v1/images/{name}5.2

The three built-in queues (standard, agent-ready, browser-ready) are always there and cannot be created a second time or removed. Their size follows demand by itself; a schedule raises it ahead of a peak you know is coming.

#4.1 List pools

GET/v1/pools

{"pools": [
  {"name": "browser-ready", "description": "MicroVM with the browser already open", "ready": 2, "target": 2, "normalTarget": 2, "automatic": 2},
  {"name": "standard", "description": "Empty MicroVM", "ready": 4, "target": 4, "normalTarget": 4, "automatic": 2}
]}
FieldMeaning
readyMicroVMs waiting now
targetHow many the platform is keeping ready at this moment
normalTargetThe standing size
automaticThe size demand currently calls for
scheduledThe size a schedule currently calls for, if any

You see the built-in pools and the pools of your own images.

#4.2 Schedules

A schedule asks for more ready MicroVMs in a pool for a period. Capacity is brought up a few minutes before the period starts. Automatic scaling still applies on top. An account may have up to 20 schedules.

POST/v1/schedules

Body fieldTypeMeaning
poolstring, requiredThe pool
targetinteger, requiredReady MicroVMs wanted
labelstringYour own reference
start, endstringFor a one-off period: ISO 8601 times
daysarrayFor a weekly period: 0 (Sunday) to 6 (Saturday)
from, tostringFor a weekly period: HH:MM
timezonestringFor a weekly period, for example Asia/Kolkata
curl -s -X POST https://<your-platform-address>/v1/schedules -H "Authorization: Bearer <API key>" \
  -d '{"pool": "browser-ready", "target": 500, "days": [1,2,3,4,5], "from": "08:30", "to": "11:00", "timezone": "Asia/Kolkata", "label": "morning peak"}'
{"id": "sch-d2ee9d5d5a92", "pool": "standard", "target": 6, "label": "evening", "kind": "once",
 "start": "2026-11-26T09:00:43.914Z", "end": "2026-11-26T10:00:43.915Z", "createdAt": "2026-11-26T08:00:43.921Z"}

GET/v1/schedules lists them. DELETE/v1/schedules/{id} removes one.

Errors: bad_request (400); too_many (409); above your scheduling limit (429).

#5. Images

Registering an image is how you create a queue of your own: each image you register gets its own pool of ready MicroVMs, named after it. Start a session from it with "pool": "<name>".

#5.1 Register or update an image

POST/v1/images

Body fieldTypeMeaning
namestring, requiredYour name for it, and the pool name. Lower-case letters, digits and hyphens
imagestring, requiredFull image address, for example registry.example.com/team/agent:1.4. Pin a tag or a digest
portinteger, requiredThe port your software listens on
readyPathstringA path that answers without a server error once your software is ready. Without it, an open port counts as ready
commandarrayStart command, if not the image's own
envarrayExtra environment, as NAME=value. Never put per-user secrets here: every session gets the same
memoryMbintegerMemory for one MicroVM, 64 to 8192. Default 512
readyintegerHow many MicroVMs to keep ready. Default 2
registryobject{"username": "...", "password": "..."} for a private registry. Stored encrypted and never returned
copyFromTemplatebooleanDefault true: MicroVMs of the image are prepared in the quickest way, which needs the image to follow the rules in the Integration Guide, "What your image must do". Set false if it cannot; each MicroVM then takes as long to prepare as your software takes to start
startSecondsintegerHow long a fresh start may take before it counts as failed. Default 60
healthobjectWhen to call one of this image's sessions unwell (section 2.8): memoryPercent (50 to 99, default 90) and waitingPercent (1 to 50, default 10). Either may be left out. Changing them restarts nothing
outboundstring or objectWhat MicroVMs of this image may reach. "none" (default), "internet" (any public address on ports 80 and 443), or {"allow": ["host:port", ...]} with 1 to 50 destinations
idlePauseSeconds, autoResumeinteger, booleanEvery session of this image pauses when idle and wakes on the next request, unless a session says otherwise (section 2.14)
storagebooleantrue: sessions of this image may be started with a volume (section 3.6). Default false
recoverbooleanfalse: sessions of this image are not brought back from an earlier state when their MicroVM stops (section 2.13). Default true
saveEverySecondsintegerSave running sessions of this image on a timer, 30 to 3,600 seconds (section 2.13). Default: never

An account may register up to 5 images unless a different limit has been agreed.

Sending the same name again updates the image: MicroVMs still waiting are replaced, and sessions already running finish on the version they started from.

Your image must listen on one port on all addresses (0.0.0.0), tolerate being stopped and continued at any moment, and create nothing unique at start-up. See the Integration Guide, "Bringing your own image".

curl -s -X POST https://<your-platform-address>/v1/images -H "Authorization: Bearer <API key>" \
  -d '{"name": "my-agent", "image": "registry.example.com/team/agent:1.4", "port": 8080, "readyPath": "/health", "memoryMb": 1024, "ready": 10, "outbound": {"allow": ["api.example.com:443"]}}'

#5.2 List and remove

GET/v1/images lists your images. Each has a status: preparing, ready or failing. When failing, problem says what to change. readyAfterMs is how long the first MicroVM took to be ready after you registered or changed the image.

DELETE/v1/images/{name} removes the image and its waiting MicroVMs. Sessions already running from it carry on until they end.

#6. Account

OperationWhat it returns
GET/v1/statusstatus is operational, limited (a pool is empty) or degraded, with the pools you can use and how many are ready
GET/v1/accountYour limits and how many sessions you have in use
GET/v1/usage?from=YYYY-MM-DD&to=YYYY-MM-DDPer UTC day: sessions started and ended, time running and paused, and snapshot storage. Every day since your account was created is kept
GET/v1/audit?limit=100&before=<time>Every change and refused request on your account, newest first, with the key used (key and its name, keyName), the result and the caller's address. Kept for 30 days, then deleted; where long-term keeping has been set up for your account, for the number of days agreed (the reply's keptDays says which, and archived is then true). limit is at most 500. Filters, all optional: key (a key's ID or its name), session, failed=1 (refused or failed requests only), method (such as DELETE), contains (text in the operation, such as pause), from (a time). With long-term keeping, a search by text over a long period may stop before reaching the start of the period: the reply then has more: true, and asking again with before set to the last entry's time continues it
{"customer": "acme", "role": "full", "operator": false,
 "limits": {"maxActiveSessions": 50, "maxScheduleTarget": 200, "requestsPerSecond": 100, "maxSessionHours": 24},
 "activeSessions": 0}

#6.1 API keys

OperationNotes
GET/v1/keysLists keys: id, label, role, createdAt, expiresAt, lastUsedDay, allowedSources, caps. Never the key itself
POST/v1/keysMakes a key; the fields are below. The key is shown once, in this reply
PATCH/v1/keys/{id}Changes a key's label, allowedSources, caps or expiresAt. Send null to lift a limit. The key itself does not change. Takes effect everywhere within 15 seconds
DELETE/v1/keys/{id}Revokes a key. Takes effect everywhere within 15 seconds
FieldMeaning
labelThe key's name. Give it one: the audit trail and the usage figures show it against everything the key does
roleadmin (everything), developer (sessions, images and schedules; not keys, people, sign-in, budgets, or where events and figures are sent) or read (only GET requests, and nothing from inside a session). Default admin. Keys made earlier show full, which is the same as admin
expiresAt or expiresInDaysWhen the key stops working: a time, or a number of days from now. Left out: never
allowedSourcesUp to 20 addresses or ranges the key may be used from, for example ["203.0.113.7", "198.51.100.0/24"]. From anywhere else it is refused with 403 source_not_allowed. Left out: anywhere
caps{"monthlySessionHours": 500} and, where prices have been agreed for your account, {"monthlySpend": 200}. A key that has reached a cap cannot start sessions until the next month (403 cap_reached); sessions already running carry on. Checked against usage that is up to 20 seconds old

An account may have up to 20 keys.

#6.2 Sending figures and events to your own monitoring

Give the platform an address that accepts OpenTelemetry over HTTP (OTLP/HTTP, JSON), and every half minute it sends there:

  • Figures, for each of your sessions that is running or paused in memory: memory in use, peak and limit, processors in use, and the share of time waiting for a processor.
  • Events, as log records: each session started, paused, resumed, ended, expired or failed, with how long the operation took.
  • Traces of your own API requests, sent every ten seconds: one span for each request, with the operation, the session and the time the platform took.
OperationWhat it does
GET/v1/telemetryThe current setting, or null
PUT/v1/telemetrySet or replace it
POST/v1/telemetry/testSend one test record now and report whether it was accepted
DELETE/v1/telemetryStop sending
Body field of PUTTypeMeaning
endpointstring, requiredThe base address, https:// only, reachable from the internet. /v1/metrics and /v1/logs are added to it
headersobjectUp to 10 headers your collector needs, for example {"Authorization": "Bearer ..."}. Stored encrypted and never returned: only their names are shown
metricsbooleanSend figures. Default true
eventsbooleanSend events. Default true
tracesbooleanSend traces of your requests. Default true
traceSamplingnumber, 0 to 1The share of requests traced when you send no trace header of your own. Default 0.1, one request in ten
curl -s -X PUT https://<your-platform-address>/v1/telemetry -H "Authorization: Bearer <API key>" \
  -d '{"endpoint": "https://otel.example.com", "headers": {"Authorization": "Bearer <collector token>"}}'
{"telemetry": {"endpoint": "https://otel.example.com", "headerNames": ["Authorization"], "metrics": true, "events": true, "traces": true, "traceSampling": 0.1,
  "updatedAt": "2026-11-27T05:10:00.000Z", "lastSent": {"at": "2026-11-27T05:10:30.000Z", "ok": true}}}
Figure sentUnitMeaning
microvm.session.memory.usedbytesMemory the session is using
microvm.session.memory.peakbytesThe most it has used
microvm.session.memory.limitbytesIts limit
microvm.session.cpu.usageprocessorsProcessors in use over the last half minute
microvm.session.cpu.waitingratio, 0 to 1Share of that time it wanted a processor and waited

Each figure carries session.id, session.pool, session.label and session.state. Each event carries event.name (session.started, session.paused, session.resumed, session.terminated, session.closed, session.expired, session.failed), the same session fields and duration.ms.

Traces of your requests. Each request you make to the API can be one span in your own tracing system, sent to /v1/traces of the same endpoint.

What you doWhat you get
Send a W3C traceparent header with a requestThe platform's span is a child of yours, in your trace: you see the platform's part of the request beside your own. A request you mark as sampled is always traced; one you mark as not sampled never is
Send no traceparentThe share of requests set by traceSampling is traced, each as a trace of its own
Call a session's own address (section 3.2)The same, and the traceparent passed to your software inside the session names the platform's span, so spans your software records there join the same trace

Each span is named for the operation, for example POST/v1/sessions/:id/pause, and carries http.request.method, http.route, http.response.status_code, session.id, error.type (the error code, if the request was refused or failed) and microvm.request_id (the x-request-id of the reply). Its duration is the time the platform took to answer. Every reply also carries an x-trace-id header with the trace's ID.

Traces are sent as they are and not kept: if your endpoint does not accept a batch, that batch is not sent again. At most 5,000 spans are held between two sendings for each API server; beyond that the newest are left out.

lastSent shows when the last batch of figures and events went and whether your collector accepted it; if it did not, error says what it answered. A batch that cannot be delivered is not retried for ever: after an interruption, events from at most the last 15 minutes are sent. Alerts are yours to set in your own monitoring, on these figures and events.

#6.3 Events pushed to your own address

Instead of asking what has happened, be told. Give an HTTPS address and choose the events; each is sent within a few seconds of happening.

OperationNotes
GET/v1/webhooksThe present setting and the last delivery, and eventTypes: every event that can be chosen
PUT/v1/webhooksBody: url (public, HTTPS), events (a list; left out: session.lost, session.expired, session.paused, session.short_of_memory), rotateSecret (true for a new signing secret). The reply carries secret the first time and after a rotation, and never again
POST/v1/webhooks/testSends one event of type test now and says whether your address accepted it
DELETE/v1/webhooksStops sending
EventWhen
session.started, session.endedA session started; a session was ended
session.paused, session.resumedWith data.cause: idle or request when the platform did it by itself (section 2.14)
session.recoveredA session was brought back after its MicroVM stopped. data.stateAsOf is the time its state is from (section 2.13)
session.expiredA session reached its longest life and was ended
session.lostA session's MicroVM stopped and it could not be brought back
session.short_of_memoryA session is using more of its memory than its threshold allows (section 2.8). data.usedPercent. Sent once, and again only if it is still so ten minutes later
budget.alertA budget level was passed (section 6.5). data: scope, label, level, percent, used, limit
key.cap_reachedAn API key reached its cap. data: key, keyName, cap, limit

One request carries up to 100 events:

{"deliveryId": "dlv_5b1f0c9e2a7d4411aa",
 "sentAt": "2026-11-28T09:15:07.412Z",
 "events": [{"id": "evt_0f4c2b7a9d1e3c5a7b9d1f3e", "type": "session.paused", "at": "2026-11-28T09:15:02.120Z",
             "session": "ses-6bf349e68de3", "pool": "browser-ready", "label": "user-42", "data": {"cause": "idle"}}]}

Checking that a request is ours. Every request carries X-MicroVM-Signature: t=<unix seconds>,v1=<signature>. The signature is the HMAC-SHA256, in hexadecimal, of the text <t>.<request body> with your signing secret as the key. Compute it over the body exactly as received, compare, and refuse a request whose t is more than five minutes old. The client libraries have a function for this (section 9).

Delivery. Answer with any 2xx status within 5 seconds. Anything else counts as not delivered, and the same events are sent again after 5, 10, 20, 40 and then every 60 seconds, for up to an hour; after that they are dropped. So an event can arrive more than once: its id is the same every time, so keep the IDs you have handled. Events arrive in the order they happened within one request, but a retried request can arrive after a newer one. GET/v1/webhooks shows whether the last delivery was accepted.

#6.4 Usage by label and by API key

OperationWhat it returns
GET/v1/usage?by=label or ?by=keyThe daily figures, with groups in each day: the same figures for each label, or for each key that started sessions
GET/v1/usage/summary?month=YYYY-MMThe month so far (or the month named): total, byLabel and byKey, in session-hours, memory GB-hours, paused hours and snapshot GB-hours; and spend with currency where prices have been agreed for your account
{"customer": "acme", "month": "2026-11", "priced": true,
 "total": {"sessionHours": 1841.2, "memoryGbHours": 1903.7, "pausedInMemoryHours": 211.4, "snapshotGbHours": 96.0, "sessionsStarted": 41270, "spend": 9268.5, "currency": "INR"},
 "byLabel": [{"label": "team-red", "sessionHours": 1210.0, "...": "..."}],
 "byKey": [{"key": "key-5f0805d710", "keyName": "production", "sessionHours": 1700.3, "...": "..."}]}

A session is counted under the label it was started with and the key that started it. Memory GB-hours is running time multiplied by the session's size, so a session started with more memory counts for more. A day keeps separate figures for up to 200 different labels; sessions with any further label that day are added together under (other), so the groups always add up. Use labels that name a team, a project or a tenant if you want costs by them; a different label for every end user is fine for finding sessions, but too many to be listed one by one here.

#6.5 Budget

OperationNotes
GET/v1/budgetThe budget, and progress: for the account and for each budgeted label, what has been used this month, the limit and the percentage
PUT/v1/budgetSets it. Body below
DELETE/v1/budgetRemoves it
FieldMeaning
monthlyThe account's limit for a calendar month (UTC): {"sessionHours": 2000}, and {"spend": 10000} where prices have been agreed
labelsLimits for up to 50 labels: {"team-red": {"sessionHours": 500}}
alertAtPercentages at which an alert is raised. Default [50, 80, 100]
enforcetrue: once the account's own limit is reached, new sessions are refused with 403 budget_reached until the month ends or the budget is changed. Sessions already running carry on. Default false: reaching a limit stops nothing
labels.<label>.enforcetrue makes that label's limit a quota: once the label has used it up, new sessions with that label are refused with 403 label_quota_reached until the month ends or the quota is changed. Sessions already running carry on. Your webhook receives label.quota_reached once

An alert is raised once for each level in a month, within about a minute of the level being passed: it appears in GET/v1/budget (alertsRaised) and in the console, and is pushed as a budget.alert event if you have set an address (section 6.3). A limit in money is only judged where prices have been agreed for your account.

#6.6 Exporting usage and the budget report

Usage by day, and the month's budget report, as a CSV file for a spreadsheet. In the console: the Usage page, "Export".

CallWhat it does
POST/v1/reportsAsks for a report. Body: kind (usage or budget); for usage, from and to as YYYY-MM-DD (both optional, at most 800 days); for budget, month as YYYY-MM (this month if left out); email (optional, see below)
GET/v1/reportsYour reports of the last seven days, newest first, each with its state: ready, queued or failed
GET/v1/reports/{id}One report. When it is ready, the file's content is in csv and its name in fileName

When the system is busy. A report is made at once when there is room, and the answer to POST/v1/reports then has "state": "ready". When the system is busy, a report is not made at that moment, so that it never slows your sessions:

  • without email, the answer is 503 system_busy. Ask again with an email address;
  • with email, the request is received ("state": "queued"). The report is made as soon as there is room, sent to that address with the file attached, and kept for download for seven days. At most five of your requests wait at a time (429 limit_reached after that).
curl -X POST $BASE/v1/reports -H "Authorization: Bearer $KEY" \
  -d '{"kind": "usage", "from": "2026-11-01", "to": "2026-11-28", "email": "you@example.com"}'

Reports on a schedule. A report can be made by itself and sent to you.

CallWhat it does
PUT/v1/reports/schedules/{name}Makes or changes a schedule. Body: kind; then either every (day, week or month) with hourUtc (0 to 23, default 1) and, for week, weekday (0 is Sunday; default 1), or everySessionHours (a budget report each time the month's use passes another that many session-hours); email (optional); webhook (default true)
GET/v1/reports/schedulesYour schedules
DELETE/v1/reports/schedules/{name}Removes one

A daily report covers the day before, a weekly one the seven days before, a monthly one the month before. A new schedule starts with the next period, not the one already begun. When the report is ready your webhook receives the event report.ready with the report's id and where to fetch it (fetch), and the file is sent to email if you gave one. At most 10 schedules an account. A scheduled report waits for room like any other.

The usage file has one line per day (UTC) with the same figures as GET/v1/usage. The budget report has the account against its budget, then every label and every key with its use for the month. Today's figures settle about a minute after a session ends. A key with the read role cannot ask for a report.

#6.7 Quotas and usage per end user

A session may carry user: any text of yours for one of your own users (up to 100 printable characters, no spaces). The platform does not know who your users are; it only keeps count for each.

CallWhat it does
POST/v1/sessions with "user": "<your user>"Starts the session for that user
PUT/v1/user-quotaSets the quota. Body: everyUser (the figures for every user) and, optionally, users (other figures for up to 200 named users). Figures: minutesPerDay (running minutes in a UTC day, up to 1,440) and sessionsAtOnce (1 to 1,000)
GET/v1/user-quota, DELETE/v1/user-quotaShows it; removes it
GET/v1/users/{user}What that user has used today and has in use: minutesToday, sessionsEndedToday, sessionsInUse, and with a quota minutesLeftToday
curl -X PUT $BASE/v1/user-quota -H "Authorization: Bearer $KEY" \
  -d '{"everyUser": {"minutesPerDay": 60, "sessionsAtOnce": 1}}'

A start that would pass either figure is refused with 403 user_quota_reached; the message says which. Sessions already running carry on. Paused time does not count as running minutes. A changed quota is in force everywhere within 20 seconds. Sessions without user are not affected. Setting the quota needs the admin role.

Labels (section 6.4) are for a few dozen teams or purposes and appear in every day's usage; user is for many users and is counted per user and day only. The per-user figures are kept for three days.

#6.8 Your own encryption key for saved states

Every saved state (a paused session's saved copy, a recovery point, a named saved state) is encrypted with a key of its own. You can give a key of yours under which all those keys are kept. While your key is held, nothing changes. When you withdraw it, every saved state made under it can no longer be opened, by you or by us.

CallWhat it does
POST/v1/encryption-keysGives a key: {"key": "<32 random bytes, in base64 or as 64 hexadecimal characters>"}. It becomes the key used from now on. It is never shown again
GET/v1/encryption-keysThe keys held, by id and date, and which is current. Never the keys themselves
DELETE/v1/encryption-keys/{id}Withdraws that key
curl -X POST $BASE/v1/encryption-keys -H "Authorization: Bearer $KEY" \
  -d "{\"key\": \"$(openssl rand -base64 32)\"}"
  • A newly given key is in use everywhere within half a minute. Saved states made before stay under the key (or the platform's own) they were made with.
  • Up to five keys are held at a time, so a key can be replaced: give the new one, and withdraw the old one when nothing made under it is needed any more.
  • After a withdrawal, resuming a session from a saved state made under that key answers 409 key_withdrawn. The session stays paused. A session paused in memory resumes as usual: its memory never left its machine.
  • Keep your own copy of the key only if you may want to give it again; we cannot give it back.
  • Volumes (section 3.6) are not covered by this key.

Needs the admin role.

#7. Console sign-in

People sign in to the console with a company login. Programs use API keys.

#7.1 Your own company login

An admin can connect the account to your own identity provider: Microsoft Entra ID, Okta, Google Workspace, Keycloak or any other that speaks OpenID Connect. At the provider, register the console as an application with the redirect address that GET/v1/signin returns.

OperationNotes
GET/v1/signinThe present setting (never the client secret), the redirectUri to register at your provider, and signInAddress: the console address your people use
PUT/v1/signinBody: issuer (your provider's issuer address: public, HTTPS), clientId, clientSecret, and who gets in, below
DELETE/v1/signinRemoves it. Everyone signed in through it is signed out at once
GET/v1/members, PUT/v1/members, DELETE/v1/members?user=People listed one by one: user (their username or email at your provider) and role

A person who signs in gets a role in one of three ways, tried in this order:

WaySetting
Listed by namePUT/v1/members with user and role
By the groups your provider reportsroleGroups: {"admin": ["platform-admins"], "developer": ["engineering"], "read": ["everyone"]}. A person in several gets the highest. groupsClaim names the claim that lists a person's groups, if it is not groups
By email domainallowDomains (for example ["example.com"]) with defaultRole

Someone who signs in correctly but fits none of these is not let in. Roles are as for API keys (section 6.1). Removing a person, or the sign-in itself, ends their console sessions within 10 seconds. Sign-ins are in your audit trail.

OperationNotes
GET/v1/auth/providersThe company logins that can be used
GET/v1/auth/login?provider=<id>For browsers. After signing in at the provider the browser returns to the console with a session valid for 8 hours
POST/v1/auth/logoutEnds the browser's console session

#8. What happens when something fails

EventWhat you see
A part of the platform restartsA request may get unavailable or node_unavailable with Retry-After. Existing sessions are intact
The machine holding a running session failsThe session's state becomes failed, with a reason. Start a new session
The machine holding a paused session failsOnce its snapshot is ready, the session resumes from a saved copy on another machine. resumedFrom is snapshot
A pool is emptyA MicroVM from another pool is handed over (servedFrom), or one is made on request (fromPool: false). Both take longer than a normal start
Every machine is fullno_capacity with Retry-After. More machines are being added
at oncePausedThe session stops where itstands. Your reply is sent.Not yet protected.a few seconds laterSaved, in two copiesIts memory is saved, encrypted,on two machines. It now survivesthe loss of a machine.a few minutes laterMemory releasedOnly the saved copies remain.A resume now takes about 0.3 sinstead of milliseconds.What happens after you pause a sessionsnapshot.status in the session shows "saving", then "ready"; snapshot.copies shows how many copies exist.
What happens after a pause

A paused session is protected against the loss of a machine from the moment snapshot.status is ready and snapshot.copies is 2.

#9. Client libraries and command-line tool

Libraries for Python and JavaScript, and a command-line tool, are supplied as package files. They need nothing beyond Python 3.8 or Node.js 18. Each covers every operation in this document, retries the "ask again shortly" answers for you, and has a function that checks a webhook's signature.

from microvm_platform import Client
mv = Client("https://<your-platform-address>", "<API key>")
s = mv.sessions.start(pool="browser-ready", label="user-42", idle_pause_seconds=300)
print(s.exec(["uname", "-a"]).stdout)
s.write_file("/tmp/input.json", b'{"a": 1}')
copy = s.pause().fork(label="experiment")
const { Client } = require('microvm-platform');
const mv = new Client('https://<your-platform-address>', '<API key>');
const s = await mv.sessions.start({ pool: 'browser-ready', label: 'user-42', idlePauseSeconds: 300 });
console.log((await s.exec(['uname', '-a'])).stdout);
export MICROVM_URL=https://<your-platform-address> MICROVM_API_KEY=<API key>
microvm start --pool browser-ready --label user-42 --idle-pause 300
microvm exec ses-6bf349e68de3 -- ls -la /tmp
microvm cp report.pdf ses-6bf349e68de3:/tmp/report.pdf
microvm usage --summary

#10. Every call, ready to copy

Each operation as one complete call, with every option it takes. The calls in this chapter are the ones the service itself is tested with: they are made, in this order, against a running platform before the document is published. A few cannot be made in a test (they need an address, a registry or an identity provider of yours) and say so.

export BASE=https://<your-platform-address>
export KEY=<API key>

#10.1 Before you start

Set these once in your terminal. Every call below uses them, so each can be pasted as it is. $ID and the other names in capitals further down are values taken from an earlier reply: the line after such a call shows how to keep it (it needs jq).

Who am I, and what are my limits

curl -s "$BASE/v1/account" \
  -H "Authorization: Bearer $KEY"

#10.2 Sessions

A session from start to end. The start below sets every option; leave out what you do not need (only pool is needed, and even that has a default).

Start a session, every option set

curl -s -X POST "$BASE/v1/sessions" \
  -H "Authorization: Bearer $KEY" \
  -H "Idempotency-Key: order-7731-start" -H "Content-Type: application/json" \
  -d '{
    "pool": "standard",
    "label": "order-7731",
    "user": "user-42",
    "record": true,
    "terminal": true,
    "volume": "user-42-home",
    "memoryMb": 2048,
    "processors": 1,
    "maxLifetimeSeconds": 7200,
    "idlePauseSeconds": 300,
    "autoResume": true,
    "saveEverySeconds": 120,
    "recover": true,
    "health": {"memoryPercent": 90, "waitingPercent": 10},
    "secrets": {"API_TOKEN": "<value>"}
  }' | tee reply.json
ID=$(jq -r .id reply.json)

outbound is left out: on the built-in queues it can only be "none". For a session of your own image add "outbound": {"allow": ["api.example.com:443"]} (only destinations the image allows) or "outbound": "none".

Get a session

curl -s "$BASE/v1/sessions/$ID" \
  -H "Authorization: Bearer $KEY"

List your sessions

curl -s "$BASE/v1/sessions" \
  -H "Authorization: Bearer $KEY"

A session's memory and processor over the last minutes

curl -s "$BASE/v1/sessions/$ID/metrics" \
  -H "Authorization: Bearer $KEY"

What the session's software printed (the last 200 lines)

curl -s "$BASE/v1/sessions/$ID/logs?tail=200" \
  -H "Authorization: Bearer $KEY"

Every live session at once, the unwell first

curl -s "$BASE/v1/observability" \
  -H "Authorization: Bearer $KEY"

Run a command in a session, every option set

curl -s -X POST "$BASE/v1/sessions/$ID/exec" \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{
    "command": ["sh", "-c", "cat; echo \"$GREETING\"; pwd"],
    "cwd": "/tmp",
    "env": ["GREETING=hello"],
    "stdin": "from standard input\n",
    "timeoutSeconds": 30
  }'

Put a file into a session

curl -s -X PUT "$BASE/v1/sessions/$ID/files?path=/tmp/in/notes.txt&mode=640" \
  -H "Authorization: Bearer $KEY" --data-binary @notes.txt

Take a file out of a session

curl -s "$BASE/v1/sessions/$ID/files?path=/tmp/in/notes.txt" \
  -H "Authorization: Bearer $KEY" -o notes-copy.txt

Reach the session's own software (anything after /proxy/ goes to it)

curl -s "$BASE/v1/sessions/$ID/proxy/health" \
  -H "Authorization: Bearer $KEY"

Not made in the test: needs a session whose image serves that path.

A task of the built-in agent (sessions of agent-ready and browser-ready)

curl -s -X POST "$BASE/v1/sessions/$ID/actions/state" \
  -H "Authorization: Bearer $KEY"

Not made in the test: the standard queue has no agent.

The tasks: open, login, add, draft, order, state, screenshot. state and screenshot are GET.

Pause a session

curl -s -X POST "$BASE/v1/sessions/$ID/pause" \
  -H "Authorization: Bearer $KEY"

Resume a session

curl -s -X POST "$BASE/v1/sessions/$ID/resume" \
  -H "Authorization: Bearer $KEY"

End a session

curl -s -X DELETE "$BASE/v1/sessions/$ID" \
  -H "Authorization: Bearer $KEY"

Not made in the test: ended at the end of the check.

Shown here for completeness. The calls on terminals and recordings below need the session, so end it after them.

#10.3 A terminal in a session

The session must have been started with "terminal": true.

Open a terminal

curl -s -X POST "$BASE/v1/sessions/$ID/terminals" \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"rows": 40, "cols": 132}' | tee reply.json
TID=$(jq -r .id reply.json)

Say that you are watching it (needed before reading; a read-only key may)

curl -s -X POST "$BASE/v1/sessions/$ID/terminals/$TID/viewers" \
  -H "Authorization: Bearer $KEY" | tee reply.json
VIEW=$(jq -r .viewer reply.json)

Type into it

curl -s -X POST "$BASE/v1/sessions/$ID/terminals/$TID/input" \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"text": "ls -la /tmp\n"}'

Send bytes instead of text (this one is Ctrl-C)

curl -s -X POST "$BASE/v1/sessions/$ID/terminals/$TID/input" \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"data": "Aw=="}'

Tell it the window changed size

curl -s -X POST "$BASE/v1/sessions/$ID/terminals/$TID/size" \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"rows": 50, "cols": 160}'

Read what it has shown (waits up to 20 s for something new; ask again from the seq it returns)

curl -s "$BASE/v1/sessions/$ID/terminals/$TID/output?viewer=$VIEW&after=0&waitMs=20000" \
  -H "Authorization: Bearer $KEY" | jq -r .data | base64 -d

The session's open terminals, and who is watching

curl -s "$BASE/v1/sessions/$ID/terminals" \
  -H "Authorization: Bearer $KEY"

Close a terminal (its recording is kept)

curl -s -X DELETE "$BASE/v1/sessions/$ID/terminals/$TID" \
  -H "Authorization: Bearer $KEY"

Your terminal recordings

curl -s "$BASE/v1/terminal-recordings" \
  -H "Authorization: Bearer $KEY"

One recording, to replay (cast is in the asciicast format)

curl -s "$BASE/v1/terminal-recordings/$TID" \
  -H "Authorization: Bearer $KEY"

Remove a terminal recording

curl -s -X DELETE "$BASE/v1/terminal-recordings/$TID" \
  -H "Authorization: Bearer $KEY"

#10.4 The recording of a session

The session must have been started with "record": true.

What has happened in it, every option set

curl -s "$BASE/v1/sessions/$ID/recording?after=0&limit=1000&kind=run,file,connect" \
  -H "Authorization: Bearer $KEY"

Your session recordings

curl -s "$BASE/v1/session-recordings" \
  -H "Authorization: Bearer $KEY"

One recording by its session, while it runs or after it has ended

curl -s "$BASE/v1/session-recordings/$ID?after=0&limit=5000" \
  -H "Authorization: Bearer $KEY"

The pictures of its screen

curl -s "$BASE/v1/session-recordings/$ID/pictures" \
  -H "Authorization: Bearer $KEY"

One picture (data is the image in base64)

curl -s "$BASE/v1/session-recordings/$ID/pictures/1" \
  -H "Authorization: Bearer $KEY"

A session with no screen has no pictures, and this answers 404.

Remove a recording (the session must have ended)

curl -s -X DELETE "$BASE/v1/session-recordings/$ID" \
  -H "Authorization: Bearer $KEY"

Not made in the test: made at the end of the check, after the session has ended.

#10.5 Saved states and copies

A paused session kept under a name, and sessions started from it. A session that holds a volume cannot be kept this way, so this uses a session without one.

Start the session to prepare

curl -s -X POST "$BASE/v1/sessions" \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"pool": "standard", "label": "to-prepare"}' | tee reply.json
PREP=$(jq -r .id reply.json)

Pause it

curl -s -X POST "$BASE/v1/sessions/$PREP/pause" \
  -H "Authorization: Bearer $KEY"

Keep its saved state under a name

curl -s -X POST "$BASE/v1/sessions/$PREP/save" \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"name": "prepared", "replace": true}'

The saved state must be finished first: wait until snapshot.status of the paused session (GET/v1/sessions/$PREP) is ready, about fifteen seconds after the pause. Sooner, this answers 409 no_saved_state.

Your saved states

curl -s "$BASE/v1/saved-states" \
  -H "Authorization: Bearer $KEY"

One saved state (state goes from saving to ready in a moment)

curl -s "$BASE/v1/saved-states/prepared" \
  -H "Authorization: Bearer $KEY"

Start a session from it, with the usual options

curl -s -X POST "$BASE/v1/sessions" \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{
    "fromState": "prepared",
    "label": "from-prepared",
    "user": "user-43",
    "terminal": true,
    "record": true,
    "idlePauseSeconds": 300
  }' | tee reply.json
FROM=$(jq -r .id reply.json)

Start a session as a copy of a paused one

curl -s -X POST "$BASE/v1/sessions/$PREP/fork" \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"label": "a-copy"}' | tee reply.json
COPY=$(jq -r .id reply.json)

Remove a saved state (sessions started from it are not affected)

curl -s -X DELETE "$BASE/v1/saved-states/prepared" \
  -H "Authorization: Bearer $KEY"

#10.6 Volumes

A volume is also made by itself when a session is started with a name that does not exist yet.

Make a volume, or change one, every option set

curl -s -X PUT "$BASE/v1/volumes/shared-data" \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"mode": "fast", "rollBack": false}'

Your volumes

curl -s "$BASE/v1/volumes" \
  -H "Authorization: Bearer $KEY"

One volume, with its size measured now

curl -s "$BASE/v1/volumes/shared-data" \
  -H "Authorization: Bearer $KEY"

Remove a volume and everything in it

curl -s -X DELETE "$BASE/v1/volumes/shared-data" \
  -H "Authorization: Bearer $KEY"

#10.7 Queues

A queue (the API calls it a pool) of your own is created by registering an image.

Create a queue of your own: register an image, every option set

curl -s -X POST "$BASE/v1/images" \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{
    "name": "my-agent",
    "image": "registry.example.com/team/agent:1.4",
    "port": 8080,
    "readyPath": "/health",
    "command": ["/app/server", "--port", "8080"],
    "env": ["LOG_LEVEL=info"],
    "memoryMb": 1024,
    "ready": 10,
    "registry": {"username": "<registry user>", "password": "<registry password>"},
    "copyFromTemplate": true,
    "startSeconds": 60,
    "health": {"memoryPercent": 90, "waitingPercent": 10},
    "outbound": {"allow": ["api.example.com:443", "db.example.com:5432"]},
    "storage": true,
    "idlePauseSeconds": 300,
    "autoResume": true,
    "recover": true,
    "saveEverySeconds": 120
  }'

Only name, image and port are required. "outbound" may also be "none" (the default) or "internet". "storage": true lets sessions of this image use volumes. Sending the same name again changes the image and its queue: for example a new "ready" to keep more or fewer waiting. Start a session from the queue with "pool": "my-agent".

Your images

curl -s "$BASE/v1/images" \
  -H "Authorization: Bearer $KEY"

The queues and how full each is

curl -s "$BASE/v1/pools" \
  -H "Authorization: Bearer $KEY"

Make a queue larger every week at the same hours

curl -s -X POST "$BASE/v1/schedules" \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{
    "pool": "standard",
    "target": 6,
    "label": "morning peak",
    "days": [1, 2, 3, 4, 5],
    "from": "08:30",
    "to": "11:00",
    "timezone": "Asia/Kolkata"
  }' | tee reply.json
SCHED=$(jq -r .id reply.json)

Make a queue larger once, for one period

curl -s -X POST "$BASE/v1/schedules" \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{
    "pool": "standard",
    "target": 6,
    "label": "launch day",
    "start": "2030-01-15T03:00:00Z",
    "end": "2030-01-15T09:00:00Z"
  }' | tee reply.json
SCHED2=$(jq -r .id reply.json)

Your schedules

curl -s "$BASE/v1/schedules" \
  -H "Authorization: Bearer $KEY"

Remove a schedule

curl -s -X DELETE "$BASE/v1/schedules/$SCHED" \
  -H "Authorization: Bearer $KEY"

Remove a queue of your own

curl -s -X DELETE "$BASE/v1/images/my-agent" \
  -H "Authorization: Bearer $KEY"

#10.8 API keys

Make a key, every option set (the key itself is shown once, in this reply)

curl -s -X POST "$BASE/v1/keys" \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{
    "label": "billing-service",
    "role": "developer",
    "expiresInDays": 90,
    "allowedSources": ["203.0.113.7", "198.51.100.0/24"],
    "caps": {"monthlySessionHours": 500}
  }' | tee reply.json
KEYID=$(jq -r .id reply.json)

role is admin, developer or read. expiresAt (a time) may be given in place of expiresInDays.

Your keys

curl -s "$BASE/v1/keys" \
  -H "Authorization: Bearer $KEY"

Change a key (send null to lift a limit)

curl -s -X PATCH "$BASE/v1/keys/$KEYID" \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{
    "label": "billing-service-eu",
    "allowedSources": null,
    "caps": {"monthlySessionHours": 800},
    "expiresAt": "2030-01-01T00:00:00Z"
  }'

Revoke a key

curl -s -X DELETE "$BASE/v1/keys/$KEYID" \
  -H "Authorization: Bearer $KEY"

#10.9 End users

Set the quota, every option set

curl -s -X PUT "$BASE/v1/user-quota" \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{
    "everyUser": {"minutesPerDay": 60, "sessionsAtOnce": 1},
    "users": {"user-42": {"minutesPerDay": 240, "sessionsAtOnce": 3}}
  }'

Show the quota

curl -s "$BASE/v1/user-quota" \
  -H "Authorization: Bearer $KEY"

What one user has used today

curl -s "$BASE/v1/users/user-42" \
  -H "Authorization: Bearer $KEY"

Remove the quota

curl -s -X DELETE "$BASE/v1/user-quota" \
  -H "Authorization: Bearer $KEY"

#10.10 Usage, budget and reports

Usage by day, every option set

curl -s "$BASE/v1/usage?from=2026-11-01&to=2026-11-30&by=label" \
  -H "Authorization: Bearer $KEY"

by is label or key; leave it out for totals only.

The month so far, by label and by key

curl -s "$BASE/v1/usage/summary?month=2026-11" \
  -H "Authorization: Bearer $KEY"

Set the budget, every option set

curl -s -X PUT "$BASE/v1/budget" \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{
    "monthly": {"sessionHours": 2000},
    "labels": {"team-red": {"sessionHours": 500, "enforce": true}, "team-blue": {"sessionHours": 300}},
    "alertAt": [50, 80, 100],
    "enforce": false
  }'

Show the budget and how much of it is used

curl -s "$BASE/v1/budget" \
  -H "Authorization: Bearer $KEY"

Remove the budget

curl -s -X DELETE "$BASE/v1/budget" \
  -H "Authorization: Bearer $KEY"

Ask for a usage export

curl -s -X POST "$BASE/v1/reports" \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{
    "kind": "usage",
    "from": "2026-11-01",
    "to": "2026-11-28",
    "email": "you@example.com"
  }' | tee reply.json
REP=$(jq -r .id reply.json)

Ask for a budget report

curl -s -X POST "$BASE/v1/reports" \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"kind": "budget", "month": "2026-11", "email": "you@example.com"}'

Your reports

curl -s "$BASE/v1/reports" \
  -H "Authorization: Bearer $KEY"

One report (csv holds the file when it is ready)

curl -s "$BASE/v1/reports/$REP" \
  -H "Authorization: Bearer $KEY"

A report every week, every option set

curl -s -X PUT "$BASE/v1/reports/schedules/weekly-usage" \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{
    "kind": "usage",
    "every": "week",
    "weekday": 1,
    "hourUtc": 1,
    "email": "you@example.com",
    "webhook": true
  }'

every is day, week or month.

A budget report each time the month's use passes another 100 session-hours

curl -s -X PUT "$BASE/v1/reports/schedules/by-use" \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"kind": "budget", "everySessionHours": 100, "webhook": true}'

Your report schedules

curl -s "$BASE/v1/reports/schedules" \
  -H "Authorization: Bearer $KEY"

Remove a report schedule

curl -s -X DELETE "$BASE/v1/reports/schedules/weekly-usage" \
  -H "Authorization: Bearer $KEY"

The audit trail, every option set

curl -s "$BASE/v1/audit?limit=100&method=POST&contains=sessions&failed=false" \
  -H "Authorization: Bearer $KEY"

Also from (a time), before (for the next page), key (one API key) and session (one session).

#10.11 Your own encryption key

Give a key (32 random bytes in base64; it is never shown back, so keep your own copy)

MYKEY=$(openssl rand -base64 32)   # store this somewhere safe first
curl -s -X POST "$BASE/v1/encryption-keys" \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d "{\"key\": \"$MYKEY\"}" | tee reply.json
CK=$(jq -r '.keys[0].id' reply.json)

Your keys (never the key itself)

curl -s "$BASE/v1/encryption-keys" \
  -H "Authorization: Bearer $KEY"

Withdraw a key (everything sealed under it becomes unreadable, for good)

curl -s -X DELETE "$BASE/v1/encryption-keys/$CK" \
  -H "Authorization: Bearer $KEY"

#10.12 Events and figures sent to you

Send events to your own address, every option set

curl -s -X PUT "$BASE/v1/webhooks" \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{
    "url": "https://hooks.example.com/microvm",
    "events": ["session.started", "session.ended", "session.paused", "session.resumed", "session.recovered", "session.expired", "session.lost", "session.short_of_memory", "budget.alert", "key.cap_reached", "label.quota_reached", "report.ready"],
    "rotateSecret": true
  }'

Not made in the test: needs an address of yours that answers.

Show the setting, the last delivery, and every event that can be chosen

curl -s "$BASE/v1/webhooks" \
  -H "Authorization: Bearer $KEY"

Send one test event now

curl -s -X POST "$BASE/v1/webhooks/test" \
  -H "Authorization: Bearer $KEY"

Not made in the test: needs the setting above.

Stop sending events

curl -s -X DELETE "$BASE/v1/webhooks" \
  -H "Authorization: Bearer $KEY"

Not made in the test: needs the setting above.

Send figures, events and traces to your own monitoring, every option set

curl -s -X PUT "$BASE/v1/telemetry" \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{
    "endpoint": "https://otel.example.com",
    "headers": {"Authorization": "Bearer <collector token>"},
    "metrics": true,
    "events": true,
    "traces": true,
    "traceSampling": 0.1
  }'

Not made in the test: needs a collector of yours that answers.

Show the setting

curl -s "$BASE/v1/telemetry" \
  -H "Authorization: Bearer $KEY"

Send one test record now

curl -s -X POST "$BASE/v1/telemetry/test" \
  -H "Authorization: Bearer $KEY"

Not made in the test: needs the setting above.

Stop sending

curl -s -X DELETE "$BASE/v1/telemetry" \
  -H "Authorization: Bearer $KEY"

Not made in the test: needs the setting above.

#10.13 Company login for the console

Connect your identity provider, every option set

curl -s -X PUT "$BASE/v1/signin" \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{
    "issuer": "https://login.example.com",
    "clientId": "<client id>",
    "clientSecret": "<client secret>",
    "allowDomains": ["example.com"],
    "defaultRole": "read",
    "roleGroups": {"admin": ["platform-admins"], "developer": ["engineering"], "read": ["everyone"]},
    "groupsClaim": "groups"
  }'

Not made in the test: needs a real identity provider.

Show the setting (never the secret) and the address to register at your provider

curl -s "$BASE/v1/signin" \
  -H "Authorization: Bearer $KEY"

Let one person in, with a role

curl -s -X PUT "$BASE/v1/members" \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"user": "asha@example.com", "role": "developer"}'

Not made in the test: needs the setting above.

The people listed one by one

curl -s "$BASE/v1/members" \
  -H "Authorization: Bearer $KEY"

Take one person off the list

curl -s -X DELETE "$BASE/v1/members?user=asha@example.com" \
  -H "Authorization: Bearer $KEY"

Not made in the test: needs the setting above.

Disconnect your identity provider

curl -s -X DELETE "$BASE/v1/signin" \
  -H "Authorization: Bearer $KEY"

Not made in the test: needs the setting above.

#10.14 Sessions that have ended

Ended sessions, every option set

curl -s "$BASE/v1/history?limit=100&state=ended&label=order-7731&find=order" \
  -H "Authorization: Bearer $KEY"

state is failed, expired or ended; before (the at of the last row you have) gives the next page.

One ended session in full: its last figures, lines and events

curl -s "$BASE/v1/history/$ID" \
  -H "Authorization: Bearer $KEY"

Not made in the test: made at the end of the check, after the session has ended.

Every example on this page can be run against your own account with an API key from the console's API keys page.