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
| Feature | What it does | Where it is described |
|---|---|---|
| A private MicroVM for each session | Each user session gets its own isolated MicroVM, never one that another session has used | Guide 1 · Reference 2.1 |
| Fast start | A session starts from a queue of ready MicroVMs in milliseconds | Guide 3 · Reference 2.2 |
| Pause and resume | Stops a session in milliseconds and brings it back exactly as it was, with nothing lost | Guide 3 · Reference 2.5 |
| Pause when idle, wake on request | A session pauses by itself after a quiet period and wakes on the next request | Reference 2.14 |
| Recovery and timed saves | A session whose MicroVM stops is brought back from its last saved point; a running session can be saved on a timer | Guide 5.5 · Reference 2.13 |
| A copy of a session | Starts a new session as an exact copy of a paused one | Guide 4.4 · Reference 2.15 |
| Its own size | Gives one session more memory, or a processor limit, than its queue's standard | Reference 2.2 |
Using a session
| Feature | What it does | Where it is described |
|---|---|---|
| The session's own address | Sends requests straight to the software running in the session | Guide 4.1 · Reference 3.2 |
| Run a command | Runs a command inside a session and returns its output | Guide 4.3 · Reference 3.3 |
| Files in and out | Puts a file into a session or takes one out | Guide 4.3 · Reference 3.4 |
| Secrets | Hands secrets to a session as files at its start; the platform does not keep them | Guide 4.3 · Reference 3.5 |
| The built-in browser agent | Opens pages, signs in and takes screenshots in the ready-made browser sessions | Guide 4.2 · Reference 3.1 |
| What a session may reach | Sets what a queue's sessions may reach on the internet; one session can narrow it further | Guide 6.3 · Reference 5.1 |
Files and prepared environments
| Feature | What it does | Where it is described |
|---|---|---|
| Volumes | A folder that outlives a session and is there in the user's next one, with a choice of quickest or safest writes | Guide 4.5 · Reference 3.6 |
| Named saved states | Keeps a paused session under a name; any number of new sessions start from it | Guide 4.6 · Reference 3.7 |
Seeing what happened
| Feature | What it does | Where it is described |
|---|---|---|
| A terminal, live and replayed | A shell in a session that several people can watch and type into at once; what it showed can be replayed for 30 days | Guide 4.7 · Reference 3.8 |
| Recording of a session | Records every program started, file opened and network connection, from outside the session, with pictures of its screen where it has one | Guide 4.8 · Reference 3.9 |
| Session health | Says whether a session is short of memory or waiting for a processor, and whose it is to fix | Guide 8.1 · Reference 2.8 |
| Live and ended sessions | Every live session's figures at once, and ended sessions' figures and events afterwards | Guide 8.1 · Reference 2.11 |
| What the session's software printed | The last lines a session's software wrote | Reference 2.10 |
| Audit trail | Every request: who made it, from where, the result and how long it took | Guide 8 |
Queues and capacity
| Feature | What it does | Where it is described |
|---|---|---|
| Built-in queues | Three ready-made queues: an empty MicroVM, one with a web agent, one with a browser open | Guide 2 · Reference 4.1 |
| Queues of your own images | Registering an image creates a queue of your own that keeps MicroVMs of it ready | Guide 6 · Reference 5.1 |
| Schedules | Makes a queue larger ahead of a peak you know is coming, every week or once | Guide 7 · Reference 4.2 |
Account and control
| Feature | What it does | Where it is described |
|---|---|---|
| API keys | Keys with a role, an expiry, the addresses they may be used from and a monthly cap | Guide 8 · Reference 6.1 |
| Company login | Your people sign in to the console with your own identity provider, each with a role | Guide 8.4 · Reference 7.1 |
| Quotas for your own users | Limits each of your users to minutes a day and sessions at once | Guide 8.5 · Reference 6.7 |
| Usage | Usage by day, by label and by API key | Guide 8 · Reference 6.4 |
| Budget and label quotas | A monthly budget with alerts; a label's limit can refuse new sessions once it is reached | Guide 8.3 · Reference 6.5 |
| Reports | Usage and budget reports on request, on a schedule or as use grows, by email or to your own address | Guide 8.5 · Reference 6.6 |
| Events pushed to you | Session, budget and key events sent to an address of yours, signed | Guide 8.2 · Reference 6.3 |
| Your own monitoring | Figures, events and traces sent to your own monitoring system | Guide 8.1 · Reference 6.2 |
| Your own encryption key | Seals saved states and recordings under a key you give and can withdraw | Guide 8.5 · Reference 6.8 |
Ways in
| Feature | What it does | Where it is described |
|---|---|---|
| Console | A web console for all of the above | Guide 9 |
| Every call, ready to copy | Each operation as one complete call with every option, tested before it is published | Reference 10 |
| Client libraries and a command-line tool | For JavaScript and Python, and from your own terminal | Guide 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 can | Typical time |
|---|---|
| Start a session for a user | 7 ms |
| Pause it when the user is idle | 16 ms |
| Resume it exactly as it was | 14 ms |
| End it | about 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.
#2. The ideas, in one page
| Idea | What it means for you |
|---|---|
| Session | One user's MicroVM, from start to end. You hold its ID |
| Pool | A set of ready MicroVMs of one kind. A start takes one from a pool |
| Image | Your own container image. Register it once and it gets a pool of its own |
| Pause | The session stops exactly where it is. Nothing runs inside it. It is also saved in two copies in the background |
| Resume | The 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 address | A 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.
#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
idlePauseSecondsis 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, answers409 not_runninguntil 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:
| Need | Operation |
|---|---|
| Run a program inside the session and get its output and exit status | POST/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 time | Design 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 disk | The session's own disk is faster, and nothing there costs storage |
| Choose the mode by what the data is | safe (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 mode | Unpacking 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 it | After 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
readrole 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
afterset 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
#5.1 The recommended flow for one user
- User arrives. Start a session with an
Idempotency-Keythat is unique to this attempt. Store the session ID against the user. - User is active. Send requests to the session's own address.
- User goes idle. Pause the session. A paused session costs less to hold and loses nothing.
- User returns. Resume the session, then continue.
- 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
| Rule | Why |
|---|---|
| Set a client timeout of a few seconds on start, pause, resume and end | They 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 randomness | So that many clients do not retry at the same instant |
Always send Idempotency-Key on start | If the reply is lost, a retry returns the same session instead of making a second one |
| Use a new key for each new session | For 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 freely | A pause of a paused session, or a resume of a running one, answers 200 with already: true |
Treat a network error like unavailable | Retry with the same rules |
#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.
| Do | Why |
|---|---|
| Reuse connections (keep-alive). Create one HTTP client when your application starts, and use it for every request | Opening 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 users | A 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 it | Each 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 it | A 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 delay | If 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 us | A 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
| Answer | Meaning | Your client should |
|---|---|---|
503 no_capacity | Every machine is full at this moment and more are being added | Wait and retry. Show the user "preparing your session" |
503 unavailable, 503 node_unavailable | A part of the service is restarting. Your session is intact | Wait and retry |
409 busy | Another change to the same session is in progress | Retry in a second |
429 rate_limited | You are sending more requests per second than your account allows | Slow down |
429 limit_reached | You have as many sessions as you are allowed at once | Do 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 session | What the platform does | What 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 lost | The request that met the stopped MicroVM gets 409 session_recovered: send it again. The session shows recoveredAt and stateAsOf |
| Has never been paused or saved | Nothing to bring back: its state becomes failed | 409 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.
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
| Rule | Why |
|---|---|
| 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 moment | That is what pause and resume do |
| Create nothing unique before it reports ready | Sessions 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 closed | Open connections to other services on first use, or reconnect |
Keep per-user secrets out of env | Every 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:
| Value | Meaning |
|---|---|
"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
memoryMbto 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
| Question | Answer |
|---|---|
| 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
| Need | Operation |
|---|---|
| What was used, per day | GET/v1/usage: sessions started and ended, time running and paused, snapshot storage |
| Who did what | GET/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 system | GET/v1/usage/summary: the account, each label and each key, in hours and, where prices are agreed, in money |
| A key for another system | POST/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 key | DELETE/v1/keys/{id}. It stops working everywhere within 15 seconds |
| Be told when something happens | PUT/v1/webhooks: events pushed to your own address (section 8.2) |
| Keep spending in bounds | PUT/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 accounts | PUT/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 to | Use |
|---|---|
| Know whether one session has the memory and processor it needs, now | health on GET/v1/sessions/{id}, and the session's page in the console |
| See how that changed over the last half hour | GET/v1/sessions/{id}/metrics, drawn as charts in the console |
| Read what your software printed | GET/v1/sessions/{id}/logs, also on the session's page |
| See all your live sessions together, the unwell first | The console's Observability page, or GET/v1/observability |
| See what a session was doing after it has ended or been lost | The 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 alerted | Have 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 it | Send 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 itA 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 afterwardsIf 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,
statusisready, and itsoutboundrule 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-Afterand stop after about 30 seconds. session_failedis 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-idof 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.
| Symptom | Likely cause | What to do |
|---|---|---|
A session is slow, health says short_of_memory | The session is close to its memory limit | Register the image with more memoryMb |
A session is slow, health says waiting_for_processor | It is not getting the processor it asks for | Ours to fix: send support the request's x-request-id |
401 unauthorized | The key is missing, mistyped, expired or revoked | Check the Authorization: Bearer header; list keys with a working key |
403 read_only | A read key was used for a change | Use a full key |
404 unknown_pool | The pool name is wrong, or the image is not registered | GET/v1/pools |
409 not_running on a request to a session | The session is paused and was not started to wake on request | Resume it first, or start such sessions with idlePauseSeconds (waking on the next request is then the default) |
409 busy | Two changes to one session at once | Retry in a second; avoid changing one session from two places at once |
429 limit_reached on start | Too many sessions exist | End idle sessions; check GET/v1/account |
429 rate_limited | Too many requests per second | Slow down; batch or cache GET requests |
503 no_capacity | A surge beyond what is ready | Retry; book known peaks with a schedule |
Starts report fromPool: false or servedFrom | The pool was empty | Raise the image's ready, or add a schedule |
An image stays failing | It cannot be pulled, does not become ready on its port, or has no start command | Read problem in GET/v1/images |
| A resumed session has lost its connection to another service | Connections do not survive in a copy or a restore from a saved copy | Reconnect on demand |
| Every session has the same "random" ID | It was created before your software reported ready | Create it on the session's first request |
A session shows failed | The machine holding it failed while it was running | Start 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 address | https://<your-platform-address> |
| Format | JSON in requests and replies |
| Authentication | Authorization: Bearer <API key> on every request |
| Times | Durations are in milliseconds and are measured inside the platform. Dates are ISO 8601, in UTC |
| Request size | Up to 100 KB, except requests to a session's own address (16 MB) |
#1.1 Terms
| Term | Meaning |
|---|---|
| MicroVM | A private, isolated machine for one session. It is never shared and never reused |
| Session | One user's use of one MicroVM, from start to end |
| Pool | A set of ready MicroVMs of one kind, from which sessions are started |
| Image | Your own container image. Each registered image gets a pool of its own |
| Snapshot | The 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.
| Status | Code | Meaning | What to do |
|---|---|---|---|
| 400 | bad_request | The request is not valid. The message says which field | Correct the request |
| 401 | unauthorized | No API key, or an unknown one | Check the key |
| 403 | read_only | The key can only read | Use a key with the full role |
| 403 | suspended | The account is suspended | Contact support |
| 403 | forbidden | The operation is not open to customers | Do not retry |
| 404 | not_found | No such session, key, schedule or image | Check the ID |
| 404 | unknown_pool | No such pool | Check the pool name with GET/v1/pools |
| 404 | unknown_action | No such task | Check the task name |
| 409 | busy | Another change to the same session is in progress | Retry after the Retry-After seconds |
| 409 | not_running | The session is ended, or paused and not set to wake on the next request (section 2.14) | Resume it first |
| 409 | not_paused | The session is ended or failed, and cannot be resumed | Start a new session |
| 409 | session_failed | The session was lost: its MicroVM stopped unexpectedly | Start a new session |
| 409 | snapshot_unavailable | The session has no usable snapshot to resume from | Start a new session |
| 409 | too_many | The account already has 20 keys or 20 schedules | Remove one |
| 413 | too_large | The request is larger than allowed | Send less |
| 429 | rate_limited | More requests per second than the account allows | Slow down; retry after Retry-After |
| 429 | limit_reached | The account is at a limit: sessions at once, images registered, or the size a schedule may ask for. The message says which | Retrying does not help until the limit is no longer reached |
| 400 | secrets_failed | The secrets could not be placed in the session, so it was not started | Secrets need a shell (sh) inside the image |
| 403 | forbidden | The key's or person's role does not allow this | Use an admin key (section 6.1) |
| 403 | source_not_allowed | The key is limited to other addresses | Call from an allowed address, or change the key's allowedSources |
| 403 | cap_reached | The key has reached its cap for the month | Use another key, raise the cap, or wait for the next month. Running sessions are not affected |
| 403 | budget_reached | The account's budget for the month is used up and is set to stop new sessions | Raise or remove the budget (section 6.5) |
| 404 | no_such_file | No such file in the session, or it cannot be read | Check the path |
| 409 | no_saved_state | The session has no saved state to start a copy from | Pause it and wait for snapshot.status to be ready |
| 409 | session_recovered | The session's MicroVM stopped and the session was brought back as it was at an earlier moment (section 2.13) | Send the request again |
| 500 | internal | Something went wrong on our side | Retry once; if it repeats, contact support with the requestId |
| 502 | action_failed | The task failed inside the session | Check the session with GET; retry if it is still running |
| 502 | exec_failed | The command could not be run inside the session | Check the session with GET; retry if it is still running |
| 503 | no_capacity | Every machine is full at this moment and more are being added | Retry after Retry-After |
| 503 | unavailable, node_unavailable | A part of the service is restarting. An existing session is intact | Retry 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.
| Limit | Meaning |
|---|---|
maxActiveSessions | Sessions that may exist at once, running or paused |
requestsPerSecond | Requests per second across all your keys |
maxSessionHours | The longest a session may live |
historyDays | How many days an ended session stays to be looked at (section 2.12). 7 unless a different number has been agreed, 30 at most |
maxScheduleTarget | The largest pool size a schedule may ask for |
maxSessionMemoryMb | The most memory one session may ask for when it starts (section 2.2). 4,096 unless agreed otherwise |
maxSessionProcessors | The most processors one session may ask for. 4 unless agreed otherwise |
maxVolumes | How many volumes the account may have (section 3.6). 100 unless agreed otherwise |
#1.5 Safe retries
| Operation | Safe to repeat? |
|---|---|
Any GET | Yes |
POST/v1/sessions | Yes, 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 |
| Pause | Yes. Pausing a paused session answers 200 with already: true |
| Resume | Yes. Resuming a running session answers 200 with already: true |
| End | Yes |
#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
}| Field | Meaning |
|---|---|
id | The session's ID |
state | running, paused, resuming, failed or terminated |
pool | The pool it was started from |
label | Your own reference, if you gave one |
address | The path of the session's own address (section 3.2) |
fromPool | true if a ready MicroVM was handed over. false if one had to be made on request, which takes longer |
servedFrom | Present when the named pool was empty and a MicroVM from another pool was handed over |
createdAt, pausedAt, expiresAt | When it started, when it was paused, and when it will end by itself |
resumesFrom | While paused: memory (resume takes milliseconds) or snapshot (a few hundred milliseconds) |
health | How 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 |
resumedFrom | After a resume: where it came back from |
snapshot | While paused: status is saving then ready; copies is how many saved copies exist |
memoryMb, processors | The session's own size, where it asked for one (section 2.2) |
idlePauseSeconds, autoResume | Present when the session pauses by itself when idle, and whether the next request wakes it (section 2.14) |
recoverableTo | While 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, stateAsOf | Present 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 |
forkedFrom | For a session started as a copy: the session it was copied from (section 2.15) |
reason | For a failed session: why |
events | The session's history |
ms | How long this operation took inside the platform |
already | true when a pause or resume changed nothing because the session was already in that state |
States
| State | Meaning | Allowed next |
|---|---|---|
running | In use | pause, end |
paused | Stopped exactly where it was. Nothing runs and no task is accepted | resume, end |
resuming | Being restored from a snapshot. Other requests get busy | (wait) |
failed | Lost. See reason | end |
terminated | Ended. The record stays readable for an hour | none |
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 field | Type | Meaning |
|---|---|---|
pool | string | standard, agent-ready, browser-ready, or the name of one of your images. Default browser-ready |
label | string | Your own reference, up to 100 characters |
maxLifetimeSeconds | integer | The session ends by itself after this long. Default and maximum: your account's limit |
memoryMb | integer | Memory 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 |
processors | number | The most processors this session may use, from 0.25 up to your account's maxSessionProcessors. Left out: not limited |
idlePauseSeconds | integer | Pause the session by itself after this many seconds without a request (30 to 86,400). Left out or 0: never. Section 2.14 |
autoResume | boolean | Wake a paused session when the next request for it arrives. Default: true when idlePauseSeconds is set, otherwise false |
recover | boolean | Whether 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 |
saveEverySeconds | integer | Save 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 |
health | object | This session's own thresholds, as for an image: {"memoryPercent": 90, "waitingPercent": 10} (section 2.8) |
secrets | object | Up to 20 names and values handed to the session as files (section 3.5). They are not kept by the platform |
outbound | string or object | What 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 |
user | string | One of your own users, for quotas and usage per user (section 6.7) |
volume | string | A 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 |
fromState | string | Start from a named saved state instead of a queue (section 3.7) |
terminal | boolean | true to allow terminals in this session (section 3.8). Without it the session has none |
record | boolean | true to record what happens inside this session (section 3.9). Off unless asked for |
from | string | Start 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:
memoryMbis 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.outboundis 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.fromStateandfromstart the session from a saved state instead of a queue (sections 3.7 and 2.15);poolis 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"
}| Field | Meaning |
|---|---|
verdict | healthy, short_of_memory, waiting_for_processor, paused, or unknown (the figures could not be read just now) |
note | The verdict in plain words, and what to do |
memory.usedMb, peakMb, limitMb | Memory in use now, the most it has used, and the session's limit |
processor.inUse | Processors in use over the last half minute: 0.14 is 14% of one processor |
processor.waitingPercent | The share of that time the session wanted a processor and had to wait |
thresholds | The values the verdict was judged against |
| Verdict | Whose to fix | What to do |
|---|---|---|
short_of_memory | Yours | Register the image with more memoryMb |
waiting_for_processor | Ours | Nothing 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}
]
}| Field | Meaning |
|---|---|
limitMb | The session's memory limit, for scale |
points[].memoryMb | Memory in use at that moment |
points[].processor | Processors in use over the 5 seconds before it: 0.14 is 14% of one processor |
points[].waitingPercent | The 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"]}| Field | Meaning |
|---|---|
lines | The lines, as your software wrote them |
earlierDropped | true 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
}| Field | Meaning |
|---|---|
totals | Counts across all your live sessions |
sessions[].verdict | As in section 2.8, or failed for a session that was lost and has not been ended yet |
sessions[].usedMb, peakMb, limitMb, memoryPercent | Memory now, the most it has used, its limit, and the share of the limit in use |
sessions[].processor, waitingPercent | Over the last half minute, as in section 2.8 |
more | How 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,expiredorfailed) 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.
| Query | Meaning |
|---|---|
limit | 1 to 500, default 100 |
before | The at of the last row you have: returns the ones before it |
state | failed, expired or ended: only those |
label | Only sessions with exactly this label |
find | Only 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 back | The session exactly as it was at its last pause: memory, open pages, sign-ins, files inside the MicroVM |
| What is lost | Everything done inside the session after that pause |
| What is not rolled back | Anything 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 told | The 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 paused | Has 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 pause | Happens within a few seconds after the idle time has passed. The session's paused event has cause: "idle" |
| The waking request | Waits 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: false | The session stays paused until you call resume; requests to it get 409 not_running |
autoResume: true without idlePauseSeconds | The session is paused only when you pause it, and wakes on the next request |
| Usage | A 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 is | The 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 else | Refused: 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 field | Type | Meaning |
|---|---|---|
command | list of strings | The program and its arguments, for example ["ls", "-la", "/tmp"]. For a shell line: ["sh", "-c", "..."] |
cwd | string | The folder to run it in |
env | list of strings | Extra variables, as NAME=value |
stdin | string | Text given to the command as its input |
timeoutSeconds | number | The 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
| Operation | Notes |
|---|---|
PUT/v1/sessions/{id}/files?path=/full/path | The 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/path | Returns 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 many | Up to 20 for a session; each value up to 8 KB. Names are letters, digits and underscores |
| Where they live | In 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 resume | They 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 session | Has them too (section 2.15) |
| If they cannot be placed | The 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.
| Operation | Notes |
|---|---|
GET/v1/volumes | Your 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 pools | Only an image registered with "storage": true can carry a volume. Any other pool answers 400 no_storage |
| One session at a time | A 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 resume | The volume stays with the session, also when the session is resumed from its saved copy on another machine |
| Starting | A 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 |
| Limits | Up to 100 volumes an account unless agreed otherwise |
| Usage | What 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.
| Call | What it does |
|---|---|
POST/v1/sessions/{id}/save | Keeps 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
readrole 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.
| Call | What it does |
|---|---|
POST/v1/sessions/{id}/terminals | Opens 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}/terminals | The 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}/input | Types 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-recordings | Your 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 -dTo 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 happenedThe 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 withDELETE, 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:
| Kind | What | Example |
|---|---|---|
run | Every program started, with its arguments and working folder | /usr/bin/python3 report.py --month 11 |
file | Every file opened: to read, to write, or newly made (make) | make /tmp/out/report.csv |
connect | Every network connection attempted, with address and port, and whether it was refused | 10.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.
| Call | What it does |
|---|---|
POST/v1/sessions with "record": true | Starts a recorded session. A copy of a recorded session is recorded too |
GET/v1/sessions/{id}/recording | The 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-recordings | Your 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}/pictures | The 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
afterset to the lastnext. - 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
gapsentry saying so. - Up to 1,500 pictures are kept for a session (
picturesCutsays 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
readkey 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:
| To | Call | Section |
|---|---|---|
| Create a queue of your own | POST/v1/images: registering an image creates a queue with the image's name; "ready" is how many MicroVMs it keeps waiting | 5.1 |
| See the queues and how full each is | GET/v1/pools | 4.1 |
| Make a queue larger for a period | POST/v1/schedules, with the queue's name and a target | 4.2 |
| Change how many your own queue keeps ready | POST/v1/images again with the same name and a new "ready" | 5.1 |
| Remove a queue of your own | DELETE/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}
]}| Field | Meaning |
|---|---|
ready | MicroVMs waiting now |
target | How many the platform is keeping ready at this moment |
normalTarget | The standing size |
automatic | The size demand currently calls for |
scheduled | The 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 field | Type | Meaning |
|---|---|---|
pool | string, required | The pool |
target | integer, required | Ready MicroVMs wanted |
label | string | Your own reference |
start, end | string | For a one-off period: ISO 8601 times |
days | array | For a weekly period: 0 (Sunday) to 6 (Saturday) |
from, to | string | For a weekly period: HH:MM |
timezone | string | For 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 field | Type | Meaning |
|---|---|---|
name | string, required | Your name for it, and the pool name. Lower-case letters, digits and hyphens |
image | string, required | Full image address, for example registry.example.com/team/agent:1.4. Pin a tag or a digest |
port | integer, required | The port your software listens on |
readyPath | string | A path that answers without a server error once your software is ready. Without it, an open port counts as ready |
command | array | Start command, if not the image's own |
env | array | Extra environment, as NAME=value. Never put per-user secrets here: every session gets the same |
memoryMb | integer | Memory for one MicroVM, 64 to 8192. Default 512 |
ready | integer | How many MicroVMs to keep ready. Default 2 |
registry | object | {"username": "...", "password": "..."} for a private registry. Stored encrypted and never returned |
copyFromTemplate | boolean | Default 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 |
startSeconds | integer | How long a fresh start may take before it counts as failed. Default 60 |
health | object | When 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 |
outbound | string or object | What 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, autoResume | integer, boolean | Every session of this image pauses when idle and wakes on the next request, unless a session says otherwise (section 2.14) |
storage | boolean | true: sessions of this image may be started with a volume (section 3.6). Default false |
recover | boolean | false: sessions of this image are not brought back from an earlier state when their MicroVM stops (section 2.13). Default true |
saveEverySeconds | integer | Save 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
| Operation | What it returns |
|---|---|
GET/v1/status | status is operational, limited (a pool is empty) or degraded, with the pools you can use and how many are ready |
GET/v1/account | Your limits and how many sessions you have in use |
GET/v1/usage?from=YYYY-MM-DD&to=YYYY-MM-DD | Per 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
| Operation | Notes |
|---|---|
GET/v1/keys | Lists keys: id, label, role, createdAt, expiresAt, lastUsedDay, allowedSources, caps. Never the key itself |
POST/v1/keys | Makes 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 |
| Field | Meaning |
|---|---|
label | The key's name. Give it one: the audit trail and the usage figures show it against everything the key does |
role | admin (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 expiresInDays | When the key stops working: a time, or a number of days from now. Left out: never |
allowedSources | Up 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.
| Operation | What it does |
|---|---|
GET/v1/telemetry | The current setting, or null |
PUT/v1/telemetry | Set or replace it |
POST/v1/telemetry/test | Send one test record now and report whether it was accepted |
DELETE/v1/telemetry | Stop sending |
Body field of PUT | Type | Meaning |
|---|---|---|
endpoint | string, required | The base address, https:// only, reachable from the internet. /v1/metrics and /v1/logs are added to it |
headers | object | Up to 10 headers your collector needs, for example {"Authorization": "Bearer ..."}. Stored encrypted and never returned: only their names are shown |
metrics | boolean | Send figures. Default true |
events | boolean | Send events. Default true |
traces | boolean | Send traces of your requests. Default true |
traceSampling | number, 0 to 1 | The 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 sent | Unit | Meaning |
|---|---|---|
microvm.session.memory.used | bytes | Memory the session is using |
microvm.session.memory.peak | bytes | The most it has used |
microvm.session.memory.limit | bytes | Its limit |
microvm.session.cpu.usage | processors | Processors in use over the last half minute |
microvm.session.cpu.waiting | ratio, 0 to 1 | Share 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 do | What you get |
|---|---|
Send a W3C traceparent header with a request | The 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 traceparent | The 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.
| Operation | Notes |
|---|---|
GET/v1/webhooks | The present setting and the last delivery, and eventTypes: every event that can be chosen |
PUT/v1/webhooks | Body: 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/test | Sends one event of type test now and says whether your address accepted it |
DELETE/v1/webhooks | Stops sending |
| Event | When |
|---|---|
session.started, session.ended | A session started; a session was ended |
session.paused, session.resumed | With data.cause: idle or request when the platform did it by itself (section 2.14) |
session.recovered | A session was brought back after its MicroVM stopped. data.stateAsOf is the time its state is from (section 2.13) |
session.expired | A session reached its longest life and was ended |
session.lost | A session's MicroVM stopped and it could not be brought back |
session.short_of_memory | A 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.alert | A budget level was passed (section 6.5). data: scope, label, level, percent, used, limit |
key.cap_reached | An 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
| Operation | What it returns |
|---|---|
GET/v1/usage?by=label or ?by=key | The 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-MM | The 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
| Operation | Notes |
|---|---|
GET/v1/budget | The budget, and progress: for the account and for each budgeted label, what has been used this month, the limit and the percentage |
PUT/v1/budget | Sets it. Body below |
DELETE/v1/budget | Removes it |
| Field | Meaning |
|---|---|
monthly | The account's limit for a calendar month (UTC): {"sessionHours": 2000}, and {"spend": 10000} where prices have been agreed |
labels | Limits for up to 50 labels: {"team-red": {"sessionHours": 500}} |
alertAt | Percentages at which an alert is raised. Default [50, 80, 100] |
enforce | true: 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>.enforce | true 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".
| Call | What it does |
|---|---|
POST/v1/reports | Asks 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/reports | Your 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 is503 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_reachedafter 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.
| Call | What 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/schedules | Your 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.
| Call | What it does |
|---|---|
POST/v1/sessions with "user": "<your user>" | Starts the session for that user |
PUT/v1/user-quota | Sets 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-quota | Shows 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.
| Call | What it does |
|---|---|
POST/v1/encryption-keys | Gives 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-keys | The 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.
| Operation | Notes |
|---|---|
GET/v1/signin | The present setting (never the client secret), the redirectUri to register at your provider, and signInAddress: the console address your people use |
PUT/v1/signin | Body: issuer (your provider's issuer address: public, HTTPS), clientId, clientSecret, and who gets in, below |
DELETE/v1/signin | Removes 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:
| Way | Setting |
|---|---|
| Listed by name | PUT/v1/members with user and role |
| By the groups your provider reports | roleGroups: {"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 domain | allowDomains (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.
| Operation | Notes |
|---|---|
GET/v1/auth/providers | The 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/logout | Ends the browser's console session |
#8. What happens when something fails
| Event | What you see |
|---|---|
| A part of the platform restarts | A request may get unavailable or node_unavailable with Retry-After. Existing sessions are intact |
| The machine holding a running session fails | The session's state becomes failed, with a reason. Start a new session |
| The machine holding a paused session fails | Once its snapshot is ready, the session resumes from a saved copy on another machine. resumedFrom is snapshot |
| A pool is empty | A 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 full | no_capacity with Retry-After. More machines are being added |
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.txtTake 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.txtReach 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 -dThe 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.