{
  "openapi": "3.0.3",
  "info": {
    "title": "MicroVM Platform API",
    "version": "1.6.0",
    "description": "Isolated browser sessions that start, pause and resume in milliseconds.\n\nEvery request needs `Authorization: Bearer <API key>`. Every response carries `x-request-id`; quote it when asking for support. You may send your own `x-request-id` to follow a request end to end. Errors have the shape `{error: {code, message, requestId}}`.\n\nTimes are in milliseconds and are measured inside the service. A session is one MicroVM for one user; it is never shared and never reused.\n\nWhen the answer is \"not now\". A request can be answered with an error that means \"ask again shortly\". Nothing is lost and no existing session is affected. Each such answer carries a `Retry-After` header with the number of seconds to wait.\n- `503 no_capacity`: every machine is full at this moment and more are on their way. Wait and ask again.\n- `503 unavailable` or `503 node_unavailable`: a part of the service is restarting. The session, if there is one, is intact. Wait and ask again.\n- `409 busy`: another change to the same session is in progress. Ask again.\n- `429 rate_limited`: you are sending more requests per second than your account allows. Slow down.\n- `429 limit_reached`: your account has as many sessions as it is allowed at once. Asking again does not help until a session ends.\nRecommended handling: retry with a growing wait (the `Retry-After` value, then double it, up to about 30 seconds in all, with a little randomness), show the user a short \"preparing your session\" message meanwhile, and send an `Idempotency-Key` header with `POST /v1/sessions` so that a retry after a lost reply returns the same session instead of making a second one. Quote the `requestId` from the error when asking for support.\n\nMaking your own image start fast. A session normally comes from a queue of MicroVMs that are already running, in a few milliseconds whatever your image contains. What is in your image matters in two places: when a queue is empty and a MicroVM has to be made on the spot, and in how quickly a queue refills after a burst. A new MicroVM is a copy of one that was started from your image once and saved at the moment it reported ready (`readyPath`). The more memory in use and the more processes running at that moment, the longer every copy takes. As a guide from our own measurements on our own images (yours will differ, so measure): about 60 ms to begin with, about half a millisecond for each MB of memory in use, and one to two milliseconds for each process. Our lightest image is copied in about 50 ms; one with a browser already open, about 80 MB in ten processes, in about 140 ms.\n- Report ready as soon as your software can serve its first request, and no later. Whatever it has loaded by then is copied into every session.\n- Load ahead only what every session needs. Leave large data, caches and optional libraries to first use.\n- Start as few processes as you can before reporting ready. A browser can be told to run with fewer helper processes.\n- Set `memoryMb` to what one session really needs: it decides how many sessions fit on a machine.\n- Create nothing unique before reporting ready. Random identifiers, keys and tokens made at start-up are identical in every copy; make them on the first request of a session.\n- Expect connections your software opened to other services before it reported ready to be closed in a copy. Open them on first use, or reconnect.\n- If your image cannot be copied, register it with `copyFromTemplate: false`. Every MicroVM is then started in full, which takes as long as your software takes to start; keep a larger queue (`ready`) to make up for it."
  },
  "servers": [
    {
      "url": "/"
    }
  ],
  "security": [
    {
      "key": []
    }
  ],
  "components": {
    "securitySchemes": {
      "key": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "requestId": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Sessions"
    },
    {
      "name": "Capacity"
    },
    {
      "name": "Account"
    },
    {
      "name": "Terminals",
      "description": "A shell in a session, watched live and replayed afterwards"
    },
    {
      "name": "Recordings",
      "description": "What happened inside a session started with \"record\": true"
    }
  ],
  "paths": {
    "/v1/sessions": {
      "get": {
        "summary": "List sessions",
        "tags": [
          "Sessions"
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        },
        "description": " With `?health=1` the first 60 live sessions carry `health`."
      },
      "post": {
        "summary": "Start a session",
        "tags": [
          "Sessions"
        ],
        "responses": {
          "200": {
            "description": "The result."
          },
          "404": {
            "description": "No such pool.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "`limit_reached`: your account's limit of sessions at once (asking again does not help until one ends). `rate_limited`: too many requests per second; slow down.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "`no_capacity`: every machine is full right now. Wait for the `Retry-After` seconds and ask again. `unavailable`: the service is briefly unavailable; the same.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "`cap_reached`: the API key has reached its cap for the month. `budget_reached`: the account's budget is used up and set to stop new sessions. `source_not_allowed`: the key cannot be used from this address.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "`no_saved_state`: with `from`, that session has no saved state to copy.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Takes a ready MicroVM from the named pool. If the pool is empty, a MicroVM from the next pool down is handed over at once and `servedFrom` in the reply names that pool; its first browser task then takes about a second longer. `fromPool: false` means every such pool was empty and one was made on request, which takes longer. Send an `Idempotency-Key` header to make a retry safe: the same key within a day returns the first session. A session may choose its own size and behaviour here (`memoryMb`, `processors`, `idlePauseSeconds`, `autoResume`, `recover`, `saveEverySeconds`, `health`), be given `secrets`, or begin as a copy of another session (`from`).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pool": {
                    "type": "string",
                    "description": "standard, agent-ready or browser-ready. Default browser-ready."
                  },
                  "label": {
                    "type": "string",
                    "description": "Your own reference, up to 100 characters."
                  },
                  "maxLifetimeSeconds": {
                    "type": "integer",
                    "description": "The session ends by itself after this long. Default and maximum: your account's limit."
                  },
                  "memoryMb": {
                    "type": "integer",
                    "description": "Memory for this session, from the pool's own size up to your account's maxSessionMemoryMb."
                  },
                  "processors": {
                    "type": "number",
                    "description": "The most processors this session may use, 0.25 up to your account's maxSessionProcessors."
                  },
                  "idlePauseSeconds": {
                    "type": "integer",
                    "description": "Pause the session by itself after this many seconds without a request (30 to 86400). 0 or left out: never."
                  },
                  "autoResume": {
                    "type": "boolean",
                    "description": "Wake a paused session when the next request for it arrives. Default true when idlePauseSeconds is set."
                  },
                  "recover": {
                    "type": "boolean",
                    "description": "Bring the session back from its last saved state if its MicroVM stops. Default: as its pool or image says."
                  },
                  "saveEverySeconds": {
                    "type": "integer",
                    "description": "Save the running session on a timer, 30 to 3600 seconds. Default: as its image says, which is never unless chosen."
                  },
                  "health": {
                    "type": "object",
                    "description": "This session's own thresholds: memoryPercent and waitingPercent."
                  },
                  "secrets": {
                    "type": "object",
                    "description": "Up to 20 names and values, placed in the session as files at /run/secrets/NAME. Not kept by the platform."
                  },
                  "from": {
                    "type": "string",
                    "description": "Start as a copy of this session's saved state instead of from a pool."
                  },
                  "volume": {
                    "type": "string",
                    "description": "A volume to start with. It appears at /volumes/<name>. Only for an image registered with storage: true. One session holds a volume at a time."
                  },
                  "outbound": {
                    "description": "What this one session may reach, where less than its image allows: \"none\" or {\"allow\": [\"host:port\", ...]}"
                  },
                  "user": {
                    "type": "string",
                    "description": "One of your own end users, for quotas and usage per user"
                  },
                  "fromState": {
                    "type": "string",
                    "description": "Start from a named saved state instead of a queue"
                  }
                },
                "required": []
              },
              "example": {
                "pool": "browser-ready",
                "label": "user-4812"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/v1/sessions/{id}": {
      "get": {
        "summary": "Get a session",
        "tags": [
          "Sessions"
        ],
        "responses": {
          "200": {
            "description": "The result."
          },
          "404": {
            "description": "No such session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Includes its event history and, while paused, the state of its snapshot. While the session is running or paused in memory the reply carries `health`: a verdict (healthy, short_of_memory, waiting_for_processor, paused, unknown), a note in plain words, memory in use against its limit, processor in use and the share of time spent waiting for one, and the thresholds used.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Session ID, for example ses-0123456789ab."
          }
        ]
      },
      "delete": {
        "summary": "End a session",
        "tags": [
          "Sessions"
        ],
        "responses": {
          "200": {
            "description": "The result."
          },
          "404": {
            "description": "No such session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Removes the MicroVM and every snapshot of it. The record stays readable for an hour.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Session ID, for example ses-0123456789ab."
          }
        ]
      }
    },
    "/v1/sessions/{id}/pause": {
      "post": {
        "summary": "Pause a session",
        "tags": [
          "Sessions"
        ],
        "responses": {
          "200": {
            "description": "The result."
          },
          "404": {
            "description": "No such session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The session is not in the right state, or is busy; code says which.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Stops the session at once and replies. A snapshot is then saved and copied in the background; `snapshot.status` becomes `ready` when it is safe. `resumesFrom` says whether the next resume will be from memory or from the snapshot. Safe to repeat: pausing a session that is already paused answers 200 with `already: true` and changes nothing, so a pause whose answer was lost can simply be sent again.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Session ID, for example ses-0123456789ab."
          }
        ]
      }
    },
    "/v1/sessions/{id}/resume": {
      "post": {
        "summary": "Resume a session",
        "tags": [
          "Sessions"
        ],
        "responses": {
          "200": {
            "description": "The result."
          },
          "404": {
            "description": "No such session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The session is not in the right state, or is busy; code says which.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "No capacity to restore right now; try again.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Brings the session back exactly as it was, including text typed but not sent. `resumedFrom` is `memory` (milliseconds) or `snapshot` (a few hundred milliseconds). Safe to repeat: resuming a session that is already running answers 200 with `already: true` and changes nothing, so a resume whose answer was lost can simply be sent again.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Session ID, for example ses-0123456789ab."
          }
        ]
      }
    },
    "/v1/sessions/{id}/actions/{name}": {
      "post": {
        "summary": "Run a browser task",
        "tags": [
          "Sessions"
        ],
        "responses": {
          "200": {
            "description": "The result."
          },
          "404": {
            "description": "No such session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The session is not in the right state, or is busy; code says which.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "The task failed inside the session.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Tasks of the built-in agent: open, login, add, draft, order, state, screenshot.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "user": {
                    "type": "string"
                  },
                  "password": {
                    "type": "string"
                  },
                  "sku": {
                    "type": "string"
                  },
                  "note": {
                    "type": "string"
                  }
                },
                "required": []
              },
              "example": {
                "sku": "rice"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Session ID, for example ses-0123456789ab."
          },
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "open",
                "login",
                "add",
                "draft",
                "order",
                "state",
                "screenshot"
              ]
            }
          }
        ]
      }
    },
    "/v1/pools": {
      "get": {
        "summary": "List pools",
        "tags": [
          "Capacity"
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        },
        "description": "Each pool is a set of ready MicroVMs of one kind. `ready` is how many are ready now."
      }
    },
    "/v1/schedules": {
      "get": {
        "summary": "List schedules",
        "tags": [
          "Capacity"
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        }
      },
      "post": {
        "summary": "Add a schedule",
        "tags": [
          "Capacity"
        ],
        "responses": {
          "200": {
            "description": "The result."
          },
          "400": {
            "description": "The schedule is not valid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Above your account's scheduling limit.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "description": "Asks for more ready MicroVMs in a pool for a period, once (`start`, `end`) or every week (`days`, `from`, `to`, `timezone`). Capacity is brought up a few minutes before the period starts. Automatic scaling still applies on top.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "pool": {
                    "type": "string"
                  },
                  "target": {
                    "type": "integer",
                    "description": "Ready MicroVMs wanted."
                  },
                  "label": {
                    "type": "string"
                  },
                  "start": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "end": {
                    "type": "string",
                    "format": "date-time"
                  },
                  "days": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "0 Sunday to 6 Saturday."
                  },
                  "from": {
                    "type": "string",
                    "description": "HH:MM"
                  },
                  "to": {
                    "type": "string",
                    "description": "HH:MM"
                  },
                  "timezone": {
                    "type": "string",
                    "description": "For example Asia/Kolkata."
                  }
                },
                "required": [
                  "pool",
                  "target"
                ]
              },
              "example": {
                "pool": "browser-ready",
                "target": 200,
                "days": [
                  1,
                  2,
                  3,
                  4,
                  5
                ],
                "from": "09:00",
                "to": "11:00",
                "timezone": "Asia/Kolkata"
              }
            }
          }
        }
      }
    },
    "/v1/schedules/{id}": {
      "delete": {
        "summary": "Remove a schedule",
        "tags": [
          "Capacity"
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/v1/status": {
      "get": {
        "summary": "Service status",
        "tags": [
          "Account"
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        },
        "description": "`operational`, `limited` (a pool is empty) or `degraded`."
      }
    },
    "/v1/account": {
      "get": {
        "summary": "Your account",
        "tags": [
          "Account"
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        },
        "description": "Your limits and how many sessions you have in use."
      }
    },
    "/v1/usage": {
      "get": {
        "summary": "Usage by day",
        "tags": [
          "Account"
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        },
        "description": "Sessions started and ended, time running and paused, and snapshot storage, per UTC day.",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "by",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "label",
                "key"
              ]
            },
            "description": "Adds `groups` to each day."
          }
        ]
      }
    },
    "/v1/audit": {
      "get": {
        "summary": "Audit trail",
        "tags": [
          "Account"
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        },
        "description": "Every change, browser task and refused request on your account, newest first, with the key used, the result and the caller's address. Kept for 30 days.",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "maximum": 500
            }
          },
          {
            "name": "before",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "The `at` of the last entry already seen, to page back."
          }
        ]
      }
    },
    "/v1/keys": {
      "get": {
        "summary": "List API keys",
        "tags": [
          "Account"
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        }
      },
      "post": {
        "summary": "Make an API key",
        "tags": [
          "Account"
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        },
        "description": "The key is shown once, in this reply. `role` is `admin` (everything), `developer` (sessions, images and schedules) or `read`. A key can be limited to addresses, given an end, and capped.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "description": "The key's name."
                  },
                  "role": {
                    "type": "string",
                    "enum": [
                      "admin",
                      "developer",
                      "read"
                    ]
                  },
                  "expiresInDays": {
                    "type": "integer",
                    "description": "Days until it stops working."
                  },
                  "expiresAt": {
                    "type": "string",
                    "description": "Or the time it stops working."
                  },
                  "allowedSources": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Addresses or ranges it may be used from."
                  },
                  "caps": {
                    "type": "object",
                    "description": "monthlySessionHours and, with prices agreed, monthlySpend."
                  }
                },
                "required": []
              },
              "example": {
                "label": "ci job",
                "role": "developer",
                "allowedSources": [
                  "203.0.113.0/24"
                ],
                "caps": {
                  "monthlySessionHours": 500
                }
              }
            }
          }
        }
      }
    },
    "/v1/keys/{id}": {
      "delete": {
        "summary": "Revoke an API key",
        "tags": [
          "Account"
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        },
        "description": "Takes effect everywhere within 15 seconds.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ]
      },
      "patch": {
        "summary": "Change a key's limits",
        "tags": [
          "Account"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "description": "Changes `label`, `allowedSources`, `caps` or `expiresAt`; `null` lifts a limit. The key itself does not change.",
        "responses": {
          "200": {
            "description": "The result."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "allowedSources": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Or null."
                  },
                  "caps": {
                    "type": "object",
                    "description": "Or null."
                  },
                  "expiresAt": {
                    "type": "string",
                    "description": "Or null."
                  }
                },
                "required": []
              },
              "example": {
                "allowedSources": null
              }
            }
          }
        }
      }
    },
    "/v1/images": {
      "get": {
        "summary": "List your images",
        "tags": [
          "Images"
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        },
        "description": "Each image you register gets its own pool of ready MicroVMs. `status` is `preparing`, `ready` or `failing`; when failing, `problem` says what to change."
      },
      "post": {
        "summary": "Register or update an image",
        "tags": [
          "Images"
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        },
        "description": "Registers a container image. A pool of ready MicroVMs made from it is kept, and sessions are started from it with `\"pool\": \"<name>\"`. Sending the same name again updates it: MicroVMs still waiting are replaced, sessions already running finish on the version they started from.\n\nThe image must listen on one port on all addresses (0.0.0.0), tolerate being frozen and resumed, and not create anything unique at start-up (MicroVMs are copies of one that was started once). Optional `health`: {memoryPercent 50-99 (default 90), waitingPercent 1-50 (default 10)}: when to call one of this image's sessions short of memory or kept waiting for a processor.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "image",
                  "port"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Your name for it; also the pool name. Lower-case letters, digits, hyphens."
                  },
                  "image": {
                    "type": "string",
                    "description": "Full image address, for example registry.example.com/team/agent:1.4. Pin a tag or a digest."
                  },
                  "port": {
                    "type": "integer",
                    "description": "The port the software in the image listens on."
                  },
                  "readyPath": {
                    "type": "string",
                    "description": "A path that answers without a server error once the image is ready. Without it, an open port counts as ready."
                  },
                  "command": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Start command, if not the image's own."
                  },
                  "env": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Extra environment, as NAME=value. Never put per-user secrets here: every session gets the same."
                  },
                  "memoryMb": {
                    "type": "integer",
                    "description": "Memory for one MicroVM, 64 to 8192. Default 512."
                  },
                  "ready": {
                    "type": "integer",
                    "description": "How many MicroVMs to keep ready. Default 2."
                  },
                  "registry": {
                    "type": "object",
                    "properties": {
                      "username": {
                        "type": "string"
                      },
                      "password": {
                        "type": "string"
                      }
                    },
                    "description": "Pull credential for a private registry. Stored encrypted; never returned."
                  },
                  "copyFromTemplate": {
                    "type": "boolean",
                    "description": "Default true: MicroVMs of the image are prepared in the quickest way, which needs the image to create nothing unique before it reports ready. Set false if it cannot."
                  },
                  "startSeconds": {
                    "type": "integer",
                    "description": "How long a fresh start may take before it counts as failed. Default 60."
                  },
                  "outbound": {
                    "description": "What MicroVMs of this image may reach. \"none\" (default): nothing. \"internet\": any public address on ports 80 and 443, with name lookups; for agents that browse wherever the user asks. {\"allow\": [\"host:port\", ...]}: only those destinations (a name, an address or a range). In every case other MicroVMs, our own network and all private address ranges are unreachable."
                  },
                  "idlePauseSeconds": {
                    "type": "integer",
                    "description": "Pause the session by itself after this many seconds without a request (30 to 86400). 0 or left out: never."
                  },
                  "autoResume": {
                    "type": "boolean",
                    "description": "Wake a paused session when the next request for it arrives. Default true when idlePauseSeconds is set."
                  },
                  "recover": {
                    "type": "boolean",
                    "description": "Bring the session back from its last saved state if its MicroVM stops. Default: as its pool or image says."
                  },
                  "saveEverySeconds": {
                    "type": "integer",
                    "description": "Save the running session on a timer, 30 to 3600 seconds. Default: as its image says, which is never unless chosen."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/images/{name}": {
      "delete": {
        "summary": "Remove an image",
        "tags": [
          "Images"
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        },
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "description": "Removes the image and its waiting MicroVMs. Sessions already running from it carry on until they end."
      }
    },
    "/v1/sessions/{id}/proxy/{path}": {
      "get": {
        "summary": "The session's own address",
        "tags": [
          "Sessions"
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "path",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "description": "Everything after `/proxy/` is passed, with any method, headers and body (up to 16 MB), to the port of the software inside this session's MicroVM, and its answer is passed back unchanged. Connections that stay open (WebSocket) pass too, so a browser inside the session can be driven from outside. Your API key is checked and is not passed on. A paused session answers 409 `not_running`. The session view gives this address as `address`."
      }
    },
    "/v1/auth/providers": {
      "get": {
        "summary": "Sign-in providers",
        "tags": [
          "Console sign-in"
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        },
        "security": [],
        "description": "The company logins that can be used to sign in to the console. Programs use API keys instead."
      }
    },
    "/v1/auth/login": {
      "get": {
        "summary": "Begin signing in",
        "tags": [
          "Console sign-in"
        ],
        "responses": {
          "302": {
            "description": "Sends the browser to the provider."
          }
        },
        "security": [],
        "parameters": [
          {
            "name": "provider",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "description": "For browsers. After signing in at the provider the browser returns to /v1/auth/callback and then to the console, holding a session cookie valid for 8 hours."
      }
    },
    "/v1/auth/logout": {
      "post": {
        "summary": "Sign out",
        "tags": [
          "Console sign-in"
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        },
        "description": "Ends the browser's console session."
      }
    },
    "/v1/sessions/{id}/metrics": {
      "get": {
        "summary": "A session's figures over time",
        "description": "The last half hour of memory, processor and waiting, one reading every 5 seconds, oldest first. Empty unless the session is running or paused in memory.",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Session ID, for example ses-0123456789ab."
          }
        ]
      }
    },
    "/v1/sessions/{id}/logs": {
      "get": {
        "summary": "What a session's software printed",
        "description": "The last lines written to standard output and standard error, oldest first. Only the most recent output is kept, up to 1,000 lines, and it is gone when the session ends.",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Session ID, for example ses-0123456789ab."
          },
          {
            "name": "tail",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000,
              "default": 200
            }
          }
        ]
      }
    },
    "/v1/telemetry": {
      "get": {
        "summary": "Where figures and events are sent",
        "description": "The current setting, or null. Header values are never returned, only their names.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "put": {
        "summary": "Send figures and events to your own monitoring",
        "description": "Every half minute the platform sends OpenTelemetry (OTLP/HTTP, JSON) to this address: figures for each running session, and a log record for each session started, paused, resumed, ended, expired or failed. Traces of your own API requests are sent every ten seconds: one span a request, a child of your own span when the request carries a W3C traceparent header.",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "endpoint"
                ],
                "properties": {
                  "endpoint": {
                    "type": "string",
                    "description": "https only, reachable from the internet"
                  },
                  "headers": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string"
                    },
                    "description": "Up to 10. Stored encrypted, never returned"
                  },
                  "metrics": {
                    "type": "boolean",
                    "default": true
                  },
                  "events": {
                    "type": "boolean",
                    "default": true
                  },
                  "traces": {
                    "type": "boolean",
                    "default": true,
                    "description": "Send a span for each of your API requests"
                  },
                  "traceSampling": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1,
                    "default": 0.1,
                    "description": "Share of requests traced when the request carries no traceparent header"
                  }
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Stop sending",
        "description": "Removes the setting.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/telemetry/test": {
      "post": {
        "summary": "Send one test record now",
        "description": "Reports whether your collector accepted it.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/observability": {
      "get": {
        "summary": "Every live session at once",
        "description": "All your live sessions with memory, processor and waiting, the unwell first, and counts across them. At most 2,000 sessions.",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "parameters": [
          {
            "name": "find",
            "in": "query",
            "description": "Only sessions whose label or session ID contains this text",
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/v1/history": {
      "get": {
        "summary": "Sessions that have ended",
        "description": "Each ended or lost session, newest first: how it ended and why, how long it lasted, the most memory it used. Kept for the days your account is set to (7 unless agreed otherwise).",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "description": "How many",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 100
            }
          },
          {
            "name": "before",
            "in": "query",
            "description": "The at of the last row already seen",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "state",
            "in": "query",
            "description": "Only these",
            "schema": {
              "type": "string",
              "enum": [
                "failed",
                "expired",
                "ended"
              ]
            }
          },
          {
            "name": "label",
            "in": "query",
            "description": "Only sessions with this label",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "find",
            "in": "query",
            "description": "Only sessions whose label or session ID contains this text",
            "schema": {
              "type": "string"
            }
          }
        ]
      }
    },
    "/v1/history/{id}": {
      "get": {
        "summary": "One ended session in full",
        "description": "Its last half hour of figures, the last lines its software printed, and what happened to it.",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "at",
            "in": "query",
            "description": "When it ended, if known: makes the answer quicker",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ]
      }
    },
    "/v1/sessions/{id}/fork": {
      "post": {
        "summary": "Start a session as a copy of another",
        "tags": [
          "Sessions"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "description": "A new session that begins as a copy of this session's saved state: everything in memory, every open page, every file. The session copied from must be paused with its snapshot saved, or running with a recovery point. The body takes the options of a start; what is left out follows the session copied from. Takes a few tenths of a second.",
        "responses": {
          "200": {
            "description": "The result."
          },
          "409": {
            "description": "`no_saved_state`: nothing to copy from yet.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "`no_capacity`: no machine holding the saved state has room right now.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "label": {
                    "type": "string",
                    "description": "Your own reference."
                  },
                  "memoryMb": {
                    "type": "integer",
                    "description": "Memory for this session, from the pool's own size up to your account's maxSessionMemoryMb."
                  },
                  "processors": {
                    "type": "number",
                    "description": "The most processors this session may use, 0.25 up to your account's maxSessionProcessors."
                  },
                  "idlePauseSeconds": {
                    "type": "integer",
                    "description": "Pause the session by itself after this many seconds without a request (30 to 86400). 0 or left out: never."
                  },
                  "autoResume": {
                    "type": "boolean",
                    "description": "Wake a paused session when the next request for it arrives. Default true when idlePauseSeconds is set."
                  },
                  "recover": {
                    "type": "boolean",
                    "description": "Bring the session back from its last saved state if its MicroVM stops. Default: as its pool or image says."
                  },
                  "saveEverySeconds": {
                    "type": "integer",
                    "description": "Save the running session on a timer, 30 to 3600 seconds. Default: as its image says, which is never unless chosen."
                  },
                  "health": {
                    "type": "object",
                    "description": "This session's own thresholds: memoryPercent and waitingPercent."
                  },
                  "secrets": {
                    "type": "object",
                    "description": "Up to 20 names and values, placed in the session as files at /run/secrets/NAME. Not kept by the platform."
                  }
                },
                "required": []
              },
              "example": {
                "label": "experiment-2"
              }
            }
          }
        }
      }
    },
    "/v1/sessions/{id}/exec": {
      "post": {
        "summary": "Run a command inside a session",
        "tags": [
          "Sessions"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "description": "Runs inside the session's MicroVM as the user its software runs as. Returns `exitCode`, `stdout`, `stderr` (up to 1 MB each; `truncated` if there was more), `timedOut` and `ms`. A paused session with `autoResume` is woken first.",
        "responses": {
          "200": {
            "description": "The result."
          },
          "409": {
            "description": "`not_running`: the session is paused and does not wake by itself.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "`exec_failed`: the command could not be run.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "command": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "The program and its arguments."
                  },
                  "cwd": {
                    "type": "string",
                    "description": "The folder to run it in."
                  },
                  "env": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Extra variables, as NAME=value."
                  },
                  "stdin": {
                    "type": "string",
                    "description": "Text given to the command as its input."
                  },
                  "timeoutSeconds": {
                    "type": "number",
                    "description": "1 to 600; default 60."
                  }
                },
                "required": [
                  "command"
                ]
              },
              "example": {
                "command": [
                  "sh",
                  "-c",
                  "ls -la /tmp"
                ],
                "timeoutSeconds": 30
              }
            }
          }
        }
      }
    },
    "/v1/sessions/{id}/files": {
      "get": {
        "summary": "Read a file from a session",
        "tags": [
          "Sessions"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "path",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "A full path inside the session."
          }
        ],
        "description": "Returns the file itself (`application/octet-stream`), up to 16 MB. Recorded in the audit trail.",
        "responses": {
          "200": {
            "description": "The file."
          },
          "404": {
            "description": "`no_such_file`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "put": {
        "summary": "Write a file into a session",
        "tags": [
          "Sessions"
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "path",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "A full path inside the session."
          },
          {
            "name": "mode",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Permissions, such as 640."
          }
        ],
        "description": "The request body is the file itself, up to 16 MB. Folders on the way are made.",
        "responses": {
          "200": {
            "description": "The result."
          },
          "413": {
            "description": "`too_large`: more than 16 MB.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/octet-stream": {
              "schema": {
                "type": "string",
                "format": "binary"
              }
            }
          }
        }
      }
    },
    "/v1/webhooks": {
      "get": {
        "summary": "Where events are pushed",
        "tags": [
          "Account"
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        },
        "description": "The setting, the last delivery, and every event type that can be chosen."
      },
      "put": {
        "summary": "Have events pushed to your own address",
        "tags": [
          "Account"
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        },
        "description": "Each chosen event is sent within a few seconds, as JSON, up to 100 in one request, signed in the header `X-MicroVM-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256 of \"<t>.<body>\" with the signing secret>`. Not answered with 2xx within 5 s, the same events are sent again for up to an hour; each event's `id` stays the same. The reply carries `secret` the first time and after a rotation only.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "Public, HTTPS."
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "session.started",
                        "session.paused",
                        "session.resumed",
                        "session.recovered",
                        "session.ended",
                        "session.expired",
                        "session.lost",
                        "session.short_of_memory",
                        "budget.alert",
                        "key.cap_reached"
                      ]
                    }
                  },
                  "rotateSecret": {
                    "type": "boolean",
                    "description": "Make a new signing secret."
                  }
                },
                "required": [
                  "url"
                ]
              },
              "example": {
                "url": "https://example.com/microvm-events",
                "events": [
                  "session.lost",
                  "session.paused"
                ]
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Stop pushing events",
        "tags": [
          "Account"
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        }
      }
    },
    "/v1/webhooks/test": {
      "post": {
        "summary": "Send a test event now",
        "tags": [
          "Account"
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        }
      }
    },
    "/v1/budget": {
      "get": {
        "summary": "The budget and how far it has come",
        "tags": [
          "Account"
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        }
      },
      "put": {
        "summary": "Set the budget",
        "tags": [
          "Account"
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        },
        "description": "Limits for a calendar month (UTC), for the account and for chosen labels. An alert is raised once for each level passed. With `enforce`, new sessions are refused once the account's limit is reached; running sessions are never stopped.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "monthly": {
                    "type": "object",
                    "description": "sessionHours and, with prices agreed, spend."
                  },
                  "labels": {
                    "type": "object",
                    "description": "Limits for up to 50 labels."
                  },
                  "alertAt": {
                    "type": "array",
                    "items": {
                      "type": "integer"
                    },
                    "description": "Default [50, 80, 100]."
                  },
                  "enforce": {
                    "type": "boolean",
                    "description": "Refuse new sessions at 100%."
                  }
                },
                "required": []
              },
              "example": {
                "monthly": {
                  "sessionHours": 2000
                },
                "labels": {
                  "team-red": {
                    "sessionHours": 500
                  }
                }
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Remove the budget",
        "tags": [
          "Account"
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        }
      }
    },
    "/v1/usage/summary": {
      "get": {
        "summary": "The month so far, by label and by key",
        "tags": [
          "Account"
        ],
        "parameters": [
          {
            "name": "month",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "YYYY-MM. Default: this month."
          }
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        },
        "description": "`total`, `byLabel` and `byKey`, in session-hours, memory GB-hours, paused hours and snapshot GB-hours; and `spend` where prices have been agreed."
      }
    },
    "/v1/signin": {
      "get": {
        "summary": "Your own company sign-in",
        "tags": [
          "Account"
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        },
        "description": "The setting (never the client secret), the redirect address to register at your provider, and the address your people sign in at."
      },
      "put": {
        "summary": "Connect your identity provider (OpenID Connect)",
        "tags": [
          "Account"
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        },
        "description": "Needs the admin role. Who gets in: people listed with `PUT /v1/members`, people in the groups named in `roleGroups`, or people from `allowDomains` with `defaultRole`.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "issuer": {
                    "type": "string",
                    "description": "Your provider's issuer address: public, HTTPS."
                  },
                  "clientId": {
                    "type": "string",
                    "description": ""
                  },
                  "clientSecret": {
                    "type": "string",
                    "description": "Needed the first time."
                  },
                  "roleGroups": {
                    "type": "object",
                    "description": "{admin: [groups], developer: [groups], read: [groups]}"
                  },
                  "groupsClaim": {
                    "type": "string",
                    "description": "The claim that lists a person's groups, if not `groups`."
                  },
                  "allowDomains": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Email domains let in without being listed."
                  },
                  "defaultRole": {
                    "type": "string",
                    "enum": [
                      "admin",
                      "developer",
                      "read"
                    ]
                  }
                },
                "required": [
                  "issuer",
                  "clientId"
                ]
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Remove the company sign-in",
        "tags": [
          "Account"
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        }
      }
    },
    "/v1/members": {
      "get": {
        "summary": "People listed one by one",
        "tags": [
          "Account"
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        }
      },
      "put": {
        "summary": "List a person",
        "tags": [
          "Account"
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "user": {
                    "type": "string",
                    "description": "Their username or email at your provider."
                  },
                  "role": {
                    "type": "string",
                    "enum": [
                      "admin",
                      "developer",
                      "read"
                    ]
                  }
                },
                "required": [
                  "user"
                ]
              },
              "example": {
                "user": "asha@example.com",
                "role": "developer"
              }
            }
          }
        }
      },
      "delete": {
        "summary": "Remove a person",
        "tags": [
          "Account"
        ],
        "parameters": [
          {
            "name": "user",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        }
      }
    },
    "/v1/volumes": {
      "get": {
        "summary": "List volumes",
        "tags": [
          "Sessions"
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        },
        "description": "Folders that outlive a session. A session started with `volume` finds it at `/volumes/<name>`."
      }
    },
    "/v1/volumes/{name}": {
      "put": {
        "summary": "Make or change a volume",
        "tags": [
          "Sessions"
        ],
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "mode": {
                    "type": "string",
                    "enum": [
                      "safe",
                      "fast"
                    ],
                    "description": "safe: a forced write is confirmed only when it is kept. fast: confirmed from the machine, kept a moment later."
                  },
                  "rollBack": {
                    "type": "boolean",
                    "description": "Whether the volume goes back with its session when the session is recovered. Default true."
                  }
                }
              },
              "example": {
                "mode": "safe"
              }
            }
          }
        }
      },
      "get": {
        "summary": "One volume, with its size",
        "tags": [
          "Sessions"
        ],
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The result."
          }
        }
      },
      "delete": {
        "summary": "Remove a volume and everything in it",
        "tags": [
          "Sessions"
        ],
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The result."
          },
          "409": {
            "description": "`volume_in_use`: a session holds it."
          }
        }
      }
    },
    "/v1/reports": {
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Ask for a usage export or a budget report",
        "description": "Made at once when there is room (`state` is `ready`). When the system is busy: without `email` the answer is `503 system_busy`; with `email` the request waits (`state` is `queued`), the report is made when there is room, sent to that address and kept for download for seven days.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "kind"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "usage",
                      "budget"
                    ]
                  },
                  "from": {
                    "type": "string",
                    "example": "2026-11-01"
                  },
                  "to": {
                    "type": "string",
                    "example": "2026-11-28"
                  },
                  "month": {
                    "type": "string",
                    "example": "2026-11"
                  },
                  "email": {
                    "type": "string",
                    "format": "email"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The report, ready or waiting",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "example": "rep-3f9a1c2b7d10"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "usage",
                        "budget"
                      ]
                    },
                    "from": {
                      "type": "string"
                    },
                    "to": {
                      "type": "string"
                    },
                    "month": {
                      "type": "string"
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "ready",
                        "queued",
                        "failed"
                      ]
                    },
                    "askedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "readyAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "email": {
                      "type": "string"
                    },
                    "emailedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "fileName": {
                      "type": "string"
                    },
                    "bytes": {
                      "type": "integer"
                    },
                    "keptUntil": {
                      "type": "string",
                      "format": "date-time"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "`system_busy`: the system is busy; ask again with an email address"
          }
        }
      },
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Your reports of the last seven days",
        "description": "Newest first.",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "reports": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "example": "rep-3f9a1c2b7d10"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "usage",
                              "budget"
                            ]
                          },
                          "from": {
                            "type": "string"
                          },
                          "to": {
                            "type": "string"
                          },
                          "month": {
                            "type": "string"
                          },
                          "state": {
                            "type": "string",
                            "enum": [
                              "ready",
                              "queued",
                              "failed"
                            ]
                          },
                          "askedAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "readyAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "email": {
                            "type": "string"
                          },
                          "emailedAt": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "fileName": {
                            "type": "string"
                          },
                          "bytes": {
                            "type": "integer"
                          },
                          "keptUntil": {
                            "type": "string",
                            "format": "date-time"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/reports/{id}": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "One report, with its file when ready",
        "description": "When `state` is `ready` the CSV is in `csv` and its name in `fileName`.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string",
                      "example": "rep-3f9a1c2b7d10"
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "usage",
                        "budget"
                      ]
                    },
                    "from": {
                      "type": "string"
                    },
                    "to": {
                      "type": "string"
                    },
                    "month": {
                      "type": "string"
                    },
                    "state": {
                      "type": "string",
                      "enum": [
                        "ready",
                        "queued",
                        "failed"
                      ]
                    },
                    "askedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "readyAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "email": {
                      "type": "string"
                    },
                    "emailedAt": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "fileName": {
                      "type": "string"
                    },
                    "bytes": {
                      "type": "integer"
                    },
                    "keptUntil": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "csv": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/sessions/{id}/save": {
      "post": {
        "tags": [
          "Sessions"
        ],
        "summary": "Keep a paused session's saved state under a name",
        "description": "The session must be paused and its saved state finished. Answers at once with state \"saving\".",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "replace": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/saved-states": {
      "get": {
        "tags": [
          "Sessions"
        ],
        "summary": "Your named saved states",
        "description": "Kept in object storage; they outlive their sessions.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/saved-states/{name}": {
      "get": {
        "tags": [
          "Sessions"
        ],
        "summary": "One named saved state",
        "description": "",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "tags": [
          "Sessions"
        ],
        "summary": "Remove a named saved state",
        "description": "Sessions already started from it are not affected.",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/user-quota": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "The quota for your end users",
        "description": "",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "put": {
        "tags": [
          "Account"
        ],
        "summary": "Set the quota for your end users",
        "description": "everyUser: the figures for every user; users: other figures for named users. Figures: minutesPerDay, sessionsAtOnce.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "everyUser": {
                    "type": "object"
                  },
                  "users": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "tags": [
          "Account"
        ],
        "summary": "Remove the quota",
        "description": "",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/users/{user}": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "What one of your end users has used today and has in use",
        "description": "",
        "parameters": [
          {
            "name": "user",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/encryption-keys": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Your encryption keys, by id",
        "description": "Never the keys themselves.",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "post": {
        "tags": [
          "Account"
        ],
        "summary": "Give an encryption key for your saved states",
        "description": "32 random bytes in base64 or hexadecimal. It becomes the key used from now on and is never shown again.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "key": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/encryption-keys/{id}": {
      "delete": {
        "tags": [
          "Account"
        ],
        "summary": "Withdraw an encryption key",
        "description": "Every saved state made under it can no longer be opened.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/reports/schedules": {
      "get": {
        "tags": [
          "Account"
        ],
        "summary": "Your report schedules",
        "description": "",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/reports/schedules/{name}": {
      "put": {
        "tags": [
          "Account"
        ],
        "summary": "Make or change a report schedule",
        "description": "every (day, week, month) with hourUtc, or everySessionHours; email and webhook say where the report goes.",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "usage",
                      "budget"
                    ]
                  },
                  "every": {
                    "type": "string",
                    "enum": [
                      "day",
                      "week",
                      "month"
                    ]
                  },
                  "hourUtc": {
                    "type": "integer"
                  },
                  "weekday": {
                    "type": "integer"
                  },
                  "everySessionHours": {
                    "type": "number"
                  },
                  "email": {
                    "type": "string"
                  },
                  "webhook": {
                    "type": "boolean"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "tags": [
          "Account"
        ],
        "summary": "Remove a report schedule",
        "description": "",
        "parameters": [
          {
            "name": "name",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/sessions/{id}/terminals": {
      "post": {
        "tags": [
          "Terminals"
        ],
        "summary": "Open a terminal in a session",
        "description": "The session must have been started with \"terminal\": true and be running. At most four open at a time.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "rows": {
                    "type": "integer",
                    "minimum": 5,
                    "maximum": 300
                  },
                  "cols": {
                    "type": "integer",
                    "minimum": 20,
                    "maximum": 500
                  }
                }
              }
            }
          }
        }
      },
      "get": {
        "tags": [
          "Terminals"
        ],
        "summary": "The session's open terminals",
        "description": "",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/sessions/{id}/terminals/{terminal}": {
      "delete": {
        "tags": [
          "Terminals"
        ],
        "summary": "Close a terminal and keep its recording",
        "description": "",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "terminal",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/sessions/{id}/terminals/{terminal}/viewers": {
      "post": {
        "tags": [
          "Terminals"
        ],
        "summary": "Say that you are watching a terminal",
        "description": "Written to the audit trail and onto the recording. Allowed to a key with the read role. Answers the viewer id that reading the output needs.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "terminal",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/sessions/{id}/terminals/{terminal}/output": {
      "get": {
        "tags": [
          "Terminals"
        ],
        "summary": "What a terminal has shown",
        "description": "Answers data (base64), seq, closed, rows and cols. With waitMs the call waits for something new.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "terminal",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "viewer",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Position to read from; 0 at first, then the last seq"
          },
          {
            "name": "waitMs",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "Up to 25000"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/sessions/{id}/terminals/{terminal}/input": {
      "post": {
        "tags": [
          "Terminals"
        ],
        "summary": "Type into a terminal",
        "description": "Give text, or bytes in base64 as data. Up to 64 KB at a time. Keystrokes are not recorded as such; what the terminal shows of them is.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "terminal",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string"
                  },
                  "data": {
                    "type": "string",
                    "description": "base64"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/sessions/{id}/terminals/{terminal}/size": {
      "post": {
        "tags": [
          "Terminals"
        ],
        "summary": "Change a terminal's size",
        "description": "",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "terminal",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "rows": {
                    "type": "integer"
                  },
                  "cols": {
                    "type": "integer"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v1/terminal-recordings": {
      "get": {
        "tags": [
          "Terminals"
        ],
        "summary": "Terminal recordings",
        "description": "Kept 30 days. Newest first.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/terminal-recordings/{terminal}": {
      "get": {
        "tags": [
          "Terminals"
        ],
        "summary": "One recording, to replay",
        "description": "cast is the recording in the asciicast version 2 format.",
        "parameters": [
          {
            "name": "terminal",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "tags": [
          "Terminals"
        ],
        "summary": "Remove a recording",
        "description": "",
        "parameters": [
          {
            "name": "terminal",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/sessions/{id}/recording": {
      "get": {
        "tags": [
          "Recordings"
        ],
        "summary": "What happened inside a recorded session",
        "description": "For a session started with \"record\": true, while it runs or after. Programs started, files opened, network connections.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "The number of the last event already held"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "1 to 5000, default 1000"
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "run, file or connect; several with commas"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/session-recordings": {
      "get": {
        "tags": [
          "Recordings"
        ],
        "summary": "Session recordings",
        "description": "Kept 30 days after the session ends.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/session-recordings/{session}": {
      "get": {
        "tags": [
          "Recordings"
        ],
        "summary": "One session recording",
        "description": "",
        "parameters": [
          {
            "name": "session",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "after",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "The number of the last event already held"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer"
            },
            "description": "1 to 5000, default 1000"
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "run, file or connect; several with commas"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      },
      "delete": {
        "tags": [
          "Recordings"
        ],
        "summary": "Remove a session recording",
        "description": "The session must have ended.",
        "parameters": [
          {
            "name": "session",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/session-recordings/{session}/pictures": {
      "get": {
        "tags": [
          "Recordings"
        ],
        "summary": "Pictures of a recorded session's screen",
        "description": "Taken every two seconds, kept when the screen changed. A virtual display inside the session, or the page of the service's own browser queue.",
        "parameters": [
          {
            "name": "session",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/v1/session-recordings/{session}/pictures/{n}": {
      "get": {
        "tags": [
          "Recordings"
        ],
        "summary": "One picture",
        "description": "data is the image in base64; type is image/png or image/qoi.",
        "parameters": [
          {
            "name": "session",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "n",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The picture's number"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  }
}