# API reference: schemas

Every schema of the OpenAPI document, in the document's order. A field that is not required can be left out of a request, and is left out of a response when it has no value.

## MachineID

Type: string. Matches `^m_[0-9a-hjkmnp-tv-z]{26}$`.

## SnapshotID

Type: string. Matches `^snap_[0-9a-hjkmnp-tv-z]{26}$`.

## SSHKeyID

Type: string. Matches `^sshkey_[0-9a-hjkmnp-tv-z]{26}$`.

## APIKeyID

Type: string. Matches `^key_[0-9a-hjkmnp-tv-z]{26}$`.

## OrgID

Type: string. Matches `^org_[0-9a-hjkmnp-tv-z]{26}$`.

## UserID

Type: string. Matches `^usr_[0-9a-hjkmnp-tv-z]{26}$`.

## EventID

Type: string. Matches `^evt_[0-9a-hjkmnp-tv-z]{26}$`.

## GrantID

Type: string. Matches `^grant_[0-9a-hjkmnp-tv-z]{26}$`.

## LedgerEntryID

Type: string. Matches `^le_[0-9a-hjkmnp-tv-z]{26}$`.

## FeedbackID

Type: string. Matches `^fb_[0-9a-hjkmnp-tv-z]{26}$`.

## Name

A DNS label, lowercase letters, digits and hyphens, starting with a letter and at most 48 characters. For machines, `probe` is reserved for the SSH connectivity probe and rejected with 400 `invalid_request`.

Type: string. Matches `^[a-z]([a-z0-9-]{0,46}[a-z0-9])?$`.

## Labels

Up to 32 key and value pairs to find and group machines by.

Type: map of string to string. Maximum entries: `32`.

## Env

Environment variables set for every session and command in the machine.

Type: map of string to string. Maximum entries: `128`.

## ErrorCode

A stable string to switch on. New codes are added over time; treat one you do not know as its
HTTP status.

Type: string. One of `invalid_request`, `unauthenticated`, `forbidden`, `not_found`, `rate_limited`, `internal`, `invalid_login_code`, `invalid_signature`, `insufficient_balance`, `limit_exceeded`, `org_suspended`, `subscription_required`, `no_capacity`, `disk_unreachable`, `snapshot_unreachable`, `name_taken`, `idempotency_key_reused`, `idempotency_request_in_progress`, `machine_not_running`, `machine_not_stopped`, `machine_has_no_disk`, `disk_cannot_shrink`, `machine_restoring`, `machine_unreachable`, `exec_outcome_unknown`, `image_not_published`, `snapshot_not_ready`, `snapshot_in_use`, `snapshot_in_progress`, `ssh_key_exists`, `file_not_found`, `not_a_file`, `not_a_directory`, `directory_not_empty`, `subscription_exists`, `no_billing_account`, `payment_method_required`, `read_only_key`, `trial_ineligible`, `turnstile_failed`, `length_required`, `payload_too_large`.

## FieldError

| Field | Type | Required | Description |
|---|---|---|---|
| `field` | string | yes | The request field, as a JSON pointer without the leading slash, or a parameter name. |
| `message` | string | yes |  |

## Problem

An RFC 9457 problem, with a stable `code`.

| Field | Type | Required | Description |
|---|---|---|---|
| `type` | string (uri) | yes | A URI that identifies the problem type and leads to its documentation. |
| `title` | string | yes | One sentence that is the same for every problem of this type. |
| `status` | integer (int32) | yes | Minimum: `400`. Maximum: `599`. |
| `detail` | string | no | What went wrong this time, written for the person who made the request. |
| `code` | [ErrorCode](#errorcode) | yes |  |
| `errors` | array of [FieldError](#fielderror) | no | One entry per field that is not valid. |
| `request_id` | string | no | The value of `X-Request-Id`, to quote in a support request. |

## EmailLoginStart

| Field | Type | Required | Description |
|---|---|---|---|
| `email` | string (email) | yes | Maximum length: `254`. |

## EmailLoginStarted

| Field | Type | Required | Description |
|---|---|---|---|
| `expires_in_seconds` | integer (int32) | yes |  |

## EmailLoginVerify

| Field | Type | Required | Description |
|---|---|---|---|
| `email` | string (email) | yes | Maximum length: `254`. |
| `code` | string | yes | Matches `^[0-9]{6}$`. |

## Session

| Field | Type | Required | Description |
|---|---|---|---|
| `user` | [User](#user) | yes |  |
| `org` | [Org](#org) | yes |  |

## DeviceLoginStart

| Field | Type | Required | Description |
|---|---|---|---|
| `client_name` | string | no | What the approval page shows, for example the computer's hostname. Maximum length: `100`. |

## DeviceLogin

| Field | Type | Required | Description |
|---|---|---|---|
| `device_code` | string | yes | The CLI's secret for polling. Never shown to the user. |
| `user_code` | string | yes | The short code the user confirms in the browser. |
| `verification_uri` | string (uri) | yes |  |
| `verification_uri_complete` | string (uri) | yes | `verification_uri` with the code filled in. |
| `expires_in_seconds` | integer (int32) | yes |  |
| `interval_seconds` | integer (int32) | yes | The shortest time between two polls. |

## DeviceLoginPoll

| Field | Type | Required | Description |
|---|---|---|---|
| `device_code` | string | yes |  |

## DeviceLoginPending

| Field | Type | Required | Description |
|---|---|---|---|
| `interval_seconds` | integer (int32) | yes |  |

## DeviceLoginApprove

| Field | Type | Required | Description |
|---|---|---|---|
| `user_code` | string | yes |  |

## DeviceLoginApproved

| Field | Type | Required | Description |
|---|---|---|---|
| `client_name` | string | yes |  |

## User

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | [UserID](#userid) | yes |  |
| `email` | string (email) | yes |  |
| `name` | string | yes |  |
| `created_at` | string (date-time) | yes |  |

## Org

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | [OrgID](#orgid) | yes |  |
| `name` | string | yes |  |
| `created_at` | string (date-time) | yes |  |
| `suspension` | [OrgSuspension](#orgsuspension) | no | Present while the org is suspended. A suspended org can read, sign out, delete its API keys and SSH keys, turn auto top-up off and open the billing portal; every other operation is refused with `org_suspended`, and no machine starts. |

## OrgSuspension

| Field | Type | Required | Description |
|---|---|---|---|
| `reason` | string | yes | Why the org was suspended, as written for its owners. |
| `suspended_at` | string (date-time) | yes |  |

## OrgUpdate

| Field | Type | Required | Description |
|---|---|---|---|
| `name` | string | no | Minimum length: `1`. Maximum length: `100`. |

## PlanSummary

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes |  |
| `name` | string | yes |  |

## Me

| Field | Type | Required | Description |
|---|---|---|---|
| `user` | [User](#user) | yes |  |
| `org` | [Org](#org) | yes |  |
| `plan` | [PlanSummary](#plansummary) | yes |  |
| `subscription_status` | [SubscriptionStatus](#subscriptionstatus) | no | Left out when the org has no subscription. |
| `balance_micros` | integer (int64) | yes |  |

## Size

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes |  |
| `vcpus` | integer (int32) | yes |  |
| `memory_bytes` | integer (int64) | yes |  |
| `disk_bytes` | integer (int64) | yes |  |
| `rate_micros_per_hour` | integer (int64) | yes | What an hour of running costs. A stopped machine costs nothing. |
| `default` | boolean | yes | The size a machine gets when none is asked for. |

## SizeList

| Field | Type | Required | Description |
|---|---|---|---|
| `data` | array of [Size](#size) | yes |  |
| `next_cursor` | string or null | yes |  |

## Region

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes |  |
| `name` | string | yes |  |
| `default` | boolean | yes |  |

## RegionList

| Field | Type | Required | Description |
|---|---|---|---|
| `data` | array of [Region](#region) | yes |  |
| `next_cursor` | string or null | yes |  |

## Image

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes |  |
| `name` | string | yes |  |
| `version` | string | no | The version a new machine is created from. Left out while none is published. |
| `default` | boolean | yes |  |

## ImageList

| Field | Type | Required | Description |
|---|---|---|---|
| `data` | array of [Image](#image) | yes |  |
| `next_cursor` | string or null | yes |  |

## PlanList

| Field | Type | Required | Description |
|---|---|---|---|
| `data` | array of [Plan](#plan) | yes |  |
| `next_cursor` | string or null | yes |  |

## FeedbackCreate

| Field | Type | Required | Description |
|---|---|---|---|
| `message` | string | yes | Feedback text from the user or agent. Minimum length: `1`. Maximum length: `2000`. |
| `cli_version` | string | no | Optional CLI version string, such as `0.4.0`. Maximum length: `128`. |
| `os` | string | no | Optional operating system and architecture, such as `darwin/arm64`. Maximum length: `128`. |
| `command` | string | no | Optional CLI command context, such as `arvm exec`. Maximum length: `256`. |

## FeedbackEntry

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | [FeedbackID](#feedbackid) | yes |  |
| `created_at` | string (date-time) | yes |  |

## MachineDesired

What was asked for. `archived` is the platform's, for a machine of an org whose subscription
ended some time ago: its disk moves to the archive. A machine wanted `archived` is stopped
and stays stopped; when the org subscribes again it is wanted `stopped`, and its disk comes
back.

Type: string. One of `running`, `stopped`, `deleted`, `archived`.

## MachinePhase

Where the machine is. `scheduled` comes from the control plane: a machine has a host from the
request that creates it. Every later phase is what the machine's host observed. No machine
this API creates is `pending`; the value stays in the list for clients that know the name.
`archived`: the machine's disk is in the archive and on no host, and the machine keeps its ID,
name and DNS label. When the org subscribes again, the machine is `scheduled` on a host with
room, and `stopped` once its disk is back there.

Type: string. One of `pending`, `scheduled`, `creating`, `starting`, `running`, `stopping`, `stopped`, `deleting`, `deleted`, `failed`, `archived`.

## MachineFailure

Why a machine or a snapshot failed. The platform keeps what its host reported for its
operators; a customer is served the code and a sentence for it.

| Field | Type | Required | Description |
|---|---|---|---|
| `code` | string | yes | A stable snake_case name for what failed, for example `vm_boot_failed`. More are added over time. `unknown_failure` when the platform cannot say what failed. |
| `message` | string | yes | What happened and what to do about it, in one or two sentences chosen for the `code`. It is never the error text of the host. |

## MachineStopReason

Why the platform stopped a machine that its owner did not ask to stop. More are added over time.

- `balance_exhausted`: The balance reached zero and the grace period passed.
- `org_suspended`: The org was suspended.
- `subscription_ended`: The org's subscription ended.
- `store_retired`: The hardware holding the machine's disk has failed.
- `idle_timeout`: The machine had no activity for its idle timeout.
- `machine_failed`: The machine failed while it was wanted running, and the platform stopped it: the stop's `failure` says how.
- `host_draining`: The host running the machine was taken out of service for maintenance.

Type: string. One of `balance_exhausted`, `org_suspended`, `subscription_ended`, `store_retired`, `idle_timeout`, `machine_failed`, `host_draining`.

## MachineStop

Why the machine is stopped when its owner did not ask: the platform stopped it. The machine's
events say more: the `machine.stop_requested` event of the same time.

| Field | Type | Required | Description |
|---|---|---|---|
| `reason` | [MachineStopReason](#machinestopreason) | yes |  |
| `at` | string (date-time) | yes | When the platform asked the machine to stop. |
| `failure` | [MachineFailure](#machinefailure) | no | Present when `reason` is `machine_failed`. The failure the platform stopped the machine for, which `failure` of the machine no longer says once the machine is stopped. |

## Machine

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | [MachineID](#machineid) | yes |  |
| `name` | [Name](#name) | yes |  |
| `dns_label` | string | yes | The name the machine was created with plus a short suffix. Globally unique, never changes, and part of every endpoint URL. |
| `size` | string | yes |  |
| `image` | string | yes |  |
| `region` | string | yes |  |
| `desired` | [MachineDesired](#machinedesired) | yes |  |
| `phase` | [MachinePhase](#machinephase) | yes |  |
| `boot_generation` | integer (int64) | yes | The boot generation the control plane wants running. Starts at 0 and increments on each restart. Minimum: `0`. |
| `observed_boot_generation` | integer (int64) | no | The latest boot generation the machine's host has reported running. Omitted before the machine has booted. While `phase` is `running` and `observed_boot_generation` is less than `boot_generation`, a restart is still in progress. Minimum: `0`. |
| `failure` | [MachineFailure](#machinefailure) | no | Present while `phase` is `failed`. |
| `stop` | [MachineStop](#machinestop) | no | Present while `desired` is `stopped` because the platform stopped the machine, and not its owner: from the moment the platform asks, while the machine is still stopping, and beside `failure` if the machine fails. A start, a restart or a delete ends it. |
| `labels` | [Labels](#labels) | yes |  |
| `env` |  | yes | The machine's environment variables. A read-only API key is served the names and not the values: each value is then an empty string, and `env_values_withheld` is `true`. |
| `env_values_withheld` | boolean | no | `true` when the values of `env` were left out because the caller is a read-only API key. Left out otherwise, so an empty value under a full key or a session is an empty value. |
| `idle_timeout_seconds` | integer or null (int64) | yes | The machine is stopped after this long with no SSH, terminal, exec or endpoint traffic and with CPU utilization below the idle threshold. `null` means never. Minimum: `60`. |
| `ssh_key_ids` | array of [SSHKeyID](#sshkeyid) | yes | The SSH keys installed in the guest, for direct SSH to `ipv6` while `inbound` is `open`. |
| `from_snapshot` | [SnapshotID](#snapshotid) | no |  |
| `ssh` | string | yes | The command that opens a shell through the gateway: `ssh <user>@<host>`, with `-p <port>` before the destination when the gateway's port is not 22. It works with any SSH key of the org and stays the same across stop and start. |
| `ssh_host_key` | string | yes | The gateway's SSH host key, the key a client must see at the address in `ssh`, as it is written in a `known_hosts` line: the key type and the key, in base64. It is the same for every machine. |
| `ipv6` | string (ipv6) | no | The machine's public IPv6 address, once its host has assigned one. It is the machine's own, and stays the same across stop and start. Whether the internet can open connections to it is `inbound`. |
| `setup` | [MachineSetup](#machinesetup) | no | The machine's setup script, for a machine that was created with one. Never the script itself. |
| `inbound` | [MachineInbound](#machineinbound) | yes |  |
| `last_activity_at` | string (date-time) | yes |  |
| `created_at` | string (date-time) | yes |  |
| `updated_at` | string (date-time) | yes |  |

## MachineList

| Field | Type | Required | Description |
|---|---|---|---|
| `data` | array of [Machine](#machine) | yes |  |
| `next_cursor` | string or null | yes |  |

## MachineCreate

| Field | Type | Required | Description |
|---|---|---|---|
| `name` | [Name](#name) | no | Unique in the org among machines that are not deleted. Generated as three words when left out. `probe` is reserved for the SSH connectivity probe and rejected with 400 `invalid_request`. |
| `size` | string | no | A size ID from `listSizes`. The default size when left out. |
| `image` | string | no | An image ID from `listImages`. The default image when left out. |
| `region` | string | no | A region ID from `listRegions`. The default region when left out. |
| `labels` | [Labels](#labels) | no |  |
| `env` | [Env](#env) | no |  |
| `idle_timeout_seconds` | integer or null (int64) | no | Left out, the machine is idle-stopped after 3600 seconds. `null` means never. Minimum: `60`. |
| `ssh_key_ids` | array of [SSHKeyID](#sshkeyid) | no | The SSH keys to install in the guest. Left out, every key the org has now. Maximum items: `50`. |
| `from_snapshot` | string | no | A snapshot's ID or name. The disk starts as a copy of it instead of the image. |
| `setup_script` | string | no | A script to run once in the machine, when it first runs: text, at most 65,536 bytes of UTF-8, with no NUL byte. It is run directly, so its first line chooses the interpreter (`#!/usr/bin/env python3`); with no such line it is run by `bash`. It runs as the login user, who has `sudo`, in that user's home directory, with the machine's `env`, and may run for 30 minutes. It may hold secrets. No response, event or log returns it. The platform keeps it until the machine's guest has taken it, or the machine is deleted, and the guest removes its copy when the script has ended. Minimum length: `1`. Maximum length: `65536`. |
| `inbound` | [MachineInbound](#machineinbound) | no | Left out, the machine gets the plan's default, which is `open`. |

## MachineSetup

Where a machine's setup script is. The script's output, standard output and standard error
together, is in the machine at `/var/log/acre-setup.log`, which the login user reads: the
first 1 MiB of it. Read it with `readFile`, `exec` or SSH.

| Field | Type | Required | Description |
|---|---|---|---|
| `state` | [MachineSetupState](#machinesetupstate) | yes |  |
| `exit_code` | integer (int32) | no | The script's exit status, for `succeeded` (0) and `failed`. 128 plus the signal's number when a signal ended the script, and 127 when it could not be started. Minimum: `0`. Maximum: `255`. |
| `started_at` | string (date-time) | no | When the guest started the script. |
| `finished_at` | string (date-time) | no | When the setup ended. Set in every state but `pending` and `running`. |
| `output_truncated` | boolean | no | The script wrote more than 1 MiB, and the rest was dropped. |

## MachineSetupState

`pending`: the machine has not run far enough to take the script. A machine that is stopped
before then runs the script when it next starts. `running`: the script runs. Every other
state is an end, and does not change:

- `succeeded`: the script exited with status 0.
- `failed`: it exited with another status, was killed by a signal, or could not be started.
- `timed_out`: it ran for 30 minutes and was killed, with everything it started.
- `interrupted`: the machine stopped or restarted while the script ran.
- `unsupported`: the image the machine booted was built before setup scripts existed, so
  its guest agent cannot run one. No script ran.

Type: string. One of `pending`, `running`, `succeeded`, `failed`, `timed_out`, `interrupted`, `unsupported`.

## MachineInbound

Whether the internet can open connections to the machine's public IPv6 address, `ipv6`.

- `open`: TCP, UDP and ICMPv6 from anywhere reach the machine, on every port, and no other
  IP protocol does. What answers
  is the machine's to decide: what listens in it, and its own firewall. A new machine
  listens on TCP port 22 only, for SSH with a key.
- `closed`: the platform drops every new connection from outside before it reaches the
  machine. The machine does not answer a ping.

Either way the machine can open connections out, and gets the replies. Nothing reaches a
machine's private IPv4 address from outside. Another machine reaches an open address as
anyone on the internet does, and nothing else of the machine. A connection to the address
is not activity for the idle stop, and does not start a stopped machine. The gateway's
SSH, the terminal, exec, files and endpoints
do not use this address and work whatever the setting is. A change takes effect within
seconds, with no restart; connections that are open when `inbound` is closed stay open
until they end.

Type: string. One of `open`, `closed`.

## MachineUpdate

| Field | Type | Required | Description |
|---|---|---|---|
| `name` | [Name](#name) | no | Unique in the org among machines that are not deleted. `probe` is reserved for the SSH connectivity probe and rejected with 400 `invalid_request`. |
| `labels` | [Labels](#labels) | no |  |
| `inbound` | [MachineInbound](#machineinbound) | no |  |
| `idle_timeout_seconds` | integer or null (int64) | no | Minimum: `60`. |
| `size` | string | no | Only while the machine is stopped, as `updateMachine` says. |

## MachineEvent

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | [EventID](#eventid) | yes |  |
| `machine_id` | [MachineID](#machineid) | yes |  |
| `type` | string | yes | A dotted name, for example `machine.created`, `disk.cloned`, `guest.ready`. `MachineEventAttributes` lists the types there are and says what each means. More are added over time, so a client must accept a type it does not know. |
| `at` | string (date-time) | yes |  |
| `duration_ms` | integer (int64) | no | How long the step this event closes took. Left out for an event that closes no step: a request (`machine.*_requested`), a failure, or a phase the control plane saw the machine enter. How long the phase before a `phase.*` event lasted is that event's attribute `from_duration_ms`. |
| `trace_id` | string | no | The trace this event belongs to. Matches `^[0-9a-f]{32}$`. |
| `attributes` | map of string to string | yes | What the event says beyond its type. `MachineEventAttributes` lists the names an event of each type can have. Every value is a string: a number is written in digits and a time as RFC 3339. |

## MachineEventList

| Field | Type | Required | Description |
|---|---|---|---|
| `data` | array of [MachineEvent](#machineevent) | yes |  |
| `next_cursor` | string or null | yes |  |

## MachineEventAttributes

Every type of `MachineEvent`, with what it means and the `attributes` an event of that type can
have. No response has this shape: it is the list that `MachineEvent.type` and
`MachineEvent.attributes` refer to. An event has only the attributes listed for its type, and
any of them can be absent.

The server sends no attribute that is not listed here. More types and attributes are added
over time.

| Field | Type | Required | Description |
|---|---|---|---|
| `archive.delete_decided` | object | no | The date the warnings stated came, with nothing live at Stripe: the machine and the copy of its disk in the archive are deleted. This cannot be undone. |
| `archive.requested` | object | no | The org's subscription ended long enough ago that the machine's disk moves to the archive. The machine stays stopped. |
| `archive.restore_requested` | object | no | The org subscribed again: the machine's disk comes back from the archive, or stays on its host if it is still there. |
| `archive.restored` | object | no | The machine's disk is back on a host, whole. Its copy in the archive is deleted next. |
| `archive.stored` | object | no | Every part of the machine's disk that holds data is in the archive, checked. Its host removes the disk next. |
| `disk.archived` | object | no | Every part of the disk that holds data was copied to the archive. The disk stays on its host until the archive is checked. |
| `disk.archived` › `bytes` | string | no | Their bytes: the disk's size, less the parts that hold no data. |
| `disk.archived` › `chunks` | string | no | The parts of the disk copied, each up to 64 MiB. |
| `disk.cloned` | object | no | The machine's disk was made, from its image or from a snapshot. |
| `disk.cloned` › `from_snapshot` | string | no | The snapshot the disk is a copy of, when it is one. |
| `disk.cloned` › `image` | string | no | The image the disk is made from, as `<image>@<version>`. |
| `disk.deleted` | object | no | The disk was deleted. |
| `disk.resized` | object | no | The disk was grown for a larger size. |
| `disk.resized` › `bytes` | string | no | The disk's new size in bytes. |
| `disk.restored` | object | no | The disk came back from the archive to its host, every part of it checked. |
| `disk.restored` › `bytes` | string | no | Their bytes. |
| `disk.restored` › `chunks` | string | no | The parts of the disk brought back. |
| `fleet.host_silent` | object | no | The machine's host stopped reporting. The machine is not billed from the host's last report on. |
| `fleet.host_silent` › `phase` | string | no | The phase the machine was last seen in. |
| `guest.configured` | object | no | The machine's hostname, network, keys and environment were set. |
| `guest.prepared_stop` | object | no | The machine ran its pre-stop hook, if it has one, and flushed its filesystems. |
| `guest.prepared_stop` › `outcome` | string | no | `ok`, or why the hook did not finish: `aborted` (it exited with an error), `deadline_exceeded` (it was killed at its time limit), `failed_precondition` (it could not be run), or another gRPC status name when the machine did not answer. |
| `guest.ready` | object | no | The machine booted far enough to answer the host. |
| `machine.created` | object | no | The machine was created. |
| `machine.created` › `image` | string | no | The image its disk is made from, as `<image>@<version>`. |
| `machine.created` › `inbound` | string | no | Whether the internet could open connections to its IPv6 address when it was created: `open` or `closed`. |
| `machine.created` › `region` | string | no | The region it is in. |
| `machine.created` › `size` | string | no | The size the machine was created with. |
| `machine.delete_requested` | object | no | A delete was asked for. |
| `machine.deleted` | object | no | The machine and its disk are gone. The duration is from when its host was asked. |
| `machine.failed` | object | no | The machine failed. |
| `machine.failed` › `failure_code` | string | no | The machine's `failure.code`. |
| `machine.failed` › `message` | string | no | The machine's `failure.message`: what happened and what to do, chosen for the code. |
| `machine.restart_requested` | object | no | A restart was asked for. |
| `machine.restarted` | object | no | The machine is running again after a restart. The duration is from when its host was asked. |
| `machine.running` | object | no | The machine is running. The duration is from when its host was asked. |
| `machine.start_requested` | object | no | A start was asked for. |
| `machine.stop_requested` | object | no | A stop was asked for: by a request, or by the platform for the `reason` given. |
| `machine.stop_requested` › `cpu_idle_since` | string | no | Since when its CPU use was under the threshold, for the reason `idle_timeout`. |
| `machine.stop_requested` › `cpu_threshold` | string | no | The share of its vCPUs, from 0 to 1, under which the machine counts as idle, for the reason `idle_timeout`. |
| `machine.stop_requested` › `ended_at` | string | no | When the subscription ended, for the reason `subscription_ended`. |
| `machine.stop_requested` › `exhausted_at` | string | no | When the balance reached zero, for the reason `balance_exhausted`. |
| `machine.stop_requested` › `idle_timeout_seconds` | string | no | The machine's idle timeout when it was stopped, for the reason `idle_timeout`. |
| `machine.stop_requested` › `last_activity_at` | string | no | The last connection the platform saw, for the reason `idle_timeout`. |
| `machine.stop_requested` › `reason` | string | no | Why the platform stopped the machine, as the machine's `stop.reason` says it. `balance_exhausted`: The balance reached zero and the grace period passed. `org_suspended`: The org was suspended. `subscription_ended`: The org's subscription ended. `store_retired`: The hardware holding the machine's disk has failed. `idle_timeout`: The machine had no activity for its idle timeout. `machine_failed`: The machine failed while it was wanted running, and the platform stopped it: the stop's `failure` says how. `host_draining`: The host running the machine was taken out of service for maintenance. Absent when a request asked. |
| `machine.stopped` | object | no | The machine is stopped. The duration is from when its host was asked. |
| `machine.updated` | object | no | The machine was renamed or resized, or its inbound setting was changed. |
| `machine.updated` › `inbound` | string | no | The new inbound setting, when it changed: `open` or `closed`. |
| `machine.updated` › `name` | string | no | The new name, when the name changed. |
| `machine.updated` › `size` | string | no | The new size, when the size changed. |
| `network.attached` | object | no | The machine was given its network. |
| `network.attached` › `inbound` | string | no | What the host's firewall was told of connections from the internet to the machine's IPv6 address: `open` or `closed`. |
| `network.detached` | object | no | The machine's network was taken away. |
| `phase.archived` | object | no | The control plane saw the machine enter the phase `archived`. |
| `phase.archived` › `from` | string | no | The phase the machine left. |
| `phase.archived` › `from_duration_ms` | string | no | How long the machine was in the phase it left, the one `from` names, in milliseconds. |
| `phase.creating` | object | no | The control plane saw the machine enter the phase `creating`. |
| `phase.creating` › `from` | string | no | The phase the machine left. |
| `phase.creating` › `from_duration_ms` | string | no | How long the machine was in the phase it left, the one `from` names, in milliseconds. |
| `phase.deleted` | object | no | The control plane saw the machine enter the phase `deleted`. |
| `phase.deleted` › `from` | string | no | The phase the machine left. |
| `phase.deleted` › `from_duration_ms` | string | no | How long the machine was in the phase it left, the one `from` names, in milliseconds. |
| `phase.deleting` | object | no | The control plane saw the machine enter the phase `deleting`. |
| `phase.deleting` › `from` | string | no | The phase the machine left. |
| `phase.deleting` › `from_duration_ms` | string | no | How long the machine was in the phase it left, the one `from` names, in milliseconds. |
| `phase.failed` | object | no | The control plane saw the machine enter the phase `failed`. |
| `phase.failed` › `from` | string | no | The phase the machine left. |
| `phase.failed` › `from_duration_ms` | string | no | How long the machine was in the phase it left, the one `from` names, in milliseconds. |
| `phase.running` | object | no | The control plane saw the machine enter the phase `running`. |
| `phase.running` › `from` | string | no | The phase the machine left. |
| `phase.running` › `from_duration_ms` | string | no | How long the machine was in the phase it left, the one `from` names, in milliseconds. |
| `phase.scheduled` | object | no | The control plane saw the machine enter the phase `scheduled`. |
| `phase.scheduled` › `from` | string | no | The phase the machine left. |
| `phase.scheduled` › `from_duration_ms` | string | no | How long the machine was in the phase it left, the one `from` names, in milliseconds. |
| `phase.starting` | object | no | The control plane saw the machine enter the phase `starting`. |
| `phase.starting` › `from` | string | no | The phase the machine left. |
| `phase.starting` › `from_duration_ms` | string | no | How long the machine was in the phase it left, the one `from` names, in milliseconds. |
| `phase.stopped` | object | no | The control plane saw the machine enter the phase `stopped`. |
| `phase.stopped` › `from` | string | no | The phase the machine left. |
| `phase.stopped` › `from_duration_ms` | string | no | How long the machine was in the phase it left, the one `from` names, in milliseconds. |
| `phase.stopping` | object | no | The control plane saw the machine enter the phase `stopping`. |
| `phase.stopping` › `from` | string | no | The phase the machine left. |
| `phase.stopping` › `from_duration_ms` | string | no | How long the machine was in the phase it left, the one `from` names, in milliseconds. |
| `setup.finished` | object | no | The machine's setup ended. The duration is how long the script ran. |
| `setup.finished` › `exit_code` | string | no | The script's exit status, when it ran to its end. |
| `setup.finished` › `outcome` | string | no | How it ended: `succeeded`, `failed`, `timed_out`, `interrupted` or `unsupported`. |
| `setup.finished` › `output_truncated` | string | no | Whether the script wrote more than the log keeps. |
| `setup.started` | object | no | The machine's setup script started. |
| `snapshot.created` | object | no | A snapshot of the machine's disk was saved. |
| `snapshot.created` › `size_bytes` | string | no | The bytes of data the snapshot holds. |
| `snapshot.created` › `snapshot_id` | string | no | The snapshot. |
| `snapshot.deleted` | object | no | A snapshot of the machine's disk was deleted. |
| `snapshot.deleted` › `snapshot_id` | string | no | The snapshot. |
| `snapshot.delete_decided` | object | no | The date the warnings stated came, with nothing live at Stripe: a snapshot of the machine's disk is deleted with the org's machines. This cannot be undone. |
| `snapshot.delete_decided` › `snapshot_id` | string | no | The snapshot. |
| `vm.adopted` | object | no | A restarted host agent found the machine running and took it over. The machine did not stop. |
| `vm.booted` | object | no | The virtual machine was started. |
| `vm.booted` › `memory_bytes` | string | no | The memory it booted with, in bytes. |
| `vm.booted` › `vcpus` | string | no | The vCPUs it booted with. |
| `vm.destroyed` | object | no | The virtual machine was powered off, for a restart or a delete. |
| `vm.exited` | object | no | The virtual machine ended without being asked to. |
| `vm.exited` › `action` | string | no | What the host did next. `restart`: booted the machine again. `fail`: failed it, because it had ended too often. `none`: nothing, because the machine was not wanted running. |
| `vm.exited` › `cause` | string | no | `guest_panicked`: the machine's kernel panicked. `vmm_exited`: its virtual machine process was gone. |
| `vm.shutdown` | object | no | The virtual machine was shut down. |
| `vm.shutdown` › `forced` | string | no | `true` when the machine did not shut down in time and was powered off. |

## MetricPoint

One sample. A value the host could not measure at that time is left out.

| Field | Type | Required | Description |
|---|---|---|---|
| `at` | string (date-time) | yes |  |
| `cpu_utilization` | number (double) | no | From 0 to 1, across all of the machine's vCPUs. |
| `memory_used_bytes` | integer (int64) | no |  |
| `disk_used_bytes` | integer (int64) | no |  |
| `network_rx_bytes_per_second` | integer (int64) | no |  |
| `network_tx_bytes_per_second` | integer (int64) | no |  |

## MachineMetrics

| Field | Type | Required | Description |
|---|---|---|---|
| `machine_id` | [MachineID](#machineid) | yes |  |
| `starts_at` | string (date-time) | yes |  |
| `ends_at` | string (date-time) | yes |  |
| `step_seconds` | integer (int32) | yes |  |
| `points` | array of [MetricPoint](#metricpoint) | yes |  |

## ExecRequest

| Field | Type | Required | Description |
|---|---|---|---|
| `command` | array of string | yes | The program and its arguments. Minimum items: `1`. |
| `env` | [Env](#env) | no | Added to the machine's `env` for this command. |
| `working_dir` | string | no | The user's home directory when left out. |
| `user` | string | no | The user to run as. `dev` when left out. |
| `stdin` | string | no | Text written to the command's standard input, which is then closed. It is the one string in a request that may hold a NUL character. It cannot hold bytes that are not UTF-8, as no JSON can: to give a command binary input, write it to a file in the machine (`writeMachineFile`) and redirect the command's input from that file. |
| `timeout_seconds` | integer (int32) | no | The command is killed after this long. Default: `30`. Minimum: `1`. Maximum: `3600`. |
| `stream` | boolean | no | Send output as server-sent events while the command runs. Default: `false`. |

## ExecResult

| Field | Type | Required | Description |
|---|---|---|---|
| `exit_code` | integer (int32) | yes | The command's exit status, or 128 plus the signal that ended it. |
| `stdout` | string | yes |  |
| `stderr` | string | yes |  |
| `truncated` | boolean | yes | Output was cut at the size limit. |
| `timed_out` | [ExecTimedOut](#exectimedout) | yes |  |
| `oom_killed` | [ExecOomKilled](#execoomkilled) | yes |  |
| `duration_ms` | [ExecDuration](#execduration) | yes |  |

## ExecTimedOut

The command was killed at `timeout_seconds`, with SIGKILL, and `exit_code` is that kill's.

Type: boolean.

## ExecOomKilled

The kernel killed a process of the command because memory ran out.

Type: boolean.

## ExecDuration

From when the command started in the machine to its exit, in milliseconds.

Type: integer (int64).

## ExecOutput

The `data` of a `stdout` or `stderr` message in an exec stream.

| Field | Type | Required | Description |
|---|---|---|---|
| `data` | string | yes |  |

## ExecExit

The `data` of an exec stream's `exit` message, its last when the command exited.

| Field | Type | Required | Description |
|---|---|---|---|
| `exit_code` | integer (int32) | yes | The command's exit status, or 128 plus the signal that ended it. |
| `timed_out` | [ExecTimedOut](#exectimedout) | yes |  |
| `oom_killed` | [ExecOomKilled](#execoomkilled) | yes |  |
| `duration_ms` | [ExecDuration](#execduration) | yes |  |

## TerminalResize

A text frame the client sends on the terminal WebSocket.

| Field | Type | Required | Description |
|---|---|---|---|
| `type` | string | yes | One of `resize`. |
| `cols` | integer (int32) | yes | Minimum: `1`. Maximum: `1000`. |
| `rows` | integer (int32) | yes | Minimum: `1`. Maximum: `1000`. |

## TerminalExit

The text frame the server sends on the terminal WebSocket before it closes.

| Field | Type | Required | Description |
|---|---|---|---|
| `type` | string | yes | One of `exit`. |
| `exit_code` | integer (int32) | yes |  |

## FileType

`other` is a device, a socket or a pipe.

Type: string. One of `file`, `directory`, `symlink`, `other`.

## FileInfo

| Field | Type | Required | Description |
|---|---|---|---|
| `path` | string | yes |  |
| `name` | string | yes |  |
| `type` | [FileType](#filetype) | yes |  |
| `size_bytes` | integer (int64) | yes |  |
| `mode` | string | yes | Permission bits in octal. Matches `^[0-7]{4}$`. |
| `modified_at` | string (date-time) | yes |  |
| `symlink_target` | string | no | Where a symbolic link points. The other fields describe the link itself. |

## FileList

| Field | Type | Required | Description |
|---|---|---|---|
| `data` | array of [FileInfo](#fileinfo) | yes |  |
| `next_cursor` | string or null | yes |  |

## EndpointVisibility

`private` answers only requests that carry the signed link's token. `public` answers anyone.

Type: string. One of `private`, `public`.

## Endpoint

| Field | Type | Required | Description |
|---|---|---|---|
| `machine_id` | [MachineID](#machineid) | yes |  |
| `port` | integer (int32) | yes | Minimum: `1`. Maximum: `65535`. |
| `visibility` | [EndpointVisibility](#endpointvisibility) | yes |  |
| `url` | string (uri) | yes |  |
| `signed_url` | string (uri) | no | For a `private` endpoint, `url` with a token that lets the bearer in. Left out for a `public` one. |
| `created_at` | string (date-time) | yes |  |

## EndpointPut

| Field | Type | Required | Description |
|---|---|---|---|
| `visibility` | [EndpointVisibility](#endpointvisibility) | yes |  |

## EndpointList

| Field | Type | Required | Description |
|---|---|---|---|
| `data` | array of [Endpoint](#endpoint) | yes |  |
| `next_cursor` | string or null | yes |  |

## MachineUsage

| Field | Type | Required | Description |
|---|---|---|---|
| `machine_id` | [MachineID](#machineid) | yes |  |
| `starts_at` | string (date-time) | yes |  |
| `ends_at` | string (date-time) | yes |  |
| `seconds` | integer (int64) | yes | Billed running time in the range. |
| `amount_micros` | integer (int64) | yes |  |

## SnapshotState

`creating` until the host that holds the snapshot reports the copy complete, then `ready`, or
`failed`. `deleting` from the moment deletion is asked for until the host reports it gone,
then `deleted`.

Type: string. One of `creating`, `ready`, `failed`, `deleting`, `deleted`.

## Snapshot

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | [SnapshotID](#snapshotid) | yes |  |
| `name` | [Name](#name) | yes |  |
| `machine_id` | [MachineID](#machineid) | yes |  |
| `state` | [SnapshotState](#snapshotstate) | yes |  |
| `size_bytes` | integer (int64) | no | The bytes of data the snapshot holds, which is what its storage is billed on. Present once it is `ready`. |
| `failure` | [MachineFailure](#machinefailure) | no | Present while `state` is `failed`. |
| `created_at` | string (date-time) | yes |  |
| `ready_at` | string (date-time) | no |  |

## SnapshotCreate

| Field | Type | Required | Description |
|---|---|---|---|
| `machine` | string | yes | The machine's ID or name. |
| `name` | [Name](#name) | no | Unique in the org among snapshots that are not deleted. Generated when left out. |

## SnapshotList

| Field | Type | Required | Description |
|---|---|---|---|
| `data` | array of [Snapshot](#snapshot) | yes |  |
| `next_cursor` | string or null | yes |  |

## SSHKey

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | [SSHKeyID](#sshkeyid) | yes |  |
| `name` | string | yes |  |
| `public_key` | string | yes |  |
| `fingerprint` | string | yes | As `ssh-keygen -l` prints it. |
| `created_at` | string (date-time) | yes |  |

## SSHKeyCreate

| Field | Type | Required | Description |
|---|---|---|---|
| `name` | string | yes | Minimum length: `1`. Maximum length: `100`. |
| `public_key` | string | yes | One line in `authorized_keys` format. Maximum length: `8192`. |

## SSHKeyList

| Field | Type | Required | Description |
|---|---|---|---|
| `data` | array of [SSHKey](#sshkey) | yes |  |
| `next_cursor` | string or null | yes |  |

## APIKeyScope

What a key may do. `full`: everything the org's members can do through the API.
`read_only`: read what the API shows of the org, and change nothing. It is served the names of
a machine's environment variables and not their values. A read-only key cannot
run a command in a machine, read or write its files, open its terminal, get a signed link to
a private endpoint, start a payment, or create or revoke a key.

Type: string. One of `full`, `read_only`.

## APIKey

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | [APIKeyID](#apikeyid) | yes |  |
| `name` | string | yes |  |
| `scope` | [APIKeyScope](#apikeyscope) | yes |  |
| `display_prefix` | string | yes | The first characters of the secret, to tell keys apart. |
| `created_at` | string (date-time) | yes |  |
| `last_used_at` | string (date-time) | no |  |
| `expires_at` | string (date-time) | no | Left out for a key that never expires. |

## APIKeyWithSecret

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | [APIKeyID](#apikeyid) | yes |  |
| `name` | string | yes |  |
| `scope` | [APIKeyScope](#apikeyscope) | yes |  |
| `display_prefix` | string | yes |  |
| `created_at` | string (date-time) | yes |  |
| `last_used_at` | string (date-time) | no |  |
| `expires_at` | string (date-time) | no |  |
| `secret` | string | yes | The key itself. Shown in this response and never again. Matches `^arvm_[A-Za-z0-9]{20,}$`. |

## APIKeyCreate

| Field | Type | Required | Description |
|---|---|---|---|
| `name` | string | yes | Minimum length: `1`. Maximum length: `100`. |
| `scope` |  | no | Left out, the key is `full`. A key's scope cannot be changed afterwards. Default: `full`. |
| `expires_in_seconds` | integer (int64) | no | Left out, the key never expires. Minimum: `60`. |

## APIKeyList

| Field | Type | Required | Description |
|---|---|---|---|
| `data` | array of [APIKey](#apikey) | yes |  |
| `next_cursor` | string or null | yes |  |

## EgressProfile

Network egress firewall profile applied to machines on this plan.

Type: string. One of `standard`, `trial`.

## Plan

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes |  |
| `name` | string | yes |  |
| `price_micros` | integer (int64) | yes | What the subscription costs each period. |
| `grant_micros` | integer (int64) | yes | What each paid period adds to the balance. It expires when the period ends. |
| `period_months` | integer (int32) | yes |  |
| `max_machines` | integer (int32) | yes | Machines the org may hold, running or stopped. |
| `max_running_vcpus` | integer (int32) | yes | vCPUs of the machines the org may have running at once. |
| `max_running_memory_bytes` | integer (int64) | yes | Memory of the machines the org may have running at once. |
| `max_disk_bytes` | integer (int64) | yes | Disk the org's machines may have in total. A stopped machine keeps its disk, so it counts. |
| `max_snapshots` | integer (int32) | yes |  |
| `snapshot_rate_micros_per_gib_month` | integer (int64) | yes |  |
| `topup_min_micros` | integer (int64) | yes |  |
| `topup_max_micros` | integer (int64) | yes |  |
| `topup_expires_months` | integer or null (int32) | yes | How long a top-up can be used after it is paid. `null` means a top-up does not expire. |
| `machine_inbound_default` | [MachineInbound](#machineinbound) | yes | The `inbound` a new machine gets when its create does not give one. |
| `allow_inbound_open` | boolean | yes | Whether machines on this plan may open inbound internet traffic on IPv6. |
| `allow_public_endpoints` | boolean | yes | Whether machines on this plan may expose public (unauthenticated) HTTPS endpoints. |
| `egress_profile` | [EgressProfile](#egressprofile) | yes | Network egress profile enforced by the host firewall for machines on this plan. |
| `max_idle_timeout_seconds` | integer or null (int32) | yes | Maximum idle timeout allowed on this plan, in seconds. `null` means idle stop may be disabled. |
| `nic_bytes_per_second` | integer or null (int64) | no | Per-machine NIC bandwidth cap in bytes/second, or `null` for the host default (62,500,000 B/s = 500 Mbit/s). |
| `connection_limit` | integer or null (int32) | no | Per-machine concurrent connection cap, or `null` for the host default. |

## SubscriptionStatus

Stripe's status of the subscription.

Type: string. One of `incomplete`, `incomplete_expired`, `trialing`, `active`, `past_due`, `canceled`, `unpaid`, `paused`.

## Subscription

| Field | Type | Required | Description |
|---|---|---|---|
| `status` | [SubscriptionStatus](#subscriptionstatus) | yes |  |
| `current_period_start` | string (date-time) | yes |  |
| `current_period_end` | string (date-time) | yes |  |
| `cancel_at_period_end` | boolean | yes |  |
| `period_granted` | boolean | yes | Whether the plan's hours for the current period are granted. `false` from Stripe reporting a new subscription until it reports the paid invoice for its first period, usually a few seconds: the org is subscribed and has no plan hours yet. A renewal's hours are granted when the period starts. Plan hours left from an earlier subscription do not count. |

## GrantKind

`plan` comes with a paid subscription period, `topup` from a top-up, `courtesy` from support, `trial` from a free trial.

Type: string. One of `plan`, `topup`, `courtesy`, `trial`.

## Grant

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | [GrantID](#grantid) | yes |  |
| `kind` | [GrantKind](#grantkind) | yes |  |
| `amount_micros` | integer (int64) | yes |  |
| `remaining_micros` | integer (int64) | yes |  |
| `starts_at` | string (date-time) | yes |  |
| `expires_at` | string or null (date-time) | yes | When what is left of the grant is taken from the balance. `null` means the grant does not expire. Usage draws on the grant that expires first, and on one that does not expire last. |

## RuntimeRemaining

| Field | Type | Required | Description |
|---|---|---|---|
| `size` | string | yes |  |
| `seconds` | integer (int64) | yes | How long the balance runs one machine of this size. |

## TrialClaimStatus

Status of the org's free trial claim.

Type: string. One of `pending_verification`, `granted`, `denied`.

## TrialStatus

| Field | Type | Required | Description |
|---|---|---|---|
| `status` | [TrialClaimStatus](#trialclaimstatus) | yes |  |
| `expires_at` | string or null (date-time) | yes | When a granted trial balance expires, or `null` if not granted. |
| `deny_code` | string or null | yes | Machine-readable denial reason when `status` is `denied`, or `null`. |

## TrialClientSignals

Lightweight, privacy-safe browser signals sent once when claiming a free trial.

| Field | Type | Required | Description |
|---|---|---|---|
| `webdriver` | boolean | no |  |
| `webgl_renderer` | string | no | Maximum length: `256`. |
| `hardware_concurrency` | integer (int32) | no | Minimum: `0`. Maximum: `512`. |
| `device_memory` | number (double) | no | Minimum: `0`. Maximum: `1024`. |
| `screen_width` | integer (int32) | no | Minimum: `0`. Maximum: `32768`. |
| `screen_height` | integer (int32) | no | Minimum: `0`. Maximum: `32768`. |
| `device_pixel_ratio` | number (double) | no | Minimum: `0`. Maximum: `16`. |
| `timezone` | string | no | Maximum length: `100`. |
| `timezone_offset_mins` | integer (int32) | no | Minimum: `-840`. Maximum: `840`. |
| `languages` | array of string | no | Maximum items: `16`. |
| `platform` | string | no | Maximum length: `100`. |
| `form_dwell_ms` | integer (int64) | no | Minimum: `0`. Maximum: `86400000`. |
| `pointer_events` | integer (int32) | no | Minimum: `0`. Maximum: `1000000`. |

## TrialClaimRequest

| Field | Type | Required | Description |
|---|---|---|---|
| `turnstile_token` | string | no | Cloudflare Turnstile token produced by the dashboard widget when Turnstile is enabled. Maximum length: `4096`. |
| `return_to` | string | no | A path in the web app to come back to if card verification is required. On verified return, Stripe appends `trial=success` to the query. Default: `/start`. |
| `signals` | [TrialClientSignals](#trialclientsignals) | no |  |

## TrialClaimOutcome

Whether the trial was granted immediately or requires $0 card verification.

Type: string. One of `granted`, `card_verification_required`.

## TrialClaimResponse

| Field | Type | Required | Description |
|---|---|---|---|
| `outcome` | [TrialClaimOutcome](#trialclaimoutcome) | yes |  |
| `verification_url` | string (uri) | no | Present when `outcome` is `card_verification_required`: a $0 Stripe SetupIntent Checkout URL. |
| `billing` | [Billing](#billing) | no | Present when `outcome` is `granted`: the org's updated billing state. |

## Billing

| Field | Type | Required | Description |
|---|---|---|---|
| `plan` | [Plan](#plan) | yes |  |
| `subscription` | [Subscription](#subscription) | no | Left out when the org has no subscription. |
| `subscription_ended_at` | string or null (date-time) | yes | When the org's subscription ended, while it has not subscribed again; `null` otherwise, also for an org that never subscribed. While it is set, the org's machines are stopped and none can be started or created. What then happens to its machines, their disks and its snapshots is on the billing page (`docs/billing.md`), under "Your machines and snapshots after the subscription ends". The balance is not changed: a top-up stays for when the org comes back, this period's plan balance still expires when the period ends, and snapshot storage is still charged to it. Subscribing again clears it; the machines stay stopped until their owner starts them. |
| `balance_micros` | integer (int64) | yes |  |
| `runtime_remaining` | array of [RuntimeRemaining](#runtimeremaining) | yes | One entry per size, lowest price first. |
| `grants` | array of [Grant](#grant) | yes | The grants that still hold an amount, the one that expires first at the top. |
| `trial` | [TrialStatus](#trialstatus) | no | Present once the org has attempted or claimed a free trial. |

## CheckoutStart

| Field | Type | Required | Description |
|---|---|---|---|
| `plan` | string | no | Paid plan slug (`standard`, `max`, or `ultra`). Defaults to `standard`. |
| `plan_id` | string | no | Alias for `plan`. Paid plan slug (`standard`, `max`, or `ultra`). Defaults to `standard`. |
| `return_to` | string | no | A path in the web app to come back to. A customer who paid comes back to it with `checkout=success` added to its query, and one who left Checkout without paying comes back to it as given. The parameter says which way the customer left Stripe, not that the org is subscribed: the subscription is in `getBilling` once Stripe has reported the payment, which can be after the browser is back. Default: `/billing`. |

## TopUpStart

| Field | Type | Required | Description |
|---|---|---|---|
| `amount_micros` | integer (int64) | yes | Minimum: `1`. |
| `return_to` | string | no | A path in the web app to come back to. A customer who paid comes back to it with `topup=success` added to its query, and one who left Checkout without paying comes back to it as given. The grant is in `getBilling` once Stripe has reported the payment, which can be after the browser is back. Default: `/billing`. |

## PortalOpen

| Field | Type | Required | Description |
|---|---|---|---|
| `return_to` | string | no | A path in the web app to come back to. The browser comes back to it as given. Default: `/billing`. |

## AutoTopUpState

`off`: never turned on, or turned off. `on`: the card is charged when the balance falls under
the threshold. `at_monthly_max`: on, and one more charge would take this month over
`monthly_max_micros`, so nothing is charged until `month_ends_at` or until the maximum is
raised. `stopped`: a charge failed, and nothing is charged until `setAutoTopUp` is called
again; `stopped_reason` says why.

Type: string. One of `off`, `on`, `at_monthly_max`, `stopped`.

## AutoTopUp

| Field | Type | Required | Description |
|---|---|---|---|
| `state` | [AutoTopUpState](#autotopupstate) | yes |  |
| `threshold_micros` | integer (int64) | no | The balance under which the card is charged. Left out while `state` is `off`. |
| `amount_micros` | integer (int64) | no | What one charge adds to the balance. Left out while `state` is `off`. |
| `monthly_max_micros` | integer (int64) | no | The most auto top-up may charge in one UTC calendar month. Left out while `state` is `off`. |
| `charged_this_month_micros` | integer (int64) | yes | What auto top-up has charged since this UTC calendar month began. A declined charge and a top-up paid by hand are not counted. |
| `month_ends_at` | string (date-time) | yes | When `charged_this_month_micros` starts again from zero. |
| `payment_method_saved` | boolean | yes | Whether the org has a card auto top-up can charge. It is the card the subscription is paid with, saved when the subscription is paid in Checkout and changed in the billing portal. |
| `stopped_at` | string (date-time) | no | When a declined charge stopped auto top-up. Present while `state` is `stopped`. |
| `stopped_reason` | string | no | Why auto top-up stopped. Present while `state` is `stopped`. When the card was declined, this is the payment processor's sentence about the card. When the charge was refused for another reason, it is `the charge could not be made`: check the card in the billing portal. |

## AutoTopUpSet

| Field | Type | Required | Description |
|---|---|---|---|
| `threshold_micros` | integer (int64) | yes | Charge the card when the balance is under this. More than zero. |
| `amount_micros` | integer (int64) | yes | What one charge adds to the balance. Within the plan's `topup_min_micros` and `topup_max_micros`, and a whole number of cents. |
| `monthly_max_micros` | integer (int64) | yes | The most to charge in one UTC calendar month. At least `amount_micros`. |

## HostedPage

| Field | Type | Required | Description |
|---|---|---|---|
| `url` | string (uri) | yes | A page on Stripe to send the browser to. Short-lived. |

## LedgerEntryKind

`grant` adds a grant's amount. `usage`, `expiry` and `revoke` take from one.

Type: string. One of `grant`, `usage`, `expiry`, `revoke`.

## LedgerUsage

What a `usage` entry paid for, a window of one machine's running time or of one snapshot's storage.

| Field | Type | Required | Description |
|---|---|---|---|
| `machine_id` | [MachineID](#machineid) | no |  |
| `machine_name` | string | no | The machine's name, with `machine_id`, also once the machine is deleted. |
| `snapshot_id` | [SnapshotID](#snapshotid) | no |  |
| `window_start` | string (date-time) | yes |  |
| `window_end` | string (date-time) | yes |  |
| `seconds` | integer (int32) | yes |  |

## LedgerEntry

| Field | Type | Required | Description |
|---|---|---|---|
| `id` | [LedgerEntryID](#ledgerentryid) | yes |  |
| `kind` | [LedgerEntryKind](#ledgerentrykind) | yes |  |
| `amount_micros` | integer (int64) | yes | Positive for `grant`, negative otherwise. |
| `grant_id` | [GrantID](#grantid) | yes |  |
| `grant_kind` | [GrantKind](#grantkind) | yes |  |
| `usage` | [LedgerUsage](#ledgerusage) | no |  |
| `created_at` | string (date-time) | yes |  |

## LedgerEntryList

| Field | Type | Required | Description |
|---|---|---|---|
| `data` | array of [LedgerEntry](#ledgerentry) | yes |  |
| `next_cursor` | string or null | yes |  |

## UsageRow

What one machine or one snapshot used on one UTC day.

| Field | Type | Required | Description |
|---|---|---|---|
| `date` | string (date) | yes |  |
| `machine_id` | [MachineID](#machineid) | no |  |
| `machine_name` | string | no |  |
| `snapshot_id` | [SnapshotID](#snapshotid) | no |  |
| `seconds` | integer (int64) | yes |  |
| `amount_micros` | integer (int64) | yes |  |

## UsageList

| Field | Type | Required | Description |
|---|---|---|---|
| `data` | array of [UsageRow](#usagerow) | yes |  |
| `next_cursor` | string or null | yes |  |
