The machine API
The service hopbox.v1.MachineService of the public API creates, reads, and changes the machines of an org. Placement covers how a create picks the node of a machine. The admin API covers the calls of instance admins on machines, and the admin API the images that new machines start from. The API server covers the parts that every call shares: the request gate, the policy check, the idempotency keys, and the error codes. The generated reference is Public API. The code is in internal/service (machines.go, machine_lifecycle.go, machine_admin.go, machine_events.go) and internal/api (handlers_machine.go). The access calls are in machine_access.go and handlers_machine_access.go.
| Calls | What they do |
|---|---|
CreateMachine |
Makes a machine and places it on a node. |
GetMachine, ListMachines, WatchMachines |
Read the machines that the caller sees, once or as a stream of changes. |
ListMachineSizes |
Reads the sizes that a machine can have. |
StartMachine, StopMachine, PauseMachine, ResumeMachine, HibernateMachine, WakeMachine, DiscardMemory, RebootMachine, RenameMachine, DeleteMachine |
Set the target state of a machine, then wait for it (Lifecycle calls). |
ShareMachine, UnshareMachine |
Open a private machine to the whole org, or make it private again. |
UpdateMachine |
Changes the restart policy, the start command, or a timeout: auto-delete, auto-standby, or auto-hibernate. |
SetMachineURLPort, SetMachineURLVisibility |
Change the port that the URL of a machine reaches, and who can open the URL. |
Exec, Upload, Download, StreamMachineLogs |
Run a command in a machine, copy files in and out, and read its log (Access calls). The WebSocket /api/ws/exec carries the same exec for the console. |
The examples on this page use the shell function browser of the sign-in, account, and audit API, with the session cookie of the caller. Create and manage machines runs the whole flow on a server.
What runs the machines
Section titled “What runs the machines”The machine API sets the target state of a machine and waits for it. The executor of the machine on its node moves the machine there, and reports each step back (the node executor, the executor protocol). The waits of the lifecycle calls end once the machine got there (Lifecycle calls).
On a server with the node role, hopboxd run runs the executors with the Firecracker driver (the Firecracker driver). A new machine reaches running once its guest agent applied the configuration of the machine. The first boot of an image on a node also unpacks the image. For the default image on the tested server, the whole create takes about 25 s.
Each machine gets an IPv4 address of the subnet of its node at its create (the node network). Its URL and the SSH front door reach it at this address (the edge role, the SSH front door). When the subnet of the node has no free address, the create fails with no capacity. Exec, file copy, and the log run over the guest link, without the network (the node executor). Env vars and secrets reach a machine through its spec (the env var API).
The org of a request
Section titled “The org of a request”CreateMachine, ListMachines, and WatchMachines act in one org. They have the field org_id, an optional string. Leave it out to act in the default org of the caller: the org of an API key, or else the personal org of the account. A caller without either acts in no org, and the policy refuses it.
The service layer reads the role of the caller in the org before the policy check. A caller that is not a member has no role. So an org that does not exist gets the same permission_denied as an org of others. An org_id that is not a UUID gets invalid_argument.
Naming a machine
Section titled “Naming a machine”A call on one machine names it in the oneof field machine: either id, the UUID of the machine, or name, its name. Machine names are unique in the whole install (Domain rules), so a name alone finds the machine.
| Case | Code | Message |
|---|---|---|
| Neither field is set | invalid_argument |
invalid argument: the request names no machine |
id is not a UUID |
invalid_argument |
invalid argument: the machine ID "<id>" is not a UUID |
name breaks the name rules |
invalid_argument |
invalid argument: invalid name: ..., or invalid argument: reserved machine name: "ns1" |
| No machine has the ID | not_found |
not found: no machine has the ID <id> |
| No machine has the name | not_found |
not found: no machine has the name "<name>" |
A machine that is being deleted keeps its name in its row until its executor deleted it. Meanwhile, a new machine of the same org can take the name back. A name then names two machines for a while. The lookup by name returns the one that holds the name live, else the newest. A lookup by name never finds a machine whose current state is deleted. A lookup by ID still finds it, until the leader drops its row (hopboxd).
Who can do what
Section titled “Who can do what”The creator of a machine is the account that made it, or the org key that made it. A machine starts private to its creator. Its creator can share it with the whole org.
| Call | The creator | A member, on a shared machine | A member, on a private machine of another | An org admin or owner, on a private machine of another |
|---|---|---|---|---|
GetMachine, and the machine in ListMachines and WatchMachines |
yes | yes | no, not_found |
yes |
StopMachine, PauseMachine, HibernateMachine, DeleteMachine |
yes | yes | no, not_found |
yes |
StartMachine, ResumeMachine, WakeMachine, RebootMachine, RenameMachine, UpdateMachine |
yes | yes | no, not_found |
no, permission_denied |
ShareMachine, UnshareMachine, SetMachineURLPort, SetMachineURLVisibility, DiscardMemory |
yes | no, permission_denied |
no, not_found |
no, permission_denied |
Exec, Upload, Download, StreamMachineLogs, and the WebSocket of exec (action machine.exec) |
yes | yes | no, not_found |
no, permission_denied |
CreateBackup, with the rights of machine.exec |
yes | yes | no, not_found |
no, permission_denied |
ListBackups, metadata only, as GetMachine |
yes | yes | no, not_found |
yes |
DeleteBackup, as DeleteMachine |
yes | yes | no, not_found |
yes |
These rules hold for each caller that acts in the org of the machine:
- A
sessionor acli_tokenacts in each org where its account has a role. - A
member_keyacts only in its own org, as its account, while the account has a role there. - An
org_keyacts only in its own org. It has the rights of a member, without private machines. It is never an org admin. A machine that an org key makes is shared from the start, and its creator is that key. Milestone T12 of phase 3 builds forks, and a fork through an org key then makes a shared machine. The owner decided this on 2026-11-06, in Q193. - An instance admin has only the rights of its own roles here. It acts on the machines of others through the admin API (the admin API).
A caller that cannot read a machine gets not_found, with the same message as for a machine that does not exist. So the call tells nothing about the private machines of others.
RenameMachine, UpdateMachine, SetMachineURLPort, and SetMachineURLVisibility check their fields before they look up the machine. So a bad value gets invalid_argument, also for a machine that does not exist, or that the caller cannot read. The check reads only the request, so it tells nothing about the machine. One check of RenameMachine comes after the lookup: a new name that looks like a credential (Domain rules). So a rename of a machine to its own name never fails on it. An anonymous caller still gets unauthenticated first. A caller that can read the machine, but not do the action, gets permission_denied with the message permission denied: a caller of kind <kind> may not do <action>.
The API listener resolves session cookies, CLI tokens, and API keys (the API server). A CLI token acts as its account. A member key acts as its account, in the org of the key only. An org key acts as a member of its org without private machines.
Messages
Section titled “Messages”Machine
Section titled “Machine”| Field | Type | Description |
|---|---|---|
id |
string | The UUID of the machine. |
org_id |
string | The UUID of the org of the machine. |
name |
string | The name of the machine, unique in the install. It is the first label of its URL. |
state |
MachineState |
The current state (Domain rules). |
target_state |
MachineState |
The state that the machine must reach. |
size |
MachineSize |
The size of the machine. The machine keeps the numbers of its size from its create. |
image_name |
string | The name of the image that the machine started from, for example default. |
image_digest |
string | The digest of that image: sha256: and 64 hex digits. |
creator_account_id |
string | The UUID of the account that made the machine. Empty for a machine that an org key made, and after the delete of the account. |
creator_key_id |
string | The UUID of the org key that made the machine, or empty. |
shared |
bool | true for a machine that is open to the whole org. |
restart_policy |
RestartPolicy |
The action of the executor after the machine stops by itself. |
start_command |
string | The command that the guest agent runs after each boot, or empty. |
auto_delete_timeout |
google.protobuf.Duration |
The time without use after which hopbox deletes the machine. Unset means off. The delete comes 1 to 2 minutes after this time from the last recorded use (Auto-delete). |
url |
string | https://<name>.<domain>, for example https://box1.example.com. Empty while the install has no domain. |
url_port |
int32 | The port in the machine that the URL reaches. The default is 8000. |
url_visibility |
URLVisibility |
Who can open the URL. The default is URL_VISIBILITY_PRIVATE. |
ssh_port |
int32 | The SSH port of the machine on the edge servers, 10000 to 30000. It never changes. |
reboot_pending |
bool | true while a boot that a request asked for did not run yet, and the target is running. A machine with another target has no pending boot. For example, a stop that comes before the boot of a start ends it. |
skipped_env_vars |
int32 | The count of env vars and secrets that the guest agent of the running machine left out, because their names break its rules (the env var API). 0 is the normal case. |
memory_saved |
bool | true while the node of the machine keeps a memory file of it: after a hibernate, and after a wake that failed. The control store records the file (Control store tables). A wake that works and DiscardMemory end it. |
auto_standby_timeout |
google.protobuf.Duration |
The time without inbound traffic after which a running machine goes to standby. Unset means off (Idle timers). |
auto_hibernate_timeout |
google.protobuf.Duration |
The time without inbound traffic after which the machine hibernates, from running or from standby. Unset means off (Idle timers). |
backup_period |
google.protobuf.Duration |
The time between two scheduled backups of the machine. Unset means off, the default (Backups). |
backup_retention |
google.protobuf.Duration |
How long hopbox keeps each backup of the machine. The default is 7 days. |
last_activity_time |
google.protobuf.Timestamp |
The last use of the machine, for the auto-delete timeout and the idle timers (Auto-delete). |
state_change_time |
google.protobuf.Timestamp |
The time of the last change of the current state. |
delete_request_time |
google.protobuf.Timestamp |
The time of the delete request. Unset for a machine whose target is not deleted. |
version |
int64 | The version of the machine. It starts at 1 and grows by 1 with each change of the machine. A request makes such a change. A report of its executor makes one too. So does a new count of skipped env values. So does a change of an env var or a secret that reaches the machine. |
create_time |
google.protobuf.Timestamp |
The creation time of the machine. |
update_time |
google.protobuf.Timestamp |
The time of the last change that a request made. |
In the JSON codec, a field with its default value is left out, for example shared false or an empty start_command.
MachineSize
Section titled “MachineSize”| Field | Type | Description |
|---|---|---|
name |
string | The name of the size, for example default. |
vcpus |
int32 | The count of vCPUs. |
memory_bytes |
int64 | The RAM, in bytes. |
disk_bytes |
int64 | The size of the sparse disk, in bytes. |
A fresh install has one size, default: 2 vCPUs, 8 GiB of RAM, and a sparse disk of 100 GB (Domain rules). An instance admin can add other sizes (the admin API).
MachineState
Section titled “MachineState”| Value | State |
|---|---|
MACHINE_STATE_UNSPECIFIED |
Never in a response. |
MACHINE_STATE_PENDING |
pending: the machine exists, but no node acted on it yet. |
MACHINE_STATE_STARTING |
starting: the microVM boots. |
MACHINE_STATE_RUNNING |
running: the microVM runs. |
MACHINE_STATE_STANDBY |
standby: the microVM is paused, and its memory stays in the RAM of the node. |
MACHINE_STATE_HIBERNATED |
hibernated: the memory is in a file on disk, and the microVM does not run. |
MACHINE_STATE_STOPPED |
stopped: the microVM does not run. The disk stays. |
MACHINE_STATE_FAILED |
failed: an action failed. The saved state of the machine stays. |
MACHINE_STATE_DELETED |
deleted: the machine and its saved state are gone. |
MACHINE_STATE_MOVING |
moving: a drain moves the machine to another node. |
RestartPolicy
Section titled “RestartPolicy”| Value | Policy |
|---|---|
RESTART_POLICY_UNSPECIFIED |
Never in a response. In CreateMachineRequest, it takes the default always. In UpdateMachineRequest, it keeps the policy. |
RESTART_POLICY_ALWAYS |
always: the executor starts the machine again after a crash, a shutdown from inside, or a node reboot (Domain rules). |
RESTART_POLICY_NEVER |
never: the machine and its start command stay stopped. |
A value that is not in the enum gets invalid_argument with the message invalid argument: the restart policy <n> is not known.
URLVisibility
Section titled “URLVisibility”| Value | Visibility |
|---|---|
URL_VISIBILITY_UNSPECIFIED |
Never in a response. A request cannot use it. |
URL_VISIBILITY_PRIVATE |
private: only an account that uses the machine can open its URL, in a browser with a console session (the edge role). |
URL_VISIBILITY_PUBLIC |
public: anyone can open the URL, without an account. |
The edge servers serve the URL of a machine (the edge role). A change of the URL port or of the visibility reaches them with the next routes, within a second or two (the control channel).
Lifecycle calls
Section titled “Lifecycle calls”StartMachine, StopMachine, PauseMachine, ResumeMachine, HibernateMachine, WakeMachine, DiscardMemory, RebootMachine, RenameMachine, and DeleteMachine are the lifecycle calls. Each one takes these steps:
- It checks the policy, then its input.
- It locks the rows in the order of Control store tables: the key lock of the creator account, the org row, then the machine row. It checks the policy again under the locks, because the role or the machine can change in between.
- It refuses a call that the suspension of the org blocks (Suspension).
- It sets the new target state, as
Apply(target, current)of the domain gives it (Domain rules). An action that the states do not allow getsfailed_precondition, for examplefailed precondition: machine action not allowed: cannot reboot a machine that is pending. - It writes the audit entry and the change event in the same transaction, and commits.
- It waits for the machine, then returns it.
A request that asks for the target that the machine has already changes nothing. It writes no audit entry and no event, and the version stays. The call still waits. For example, a stop of a machine with the target stopped waits for the state stopped. The rule has three exceptions. A reboot always asks for a new boot. A start of a failed machine asks for a new boot too, even with the target running already (StartMachine). A delete of a machine whose target is deleted fails with failed_precondition and the message failed precondition: machine action not allowed: cannot delete a machine that is being deleted.
The wait
Section titled “The wait”The executor of the node moves the machine toward its target. The call waits for that, and ends its wait at the first of these events:
| Event | done |
|---|---|
| The machine reached what the call asked for. | true |
The current state turned failed after the change of the call. A machine that was failed before the call is on its way out of that state, so only a later failure counts. |
false |
| Another request set another target, for example a stop during the wait of a start. The control role sets another target too, for example after a refused save. | false |
| 60 s passed, or the deadline of the call is 1 s away. | false |
| The client canceled the call. | false |
The listener of the call stops, for example at a stop or an upgrade of hopboxd. |
false |
The wait wakes on each change event of the machine (Change events), and reads the machine again every 2 s in any case. The machine in the response is the machine at the end of the wait. A wait that ends with done false is not an error: the call succeeds, and the machine goes on toward its target. One case fails: a hibernate whose node refused the save (HibernateMachine).
| Call | done is true when |
|---|---|
StartMachine |
the current state is running, and every boot that a request asked for ran: reboot_pending is false |
StopMachine |
the current state is stopped |
PauseMachine |
the current state is standby |
ResumeMachine |
the current state is running, after the handshake of the guest agent on its new guest link |
HibernateMachine |
the current state is hibernated |
WakeMachine |
the current state is running, after the handshake of the guest agent of the wake |
DiscardMemory |
the current state is stopped. The node drops the memory file before it reports stopped from hibernated, and before the next boot. |
RebootMachine |
the current state is running, and the new boot runs: reboot_pending is false |
RenameMachine |
the new boot runs, for a machine whose current and target state are both running. Any other rename has no wait, and returns done true at once. |
DeleteMachine |
the current state is deleted |
A unary call whose client sends no deadline gets 30 s (the API server). A lifecycle call gets 61 s instead (api.LifecycleTimeout), so its wait of 60 s fits. A deadline from the client stays as it is, and the wait ends 1 s before it. For example, with the header Connect-Timeout-Ms: 10000, the wait ends after about 9 s. A deadline of 1 s or less gives no wait: the call returns the machine after its change.
Each lifecycle response has these fields:
| Field | Type | Description |
|---|---|---|
machine |
Machine |
The machine at the end of the wait. |
duration |
google.protobuf.Duration |
How long the call took, the wait included. |
done |
bool | true: the machine reached what the call asked for before the wait ended. In the JSON codec, false is left out. |
Machines
Section titled “Machines”CreateMachine
Section titled “CreateMachine”Makes a machine and places it on a node (Placement). The machine starts with the state pending and the target running. The call never waits for the machine.
| Item | Value |
|---|---|
| Procedure | /hopbox.v1.MachineService/CreateMachine |
| Policy action | machine.create: a caller that acts in the org (Who can do what) |
| Idempotent option | yes. A call must have an Idempotency-Key header (the API server). A retry with the same key returns the same machine. A create that failed committed nothing, so a retry runs again. |
| Audit entry | action machine.create, org the org, target kind machine, target ID the machine ID, details name, size, image (the digest), and shared |
The request CreateMachineRequest has these fields:
| Field | Type | Default | Description |
|---|---|---|---|
org_id |
optional string | the default org of the caller | The org of the machine (The org of a request). |
name |
string | a free name: box1, box2, and so on |
The name of the machine (Domain rules). |
size |
string | tiny in the personal org of a limited account, else default |
The name of a size. ListMachineSizes gives the default of an org in default_size. |
image |
string | default |
The name of an image. The machine takes the newest image of that name (the admin API). |
restart_policy |
RestartPolicy |
RESTART_POLICY_ALWAYS |
The restart policy. |
start_command |
string | empty | A command that the guest agent runs after each boot (Domain rules). |
auto_delete_timeout |
google.protobuf.Duration |
unset, off | Deletes the machine after this time without use: 0 for off, or 1 minute to 365 days in whole seconds (Domain rules). The delete comes 1 to 2 minutes after this time from the last recorded use. A use is recorded at most once a minute, and the job runs once a minute (Auto-delete). |
auto_standby_timeout |
google.protobuf.Duration |
unset, off | Puts the running machine in standby after this time without inbound traffic: 0 for off, or 1 minute to 365 days in whole seconds (Idle timers). |
auto_hibernate_timeout |
google.protobuf.Duration |
unset, 4 hours | Hibernates the machine after this time without inbound traffic: 0 for off, or 1 minute to 365 days in whole seconds (Idle timers). A zero duration turns it off. |
The response CreateMachineResponse has the field machine, the new Machine. A new machine has the URL port 8000, the visibility private, shared false, no auto-standby, and an auto-hibernate timeout of 4 hours. A machine that an org key makes has shared true.
The call takes these steps in one transaction:
- It takes the key lock of the account of the caller, then locks the org row with
FOR NO KEY UPDATE(Control store tables). So the creates and starts of one org run one after the other, and each limit check counts the one before it. - It checks the policy again under the lock, then the suspension of the org.
- A request without a size takes the default size of the org:
tinyin the personal org of a limited account, elsedefault. It reads the size with a share lock on its row, and the newest image of the name. A retired size fails. The lock makes a retirement of the size wait for the create, and the create wait for a retirement in progress (the admin API). - It checks the usage limits of the org with the new machine:
limits.Check(usage.AfterCreate(size))(Domain rules). - It claims the name. A request without a name gets the first free name of a list:
box1tobox9, then 3 names with a random suffix, such asbox-k3x9q(Domain rules). A free name has no machine and no reservation of another org. - It claims a random free SSH port from 10000 to 30000. A free port has no machine and no reservation (Domain rules).
- It places the machine on a node, with the pool and the labels of the size as filters (Placement).
- It grants the machine lease
machine/<machine ID>to the node, with the server ID as the holder and a TTL of 30 s (Control store tables). - It inserts the machine and a row of
placementswith the epoch and the token of the lease grant. - It writes the audit entry and publishes the event
machine.created(Change events).
A create that fails at any step leaves nothing behind: no machine, no name, no port, and no lease. A create that finds no node with room also logs no node has room for a machine (Placement).
| Error | Code |
|---|---|
A bad name, start command, or timeout, for example invalid argument: invalid machine config: the start command holds a NUL byte |
invalid_argument |
A name that looks like a credential, such as xoxb- with 10 more digits: invalid argument: invalid name: the machine name looks like a credential. A machine name is public: it is in the machine URL, in DNS, and in the audit log. Pick another name (Domain rules) |
invalid_argument |
An unknown size: invalid argument: the install has no size "<size>" |
invalid_argument |
A retired size: invalid argument: the size "<size>" is retired and takes no new machine. Pick another size |
invalid_argument |
The org was deleted after the policy check: not found: the org <id> was deleted |
not_found |
A suspended org: failed precondition: org suspended: an instance admin suspended the org, so it cannot create a machine |
failed_precondition |
No image has the name: failed precondition: the install has no image "<image>". An instance admin registers one with hopboxd admin image register |
failed_precondition |
The org is at a limit, for example usage limit exceeded: the org would have 4 machines, and its limit is 3. The refusal counts in hopbox_limit_refusals_total with the first limit that it breaks (Metrics). |
resource_exhausted |
The name is taken, by a live machine or by a reservation of another org: already exists: the machine name "box1" is taken. A free name is "box2". Without a free suggestion, the message ends with Pick another name. |
already_exists |
No name of the list is free for a create without a name: already exists: hopbox found no free name for the machine. Give it a name |
already_exists |
No node has room (Placement), for example no capacity: no node has room for a machine of size default (2 vCPUs, 8 GiB of RAM). The install has no node yet |
unavailable |
Every SSH port is taken: no capacity: the install has no free SSH port in 10000-30000 |
unavailable |
Other creates took each free port that this one picked, 5 times: unavailable: other creates took each free SSH port that this one picked. Retry |
unavailable |
The SDKs retry unavailable. A retry with the same idempotency key runs the create again, because the failed try committed nothing.
browser -H 'Idempotency-Key: 9b2f4c1e-box1' -d '{"name":"box1"}' $API/hopbox.v1.MachineService/CreateMachine{"machine":{"id":"01a1460c-1f6e-7b8a-9c42-3d5e7f8a9b10","orgId":"01a14565-8448-7753-9c1f-5ec0a86b8d92","name":"box1","state":"MACHINE_STATE_PENDING","targetState":"MACHINE_STATE_RUNNING","size":{"name":"default","vcpus":2,"memoryBytes":"8589934592","diskBytes":"100000000000"},"imageName":"default","imageDigest":"sha256:422d31d7a4fd5e6958162b22e3d772f71b5a1465cbd6255d253ae8c087873dc8","creatorAccountId":"01a14565-8448-774f-9317-ea6348e9a930","restartPolicy":"RESTART_POLICY_ALWAYS","url":"https://box1.example.com","urlPort":8000,"urlVisibility":"URL_VISIBILITY_PRIVATE","sshPort":21467,"lastActivityTime":"2026-10-16T16:02:11.402518Z","stateChangeTime":"2026-10-16T16:02:11.402518Z","version":"1","createTime":"2026-10-16T16:02:11.402518Z","updateTime":"2026-10-16T16:02:11.402518Z"}}A second create with the name box1, from any org:
{"code":"already_exists","message":"already exists: the machine name \"box1\" is taken. A free name is \"box2\"","details":[{"type":"hopbox.v1.MachineNameTaken","value":"CgRib3gxEgRib3gy","debug":{"name":"box1","suggestedName":"box2"}}]}The error of a taken name carries the detail hopbox.v1.MachineNameTaken, so a client reads the free name without parsing the message:
| Field | Type | Description |
|---|---|---|
name |
string | The name that the request asked for. |
suggested_name |
string | A free name close to it. If hopbox found none, it is empty. |
GetMachine
Section titled “GetMachine”Returns one machine that the caller sees.
| Item | Value |
|---|---|
| Procedure | /hopbox.v1.MachineService/GetMachine |
| Policy action | machine.get: those who use the machine, and the org admins and owners (Who can do what) |
| Idempotent option | no |
| Audit entry | none |
The request GetMachineRequest names the machine with id or name (Naming a machine). The response GetMachineResponse has the field machine.
browser -d '{"name":"box1"}' $API/hopbox.v1.MachineService/GetMachineListMachines
Section titled “ListMachines”Lists the machines of an org that the caller sees, by name. A machine whose current state is deleted is not in the list. A machine whose target is deleted is, until its executor deleted it.
| Item | Value |
|---|---|
| Procedure | /hopbox.v1.MachineService/ListMachines |
| Policy action | machine.list: a caller that acts in the org. The list holds only the machines that the caller can read with machine.get. |
| Idempotent option | no |
| Audit entry | none |
The request ListMachinesRequest has the field org_id. The response ListMachinesResponse has the field machines, a repeated Machine. The list has no pages.
browser -d '{}' $API/hopbox.v1.MachineService/ListMachinesWatchMachines
Section titled “WatchMachines”A server stream. First, it sends each machine of an org that the caller sees. Then it sends a message with synced true. Then it sends each change of those machines as it happens.
| Item | Value |
|---|---|
| Procedure | /hopbox.v1.MachineService/WatchMachines |
| Policy action | machine.watch: a caller that acts in the org. The stream holds only the machines that the caller can read with machine.get. |
| Idempotent option | no |
| Audit entry | none |
The request WatchMachinesRequest has the field org_id. Each message WatchMachinesResponse holds one field of the oneof event:
| Field | Type | Description |
|---|---|---|
machine |
Machine |
A machine as it is now: in the first list, new, or changed. |
gone_machine_id |
string | The UUID of a machine that the caller no longer sees, for example after an unshare, or after the leader dropped its row. The stream sends it only for a machine that it sent before. |
synced |
bool | true. It ends the first list. Every later message is a change. |
The stream follows the change events of the machines of the org (Change events). For each change, it reads the machine again and sends it as it is then. So several quick changes of one machine can arrive as one message. A machine that its executor deleted comes once more, with the state deleted, and then no more. A machine that becomes visible arrives as a machine message, for example after its creator shares it.
Every 30 s, the stream checks two things again:
- The credential of the caller. The end of the credential ends the stream with
unauthenticatedand the messagethe credential of this stream ended. Sign in again: .... Examples are a sign-out of a session, the end of a CLI sign-in, the revoke of an API key, and an expiry. A suspend of the account ends its credentials too (the admin API). The stream also ends at the expiry of its credential, without a wait for the next check (the API server). - The role of the caller in the org. A caller that left the org, or lost its access in another way, gets
permission_denied, and the stream ends. After a change of role, the caller can lose the sight of a machine. An example is a private machine of another member, after an admin became a member. Such a machine arrives asgone_machine_id.
The stream has no default deadline, so it runs until the client ends it, until its credential ends, or until the listener stops (the API server).
A server stream needs a streaming protocol: gRPC, gRPC-Web, or the Connect streaming protocol with the content type application/connect+json. A call with the session cookie must use the Connect protocol (Sessions, cookies, and sign-in links). Create and manage machines shows such a call with curl.
| Error | Code |
|---|---|
The control role has no feed of change events: unavailable: this server streams no machine changes. The control role of hopboxd run always has one (hopboxd). |
unavailable |
| The caller lost its access to the org during the stream | permission_denied |
| The credential of the caller ended during the stream, or before it: a sign-out, the end of a CLI sign-in, the revoke of an API key, or an expiry | unauthenticated |
ListMachineSizes
Section titled “ListMachineSizes”Lists the sizes that a machine can have, smallest first: by vCPUs, then RAM, then name. The list leaves out the retired sizes.
| Item | Value |
|---|---|
| Procedure | /hopbox.v1.MachineService/ListMachineSizes |
| Policy action | machine.list_sizes: session, cli_token, member_key, and org_key |
| Idempotent option | no |
| Audit entry | none |
The request ListMachineSizesRequest has the field org_id, an optional string: the org whose default size the response gives (The org of a request). The caller needs a role in that org, as for GetOrg. The response ListMachineSizesResponse has these fields:
| Field | Type | Description |
|---|---|---|
sizes |
repeated MachineSize |
The sizes of the install. |
default_size |
string | The name of the size of a create without a size in the org: tiny in the personal org of a limited account, else default (CreateMachine). |
An instance admin adds and retires sizes with the admin API (the admin API). A user picks a size, never a pool: the pool and the labels of an operator size stay with the instance admin.
browser -d '{}' $API/hopbox.v1.MachineService/ListMachineSizes{"sizes":[{"name":"tiny","vcpus":1,"memoryBytes":"1073741824","diskBytes":"5000000000"},{"name":"default","vcpus":2,"memoryBytes":"8589934592","diskBytes":"100000000000"}],"defaultSize":"default"}Lifecycle
Section titled “Lifecycle”StartMachine
Section titled “StartMachine”Sets the target of a machine to running, and waits until it runs (Lifecycle calls).
| Item | Value |
|---|---|
| Procedure | /hopbox.v1.MachineService/StartMachine |
| Policy action | machine.start: those who use the machine |
| Idempotent option | no. A second call finds the target running, and changes nothing, unless the machine is failed. |
| Audit entry | action machine.start, target kind machine, details name, old_target, retry, and boot_again. retry is true for the start of a failed machine. boot_again is true for the start of a stopped machine with the restart policy never. Each of these two starts asks for a new boot. |
The request StartMachineRequest names the machine. The response StartMachineResponse has the fields machine, duration, and done.
A start is allowed for a machine whose target is stopped or running. A start locks the org row with FOR NO KEY UPDATE, as a create does. A machine whose target is stopped holds no vCPUs and no RAM yet. So its start checks these:
- The usage limits of the org:
limits.Check(usage.AfterStart(size, counted))(Domain rules). - The room on the node of the machine, with the rules of placement: the vCPUs with an overcommit of 2, and the RAM without overcommit (Placement). The machine and its disk live on that node, so a start cannot go elsewhere in phase 1.
A start of a machine whose current state is failed also asks for a new boot, as a reboot does. So the executor tries again, even with the target running already. For example, it retries a wake from the kept memory file (Domain rules). The call then waits for that new boot.
A start of a machine with a memory file wakes it. So the start takes the node checks of WakeMachine: the node must name the feature hibernate, and its driver must have the capability restore. This is the default of Q204, which the owner decided on 2026-11-08.
A start of a machine with the restart policy never whose current state and target are both stopped also asks for a new boot. After a shutdown from inside, the executor keeps such a machine down until a new request (the node executor). The control role sends a spec with the state of the machine at the time of the send. So when a start comes soon after the shutdown, the executor can get the target running again, and never the target stopped. The new boot request tells the executor to boot the machine. reboot_pending is true until that boot runs. A second start finds the target running, and asks for no other boot.
A start that changes the machine also counts as a use of the machine. It sets last_activity_time to now.
| Error | Code |
|---|---|
The target is standby, hibernated, or deleted, for example failed precondition: machine action not allowed: cannot start a machine whose target state is hibernated |
failed_precondition |
A suspended org: failed precondition: org suspended: an instance admin suspended the org, so it cannot start a machine |
failed_precondition |
The org is at a limit, for example usage limit exceeded: the org would use 8 vCPUs, and its limit is 6 |
resource_exhausted |
The node of the machine has no room: no capacity: the node of the machine has too few free vCPUs to start it. Stop another machine, or retry later, or the same with too little free RAM |
unavailable |
A machine with a memory file, on a node without the feature or the capability, with the messages of WakeMachine |
failed_precondition |
StopMachine
Section titled “StopMachine”Sets the target of a machine to stopped, and waits until it is stopped.
| Item | Value |
|---|---|
| Procedure | /hopbox.v1.MachineService/StopMachine |
| Policy action | machine.stop: those who use the machine, and the org admins and owners |
| Idempotent option | no. A second call changes nothing. |
| Audit entry | action machine.stop, target kind machine, details name and old_target |
The request StopMachineRequest names the machine. The response StopMachineResponse has the fields machine, duration, and done. A stopped machine keeps its disk and its place in the machine count of the org, and frees its vCPUs and RAM (the org API).
| Error | Code |
|---|---|
The target is hibernated: failed precondition: machine action not allowed: cannot stop a hibernated machine: wake it first (Domain rules). To stop it without a wake, its creator drops the memory file with DiscardMemory. |
failed_precondition |
A wake is pending: the current state is hibernated, and the node keeps the memory file. failed precondition: machine action not allowed: cannot stop a machine that is hibernated: wait for the end of its wake. After a failed wake, drop the file with DiscardMemory (Domain rules). Q206 decided it. |
failed_precondition |
The target is deleted |
failed_precondition |
browser -d '{"name":"box1"}' $API/hopbox.v1.MachineService/StopMachineOn a node with an executor, the call returns once the machine stopped:
{"machine":{"id":"01a1460c-1f6e-7b8a-9c42-3d5e7f8a9b10","orgId":"01a14565-8448-7753-9c1f-5ec0a86b8d92","name":"box1","state":"MACHINE_STATE_STOPPED","targetState":"MACHINE_STATE_STOPPED",...,"version":"7",...},"duration":"0.412s","done":true}On an install without an executor, the wait ends after 60 s. The state stays MACHINE_STATE_PENDING, and done is left out because it is false.
The output here is cut short.
PauseMachine
Section titled “PauseMachine”Puts a running machine in standby, and waits until it is there. The memory of the machine stays in the RAM of its node, and the guest does not run. A machine in standby still counts in the limits of its org and on its node (Usage and limits).
| Item | Value |
|---|---|
| Procedure | /hopbox.v1.MachineService/PauseMachine |
| Policy action | machine.pause: those who use the machine, and the org admins and owners, as for StopMachine |
| Idempotent option | no. A second call changes nothing. |
| Audit entry | action machine.pause, target kind machine, details name and old_target |
The request PauseMachineRequest names the machine. The response PauseMachineResponse has the fields machine, duration, and done. A pause is allowed in a suspended org.
A pause closes the guest link of the machine. So an exec, a file copy, or a web terminal that runs ends with an error. The machine has no route while it is in standby. A connection to its URL or its SSH port, after its check of access, resumes it, and the edge holds the connection until the machine runs (the edge role). So do Exec, Upload, and Download (Wake for an access call).
| Error | Code |
|---|---|
The current state is not running or standby, for example failed precondition: machine action not allowed: cannot pause a machine that is pending |
failed_precondition |
The target is not running or standby, for example failed precondition: machine action not allowed: cannot pause a machine whose target state is stopped |
failed_precondition |
The machine has a move that runs, in stopping or pulling: failed precondition: the machine <name> moves to another node. Pause it after the move. A move hands the target of the machine to its target node, which has no microVM to pause. A node that removes the old copy of a move that ended blocks no pause. |
failed_precondition |
The node of the machine runs an older release: failed precondition: the node of the machine <name> runs hopboxd <version>, whose heartbeats name no feature standby. An instance admin must upgrade the node first |
failed_precondition |
The driver of the node cannot pause: failed precondition: the node of the machine <name> runs hopboxd <version>, whose VMM driver cannot pause |
failed_precondition |
browser -d '{"name":"box1"}' $API/hopbox.v1.MachineService/PauseMachineResumeMachine
Section titled “ResumeMachine”Takes a machine out of standby, and waits until it runs. The guest goes on from where it was. A resume boots nothing, so the boot ID stays, and the start command does not run again. The guest agent gets a new link key and a new guest link (the node executor).
| Item | Value |
|---|---|
| Procedure | /hopbox.v1.MachineService/ResumeMachine |
| Policy action | machine.resume: those who use the machine, as for StartMachine |
| Idempotent option | no. A second call fails with failed_precondition, because the target is running then. |
| Audit entry | action machine.resume, target kind machine, details name and old_target |
The request ResumeMachineRequest names the machine. The response ResumeMachineResponse has the fields machine, duration, and done. A resume counts as a use for the auto-delete timeout. It checks no limit, because a machine in standby holds its vCPUs and RAM already. A resume needs the node of the machine, because the memory of the machine lives in the RAM of that node.
| Error | Code |
|---|---|
The target is not standby: failed precondition: machine action not allowed: cannot resume a machine whose target state is running |
failed_precondition |
A suspended org: failed precondition: org suspended: an instance admin suspended the org, so it cannot resume a machine |
failed_precondition |
The node of the machine lacks the feature or the capability, with the messages of PauseMachine |
failed_precondition |
A machine can lose its standby: a node reboot, a crash, or a kill of its unit ends its RAM. The target then follows its restart policy, running for always and stopped for never (the node executor). So after a reboot of the node, a call of ResumeMachine finds another target and fails.
HibernateMachine
Section titled “HibernateMachine”Saves the memory of a running machine, or of a machine in standby, to a memory file on its node. Then it ends the microVM, and waits until the machine is hibernated. A hibernated machine frees its vCPUs and RAM. It still counts in the machine count and the disk of its org. Its memory file counts in the stored state of the org (Usage and limits). Only the daily budget of saves, saved_bytes_per_day, refuses a hibernate.
| Item | Value |
|---|---|
| Procedure | /hopbox.v1.MachineService/HibernateMachine |
| Policy action | machine.hibernate: those who use the machine, and the org admins and owners, as for StopMachine |
| Idempotent option | no. A second call finds the target hibernated, and changes nothing. |
| Audit entry | action machine.hibernate, target kind machine, details name and old_target |
The request HibernateMachineRequest names the machine. The response HibernateMachineResponse has the fields machine, duration, and done. A hibernate is allowed in a suspended org. The response has memory_saved true once the node reported the file.
A hibernate closes the guest link of the machine first. So an exec, a file copy, or a web terminal that runs ends with an error. A hibernated machine has no route, so its URL and its SSH port refuse a connection. Milestone T06 of phase 3 makes a connection wake the machine. A save that fails keeps the machine as it was, and the node tries again (the node executor). The wait then ends after 60 s with done false.
A call that changes the target checks the daily budget of the org under the lock of the org row. The save writes up to the RAM of the machine, so the check counts the RAM as the size of the save (Domain rules). The bytes of the saves of the last 24 hours plus the RAM must be at most saved_bytes_per_day. Otherwise the call fails, and the machine keeps its target. The refusal sets save_budget_refused_at of the org, outside the transaction of the call, and logs the daily budget of saves refused a hibernate, so the machine runs on at level warn, with org and err. The next run of the abuse detection gives each instance admin a notice of it (Abuse detection). A record that fails logs cannot record the refusal of the daily budget of saves at level warn, and the call still fails with the refusal.
If the save leaves less free disk than the floor of the node, the node refuses it (the node executor). Then the machine runs on, or stays in standby:
- The node reports the current state again, with the refusal and its reason (the executor protocol).
- The control role sets the target back to that state,
runningorstandby. It records the time and the reason of the refusal in the machine row (Control store tables). - It writes the audit entry
machine.save_refusewith the actorsystem. Its details areold_targethibernated,targetrunningorstandby,refuseddisk_low, andreason, the words of the node. - The wait of the call ends on the new target, and the call fails with the reason of the node.
A refusal that the node reported before the call does not fail the call. A control process of an older release ignores the refusal, so the target stays hibernated, and the node tries the save again.
| Error | Code |
|---|---|
The daily budget of the org: usage limit exceeded: the saves of the org would write <bytes> bytes in 24 hours, and its daily budget is <limit> |
resource_exhausted |
The node refused the save: resource exhausted: the node of the machine <name> refused the save, so the machine runs on: <reason>. The reason is the words of the node, for example the free disk of the node is below the floor of a save: <free> bytes are free, the save takes up to <bytes>, and the floor is <floor>. |
resource_exhausted |
The target is not running, standby, or hibernated, for example failed precondition: machine action not allowed: cannot hibernate a machine whose target state is stopped |
failed_precondition |
The current state is not running, standby, or hibernated, for example failed precondition: machine action not allowed: cannot hibernate a machine that is starting |
failed_precondition |
The machine has a move that runs, in stopping or pulling: failed precondition: the machine <name> moves to another node. Hibernate it after the move |
failed_precondition |
The node of the machine runs an older release: failed precondition: the node of the machine <name> runs hopboxd <version>, whose heartbeats name no feature hibernate. An instance admin must upgrade the node first |
failed_precondition |
The driver of the node cannot save: failed precondition: the node of the machine <name> runs hopboxd <version>, whose VMM driver cannot snapshot |
failed_precondition |
A control process of an older release is live: failed precondition: the control process <process> knows the migrations up to <n>, and only a hopboxd that knows migration 73 hibernates machines. Upgrade it first. Such a process takes a report of hibernated from a node, and drops its memory state. |
failed_precondition |
Only a call that changes the target runs these checks: the control processes, the move, the node, and the daily budget.
browser -d '{"name":"box1"}' $API/hopbox.v1.MachineService/HibernateMachineWakeMachine
Section titled “WakeMachine”Loads a hibernated machine from its memory file, and waits until it runs. The guest goes on from where it was, so the boot ID stays, and the start command does not run again. The guest agent gets a new link key and a new guest link. The node drops the memory file once the guest agent linked (the node executor).
| Item | Value |
|---|---|
| Procedure | /hopbox.v1.MachineService/WakeMachine |
| Policy action | machine.wake: those who use the machine, as for StartMachine |
| Idempotent option | no. A second call fails with failed_precondition, because the target is running then. |
| Audit entry | action machine.wake, target kind machine, details name and old_target |
The request WakeMachineRequest names the machine. The response WakeMachineResponse has the fields machine, duration, and done. A wake counts as a use for the auto-delete timeout. A hibernated machine holds no vCPUs and no RAM, so a wake takes the checks of a start: the usage limits of the org, and the room on the node of the machine (StartMachine). A wake needs the node of the machine, because its memory file lives there.
A suspension of the org or of the creator cancels a pending wake. It sets the target back to hibernated, and the machine stays hibernated with its memory file (Domain rules). A wait for the wake then ends with done false. A wake that fails sets the current state failed, and the wait ends with done false. The machine keeps the target running and its memory file, and memory_saved stays true. The restart policy then decides: with always, the node tries the wake again after a backoff. With never, the machine stays failed until a start. A start of the failed machine tries the wake again (StartMachine). A stop keeps the file too. To boot from the disk instead, the creator calls DiscardMemory. Standby and hibernate shows what to do.
| Error | Code |
|---|---|
The target is not hibernated: failed precondition: machine action not allowed: cannot wake a machine whose target state is running |
failed_precondition |
A suspended org: failed precondition: org suspended: an instance admin suspended the org, so it cannot wake a machine |
failed_precondition |
A private machine whose creator an instance admin suspended: failed precondition: an instance admin suspended the creator of the private machine <name>, so it does not resume or wake |
failed_precondition |
The org is at a limit, with the message of StartMachine |
resource_exhausted |
The node of the machine has no room, with the message of StartMachine |
unavailable |
The node of the machine runs an older release: failed precondition: the node of the machine <name> runs hopboxd <version>, whose heartbeats name no feature hibernate. An instance admin must upgrade the node first |
failed_precondition |
The driver of the node cannot load: failed precondition: the node of the machine <name> runs hopboxd <version>, whose VMM driver cannot restore |
failed_precondition |
A control process of an older release is live: failed precondition: the control process <process> knows the migrations up to <n>, and only a hopboxd that knows migration 73 hibernates machines. Upgrade it first. Such a process takes a report of hibernated from a node, and drops its memory state. |
failed_precondition |
browser -d '{"name":"box1"}' $API/hopbox.v1.MachineService/WakeMachineDiscardMemory
Section titled “DiscardMemory”Drops the memory file of a machine with no microVM, and sets its target to stopped. It waits until the machine is stopped. The programs of the machine and their data in RAM end. The node first puts the disk of the save back. So the next start boots from that disk, not from a disk that a failed wake changed. This is the default of Q205, which the owner decided on 2026-11-08. Use it for a machine whose wake fails, or to stop a hibernated machine without a wake. The owner decided on this call on 2026-11-06, in Q192.
| Item | Value |
|---|---|
| Procedure | /hopbox.v1.MachineService/DiscardMemory |
| Policy action | machine.discard_memory: the creator of the machine only, as for ShareMachine. The call ends the state of a run of the machine for good. |
| Idempotent option | no. A second call fails with failed_precondition, because the machine has no memory file then. |
| Audit entry | action machine.discard_memory, target kind machine, details name and old_target |
The request DiscardMemoryRequest names the machine. The response DiscardMemoryResponse has the fields machine, duration, and done.
The call works only in these states, where no microVM of the machine runs or starts (Domain rules):
| Target | Current state | Case |
|---|---|---|
hibernated |
hibernated |
a hibernated machine |
running |
failed |
a wake that failed |
stopped |
failed |
a wake that failed, then a stop |
stopped |
stopped |
a wake that failed, then a stop that ended |
In one transaction, the call adds 1 to the reboot generation of the machine, and names that generation in discard_memory_generation (Control store tables). It ends the row of the memory file, so memory_saved turns false at once. The node drops the file that a boot below that generation saved, before any other step (the node executor). So an old request never drops the file of a later hibernate. The node puts the disk copy of the saved state back over the disk before the drop (the Firecracker driver). The drop is an unlink, and the bytes can stay on the disk of the node until it reuses the blocks.
For a machine that is stopped already, the wait ends at once with done true, before the node drops the file. The node drops it at its next step, and then reports stopped with the discard generation (the node executor). Until that report, MoveMachine and a drain refuse the machine, because its disk can still be the one that a failed wake changed (Cold move).
| Error | Code |
|---|---|
Another pair of target and current state, for example failed precondition: machine action not allowed: cannot discard the memory of a machine that is running, with the target running: only a machine with no microVM drops its memory file |
failed_precondition |
The target is deleted: failed precondition: machine action not allowed: cannot discard the memory of a machine that is being deleted |
failed_precondition |
A suspended org: failed precondition: org suspended: an instance admin suspended the org, so it cannot discard the memory of a machine |
failed_precondition |
The node keeps no memory file of the machine: failed precondition: the machine has no memory file |
failed_precondition |
The node of the machine runs an older release: failed precondition: the node of the machine <name> runs hopboxd <version>, whose heartbeats name no feature hibernate. An instance admin must upgrade the node first |
failed_precondition |
The driver of the node cannot load: failed precondition: the node of the machine <name> runs hopboxd <version>, whose VMM driver cannot restore. The drop of the file needs the interface of the capability restore. |
failed_precondition |
| A caller that is not the creator (Who can do what) | permission_denied. A member on a private machine of another gets not_found. |
A control process of an older release is live: failed precondition: the control process <process> knows the migrations up to <n>, and only a hopboxd that knows migration 73 hibernates machines. Upgrade it first. Such a process takes a report of hibernated from a node, and drops its memory state. |
failed_precondition |
browser -d '{"name":"box1"}' $API/hopbox.v1.MachineService/DiscardMemoryRebootMachine
Section titled “RebootMachine”Boots a running machine again, and waits for the new boot. The call adds 1 to the reboot number of the machine, so reboot_pending is true until the executor runs the new boot. The target stays running.
| Item | Value |
|---|---|
| Procedure | /hopbox.v1.MachineService/RebootMachine |
| Policy action | machine.reboot: those who use the machine |
| Idempotent option | no. Each call asks for one more boot. |
| Audit entry | action machine.reboot, target kind machine, details name |
The request RebootMachineRequest names the machine. The response RebootMachineResponse has the fields machine, duration, and done.
| Error | Code |
|---|---|
The target is not running, or the current state is not running, for example failed precondition: machine action not allowed: cannot reboot a machine that is pending |
failed_precondition |
A suspended org: failed precondition: org suspended: an instance admin suspended the org, so it cannot reboot a machine |
failed_precondition |
RenameMachine
Section titled “RenameMachine”Gives a machine a new name. The old name stays reserved for the org for 7 days, as the name of a deleted machine does. So its URL never leads to the machine of a stranger. The org can take the old name back during those 7 days. A rename reboots a machine whose current and target state are both running, so the guest learns its new name. The call then waits for the new boot.
| Item | Value |
|---|---|
| Procedure | /hopbox.v1.MachineService/RenameMachine |
| Policy action | machine.rename: those who use the machine |
| Idempotent option | no. A second call finds the new name, and changes nothing. |
| Audit entry | action machine.rename, target kind machine, details old_name, new_name, and name (the old name). Each entry of a machine goes without the refused name details, each of these three that looks like a credential (Domain rules). |
| Field | Type | Description |
|---|---|---|
id or name |
string | The machine (Naming a machine). |
new_name |
string | The new name (Domain rules). |
The response RenameMachineResponse has the fields machine, duration, and done. A rename to the name that the machine has already changes nothing, and returns done true at once. A rename is allowed in a suspended org.
A machine in standby refuses a new name, because a rename reboots a running machine, and a machine in standby takes no reboot. The refusal covers each machine whose current state or target is standby, so also a pause or a resume in progress. The owner decided this on 2026-11-07, in Q200.
A hibernated machine refuses a new name by the same rule, because a wake runs no reboot either. Without the rule, the guest keeps its old host name after the wake. The refusal covers each machine whose current state or target is hibernated, so also a hibernate or a wake in progress. This is the default of Q203, which the owner decided on 2026-11-08.
A rename to the name that the machine has already stays a success, in each of these states.
An org holds at most 100 names in reservation (domain.MaxNameReservations): the old names of renames and the names of deleted machines, for 7 days each. A rename while the org holds 100 fails, so renames cannot hold back names from other orgs without end. A delete always reserves its name, also beyond 100.
Two renames that swap the names of two machines at the same time lock both name rows in the order of the names (Control store tables). So they never deadlock: the first one wins, and the second one finds its new name taken.
| Error | Code |
|---|---|
A bad new name, also a name that looks like a credential, with the message of CreateMachine |
invalid_argument |
The new name is taken, with a free name in the message and in the detail MachineNameTaken, as for CreateMachine |
already_exists |
The org holds 100 reserved names: usage limit exceeded: the org holds 100 reserved machine names, the most that it can hold. A name stays reserved for 7 days after its rename or delete |
resource_exhausted |
The target is deleted |
failed_precondition |
The current state or the target is standby: failed precondition: machine action not allowed: cannot rename a machine in standby: resume it first |
failed_precondition |
The current state or the target is hibernated: failed precondition: machine action not allowed: cannot rename a hibernated machine: wake it first |
failed_precondition |
DeleteMachine
Section titled “DeleteMachine”Sets the target of a machine to deleted, and waits until its executor deleted it. Its name and its SSH port stay reserved for 7 days (Domain rules). Only the same org can take the name back in that time. The machine stops counting in the usage of the org at once.
| Item | Value |
|---|---|
| Procedure | /hopbox.v1.MachineService/DeleteMachine |
| Policy action | machine.delete: those who use the machine, and the org admins and owners |
| Idempotent option | no. A second call fails with failed_precondition. |
| Audit entry | action machine.delete, target kind machine, details name |
The request DeleteMachineRequest names the machine. The response DeleteMachineResponse has the fields machine, duration, and done. The machine has delete_request_time.
The delete detaches each extra disk of the machine, and keeps it (Extra disks). Each disk goes on counting in the limits of the org, until its creator deletes it.
A delete is allowed from any target but deleted. A delete and DiscardMemory are the only calls that drop the memory file of a hibernated machine (Domain rules). The leader drops the row of the machine 7 days after the delete request, once its executor deleted it (hopboxd).
A delete by a user keeps the backups of the machine until the end of their retention. ListBackups with the ID of the machine lists them, also after the leader dropped the row of the machine (ListBackups). The restore of such a backup, the undo of the delete, comes in milestone T22. The owner decided this on 2026-11-06, in Q189.
| Error | Code |
|---|---|
The target is deleted already: failed precondition: machine action not allowed: cannot delete a machine that is being deleted |
failed_precondition |
A suspended org: failed precondition: org suspended: an instance admin suspended the org, so it cannot delete a machine |
failed_precondition |
browser -d '{"name":"box1"}' $API/hopbox.v1.MachineService/DeleteMachineAccess calls
Section titled “Access calls”The access calls run a command in a machine, copy files in and out of it, and read its log. They are streams. Exec streams both ways, Upload streams from the client, and Download and StreamMachineLogs stream from the server. The control role never reaches the guest agent itself. It opens a data stream to the node of the machine over the control channel (the control channel). The node runs the call on the guest link of the machine. The code is in internal/service/machine_access.go, internal/api/handlers_machine_access.go, and internal/api/websocket.go.
| Call | Kind | What the machine must be |
|---|---|---|
Exec |
bidi stream | running |
Upload |
client stream | running |
Download |
server stream | running |
StreamMachineLogs |
server stream | any state but deleted. A stopped machine keeps its log. |
Who can call them
Section titled “Who can call them”Every access call has the policy action machine.exec. Only a caller who uses the machine passes: its creator, or for a shared machine, any caller that acts in its org (Who can do what). An org admin or an org owner cannot call them on a private machine of another member. An instance admin cannot call them on a machine of an org of which it is not a member.
| Case | Code |
|---|---|
| A caller without a credential | unauthenticated |
| A member on a private machine of another member | not_found |
| An org admin or owner on a private machine of another member | permission_denied |
A machine that is not running, for Exec, Upload, or Download |
failed_precondition, with the message failed precondition: the machine <name> is <state>, not running. Start it first. A machine in standby or hibernated resumes or wakes first (Wake for an access call). |
A machine in standby or hibernated that does not run within the wait of the lifecycle calls, for Exec, Upload, or Download |
unavailable, with the message unavailable: the machine did not resume or wake in time. Retry: the machine <name> is <state> |
A resume or a wake that its checks refuse, for Exec, Upload, or Download |
the code and the message of ResumeMachine or WakeMachine, such as resource_exhausted for an org limit |
A machine of a suspended org, for Exec, Upload, or Download |
failed_precondition, with the message failed precondition: org suspended: an instance admin suspended the org of the machine |
A machine whose target or current state is deleted |
not_found |
| The node of the machine has no channel to the control process. Or it has 255 data streams open. Or it did not attach the stream within 10 s. | unavailable. A retry can work. |
The caller has 32 open access calls to the node of the machine (service.MaxCallerStreams) |
resource_exhausted, with the message too many requests: you have 32 open streams to the node of this machine, the most for one caller. End one, then retry |
The org of the machine has 128 open access calls to its node (service.MaxOrgStreams) |
resource_exhausted, with the message too many requests: the org has 128 open streams to the node of this machine, the most for one org. End one, then retry |
| The guest agent of the machine is not connected, or the machine stopped during the call | unavailable |
Wake for an access call
Section titled “Wake for an access call”Exec, Upload, and Download resume a machine in standby, and wake a hibernated machine (Q180 of the phase 3 plan). hopbox connect and the web terminal use Exec, so they wake a machine too. GetMachine, ListMachines, and StreamMachineLogs wake nothing.
The call first checks the access of the caller, as in Who can call them. So a caller who cannot use the machine wakes nothing. The call then runs ResumeMachine or WakeMachine with the rights of the caller, with their checks, their audit entry, and their wait of up to 60 s. A machine whose target is running already, such as during a wake of another call, only gets the wait. Once the machine runs, the call goes on. A refused resume or wake fails the call with its error, and leaves the machine as it was. A failed wake fails the call with the error of a machine that is not running.
How a stream ends
Section titled “How a stream ends”Each access call runs under the guard of its credential (the API server). It also checks the access of the caller again at each change event of the machine (Change events), and every 30 s (service.DefaultCredentialRecheck):
- The end of the credential ends the call: a sign-out, the end of a CLI sign-in, the revoke of an API key, or an expiry. The code is
unauthenticated, and the message isthe credential of this stream ended. Sign in again: .... - A loss of the access ends the call: an unshare, a delete, the leave of the caller from the org, or a change of its role. The code is that of the new check, such as
not_foundorpermission_denied. The message starts withthe access to the machine ended:. An unshare and a delete end the call at once, because they are change events of the machine. A change of role ends it within 30 s. - A suspension of the org ends an
Exec, anUpload, or aDownloadwithfailed_precondition. The suspension also stops the machine. - The stop of the API listener ends each access call with
unavailableand the messageunavailable: the server shuts down. Call again. So a read of the log withfollownever ends withokat a stop.
When a call ends early, the node ends the command or the copy. The guest agent stops the command of an exec: first with SIGTERM, then after 2 s with SIGKILL.
Each check records a use of the machine for its auto-delete timeout (Auto-delete). A check runs at the start of the call, and then every 30 s.
The control role logs these records of the checks, with the field machine. The call goes on after each of them:
| Message | Level | Fields |
|---|---|---|
cannot record the use of a machine |
warn | machine, err. The write of the last use failed, at the start of the call or at a check. |
the check of the access to a machine failed |
warn | machine, err. The check itself failed, for example on a control store that does not answer. The next check tries again. |
A client that reads nothing slows the command down, and holds back no other call. Each hop reads the next message only after it handed on the last one: the client, the edge, the control role, the node, and the guest agent. So no hop keeps more than its HTTP/2 window of a stream. The same holds for input: a command that reads no input stalls the client after about 5 MiB, the windows and the input queues of the hops together. The control channel and the guest link send no gzip, so their windows count the bytes of the input, not of a compressed copy. A call that ended early, and whose client still reads nothing 5 s later, ends without its last message.
Limits
Section titled “Limits”| Limit | Value |
|---|---|
| Data of a download | 4 MiB (4,194,304 bytes, service.DownloadLimit), for every caller of this release. A download from inside a machine will get 1 GB with the machine tokens of phase 5. |
| Data of an upload | no limit |
| Time without data in an upload | 1 min (service.UploadIdleTimeout), counted only while the call waits for the client. A node that takes the data slowly does not count. After the time, the upload ends with deadline_exceeded. |
| Open access calls of one caller to one node | 32 (service.MaxCallerStreams). The caller is an account. All the org keys of an org count as one caller. |
| Open access calls of one org to one node | 128 (service.MaxOrgStreams), for all its callers together. A node has at most 255 data streams for every org together (the control channel). |
One stdin chunk, or one data message of an upload |
1 MiB |
argv of an exec |
at most 4096 items and 256 KiB in all. Each item is valid UTF-8 without a NUL byte. The first item is not empty. |
env of an exec |
at most 256 env vars and 256 KiB of names and values in all. A name has 1 to 128 characters: letters, digits, and _. It does not start with a digit. A value is valid UTF-8 without a NUL byte. Unlike a stored env var, any such name works, also a reserved name or one that looks like a credential (the env var API). The caller has a shell in the machine anyway, and the value lasts only for the command. |
user, term |
at most 256 bytes each, valid UTF-8 without a NUL byte |
dir, path |
at most 4096 bytes, valid UTF-8 without a NUL byte. path is not empty. |
timeout of an exec |
1 s to 24 h, or unset for none |
| Terminal size | 1 to 1000 rows, and 1 to 1000 columns |
tail of StreamMachineLogs |
0 to 10000 |
A request that breaks a limit gets invalid_argument.
Runs a command in a running machine, as the Linux user user by default (Default image). The command gets the env of the machine, then the env vars of the request (the env var API).
| Item | Value |
|---|---|
| Procedure | /hopbox.v1.MachineService/Exec |
| Policy action | machine.exec |
| Idempotent option | no |
| Audit entry | none |
Each message ExecRequest and ExecResponse holds one ExecChunk in the field chunk. The first chunk from the client holds start, and only the first chunk does. The next chunks from the client hold stdin, stdin_eof, resize, or signal. The server sends stdout and stderr, and at the end exit, its last chunk. Then the stream ends with the code ok. An exec needs a stream in both directions, so it needs HTTP/2, or the WebSocket endpoint.
ExecChunk holds one field of the oneof chunk:
| Field | Type | From | Description |
|---|---|---|---|
start |
ExecStart |
the client | The machine and the command. |
stdin |
bytes | the client | Input for the command. |
stdout |
bytes | the server | Output of the command. With a terminal, all output arrives as stdout. |
stderr |
bytes | the server | Error output of the command. |
resize |
TerminalSize |
the client | A new size of the terminal. With a guest agent that knows ExecResponse.control (Guest link), it takes effect before any stdin that the client sends after it. An older guest agent can apply it later. |
stdin_eof |
bool | the client | No more input. With a terminal, the command reads the end-of-file character, Ctrl-D. |
exit |
ExecExit |
the server | How the command ended. |
signal |
string | the client | A signal for the process group of the command, by name, such as SIGINT or SIGTERM. The guest agent ignores a name that it does not know. With a guest agent that knows ExecResponse.control (Guest link), it takes effect before any stdin that the client sends after it. An older guest agent can apply it later. |
ExecStart:
| Field | Type | Description |
|---|---|---|
id or name |
string | The machine, in the oneof machine (Naming a machine). |
argv |
repeated string | The program and its arguments. The guest agent looks the program up in the PATH of the command. Empty runs the login shell of the user as a login shell, as hopbox connect does. |
env |
map of string to string | Env vars on top of the env of the machine. |
user |
string | The Linux user. Empty is user. |
dir |
string | The working directory. Empty is the home directory of the user. |
tty |
bool | Runs the command in a pseudo-terminal. |
size |
TerminalSize |
The first size of the terminal, with tty. |
term |
string | The TERM env var, with tty. Empty is xterm-256color. |
timeout |
google.protobuf.Duration |
Ends the command after this time. Unset is no timeout. |
TerminalSize has rows and cols, both uint32.
ExecExit:
| Field | Type | Description |
|---|---|---|
code |
int32 | The exit code. A command that a signal ended has 128 plus the signal number. A program that does not exist has 127. A command that did not start for another reason has 126. A command that its timeout ended has 124. |
signal |
string | The name of the signal that ended the command, such as SIGKILL, or empty. |
error |
string | Why the command did not start, or empty. |
timed_out |
bool | The timeout ended the command. |
A client that ends its side of the stream sends no more input, and the command runs on. A client that cancels the call ends the command.
hopbox connect opens a shell with Exec: tty true and no argv. A connect to a machine in standby or hibernated resumes or wakes it first (Wake for an access call). A connect to a machine that is stopped or failed gets failed_precondition (Who can call them). The owner decided this on 2026-11-06, in Q180. The CLI gives exec its JSON output, its exit status, and its terminal handling (hopbox CLI).
The WebSocket endpoint
Section titled “The WebSocket endpoint”A browser cannot open a stream in both directions with an RPC, so the console uses a WebSocket for exec. The endpoint runs the same exec as Exec.
| Item | Value |
|---|---|
| Path | GET /api/ws/exec on the API listener, over HTTP/1.1 (api.WebSocketExecPath) |
| Messages | One hopbox.v1.ExecChunk in each binary message, encoded as protobuf. The first message from the client holds start. A text message ends the socket with invalid_argument. |
| Credentials | The session cookie, or the bearer credentials of the API: a CLI token or an API key in Authorization: Bearer ... (the API server) |
| Origin | A request with an Origin header must come from the origin of the install, such as https://example.com. Another origin gets HTTP status 403 before the upgrade. The session cookie needs the Origin header (Sessions, cookies, and sign-in links). |
| Largest message from the client | 1 MiB plus 64 KiB |
| Wait for the start chunk | 10 s. Then the socket closes with 4003. A socket without a credential closes at once with 4016. |
| Ping | every 30 s. A client that answers no ping within 15 s is gone, and the server ends the socket. The server reads a pong only while it reads the socket. So the pings pause while the command takes its input slowly and a message of the client waits for it. A pause lasts at most 2 min. Then the pings count again, so a client that vanished meanwhile loses its socket. |
| Compression | none |
The server ends the socket with a close frame:
| Close code | When |
|---|---|
| 1000 | The exec ended, after the exit chunk. |
| 1001 | The API listener stops. The reason is the server shuts down. Connect again. |
| 4000 plus a Connect code | The exec failed, for example 4016 for unauthenticated, 4007 for permission_denied, 4005 for not_found, or 4009 for failed_precondition. The reason is the message of the error, at most 123 bytes. |
A close of the socket by the client ends the command, because a WebSocket has no half close. The api call log record of the socket has the procedure /api/ws/exec and the protocol websocket (the API server).
Upload
Section titled “Upload”Writes a file into a running machine, or extracts a tar stream into a directory.
| Item | Value |
|---|---|
| Procedure | /hopbox.v1.MachineService/Upload |
| Policy action | machine.exec |
| Idempotent option | no |
| Audit entry | none |
The first message UploadRequest holds start. The next ones hold data. The end of the client stream is the end of the data. A client stream also works over HTTP/1.1 with the Connect protocol.
UploadStart:
| Field | Type | Description |
|---|---|---|
id or name |
string | The machine, in the oneof machine. |
path |
string | The target. A relative path starts at the home directory of the user. |
archive |
bool | The data is a tar stream of the contents of a directory. When the directory path does not exist, the guest agent makes it. Then it extracts the stream into the directory. Otherwise the data is the contents of one file. |
mode |
uint32 | The permission bits of a file, such as 0755. 0 is 0644. An archive carries its own. Larger than 07777 gets invalid_argument. |
user |
string | The Linux user that owns the new files, and whose home directory a relative path starts at. Empty is user. |
UploadResponse has bytes, the count of bytes that the machine got. An error of the guest agent, such as a directory that the user cannot write, ends the call with failed_precondition and the message failed precondition: the machine: <error>.
Download
Section titled “Download”Reads a file or a directory from a running machine. A directory arrives as a tar stream of its contents.
| Item | Value |
|---|---|
| Procedure | /hopbox.v1.MachineService/Download |
| Policy action | machine.exec |
| Idempotent option | no |
| Audit entry | none |
DownloadRequest:
| Field | Type | Description |
|---|---|---|
id or name |
string | The machine, in the oneof machine. |
path |
string | The source. A relative path starts at the home directory of the user. |
user |
string | The Linux user whose home directory a relative path starts at. Empty is user. |
The first message DownloadResponse holds info. The next ones hold data, at most 32 KiB each.
DownloadInfo:
| Field | Type | Description |
|---|---|---|
archive |
bool | The data is a tar stream of a directory. Otherwise it is the contents of one file. |
mode |
uint32 | The permission bits of the file or the directory. |
size |
int64 | The size of a file in bytes. 0 for an archive. |
| Error | Code and message |
|---|---|
| A file larger than 4 MiB | failed_precondition, before any data: failed precondition: the download has more than 4194304 bytes, the most that a download to a laptop can have. ... |
| A directory whose tar stream grows past 4 MiB | the same error, after the data up to the limit. Drop the data that came. |
| A missing file, or one that the user cannot read | failed_precondition, with the message failed precondition: the machine: <error> |
StreamMachineLogs
Section titled “StreamMachineLogs”Sends the log of a machine: the output of its start command, line by line (Machine logs). The node of the machine keeps the log for 7 days or 100 MiB, whichever ends first.
| Item | Value |
|---|---|
| Procedure | /hopbox.v1.MachineService/StreamMachineLogs |
| Policy action | machine.exec |
| Idempotent option | no |
| Audit entry | none |
StreamMachineLogsRequest:
| Field | Type | Description |
|---|---|---|
id or name |
string | The machine, in the oneof machine. |
tail |
uint32 | Sends only the last tail entries. 0 sends all of them. |
since |
google.protobuf.Timestamp |
Sends only the entries from this time on. Unset sends all of them. With tail, the stream sends the last tail entries from since on. |
follow |
bool | Keeps the stream open after the old entries, and sends each new entry as it arrives. |
Each message StreamMachineLogsResponse holds one field of the oneof event: entry, a MachineLogEntry, or synced, which is true. Only a stream with follow sends synced, once, after the old entries. A stream without follow ends after the old entries.
MachineLogEntry:
| Field | Type | Description |
|---|---|---|
time |
google.protobuf.Timestamp |
When the guest agent read the line. |
stream |
MachineLogStream |
MACHINE_LOG_STREAM_STDOUT or MACHINE_LOG_STREAM_STDERR |
data |
bytes | The line without its newline. A line longer than 16 KiB arrives in parts. |
dropped |
uint64 | The count of lines that were lost before this one, because a buffer of the guest agent or of the node was full. |
A machine that runs again adds to the same log. The delete of the machine drops its log.
Sharing and settings
Section titled “Sharing and settings”The calls of this section change the machine at once and do not wait. Each one returns the machine after the change, in the field machine of its response. A request that asks for what the machine has already changes nothing, writes no audit entry, and keeps the version. Each call fails with failed_precondition on a machine whose target is deleted.
ShareMachine
Section titled “ShareMachine”Opens a private machine to the whole org. Every member and every org key of the org can then use it. A shared machine stays in the org after its creator leaves.
| Item | Value |
|---|---|
| Procedure | /hopbox.v1.MachineService/ShareMachine |
| Policy action | machine.share: the creator only |
| Idempotent option | no. A second call changes nothing. |
| Audit entry | action machine.share, target kind machine, details name and shared (true) |
The request ShareMachineRequest names the machine. The response ShareMachineResponse has the field machine. On a machine whose target is deleted, the error is failed precondition: machine action not allowed: cannot machine.share a machine that is being deleted.
A shared machine holds only shared extra disks (Extra disks). So the share of a machine with an attached private disk fails with failed precondition: the machine box1 holds the private disk disk1, and a shared machine holds only shared disks. Share the disk first, or detach it. An unshare of a machine with an attached shared disk fails in the same way, with failed precondition: the machine box1 holds the shared disk disk1, and a private machine holds only private disks. Detach the disk first.
A share fails closed. In its transaction, the call resolves the env that the machine gets as a shared machine: the shared values and the all values of its org, with each secret open (the env var API). If that env does not resolve, the call fails with failed_precondition. The machine then stays private, at the same version, with its old env. The call writes no audit entry and publishes no event. The message names the cause:
| Cause | Message |
|---|---|
| The keyring has no key-encryption key. | failed precondition: the env of the machine as a shared machine does not resolve, so the machine stays private: the keyring has no key-encryption key to seal or open the value. Run hopboxd admin kek rotate to make the first one |
| The keyring dir or a key file is not safe. | failed precondition: the env of the machine as a shared machine does not resolve, so the machine stays private: seal: <path> is not safe to hold key-encryption keys: .... The rest says which check failed (Sealing). |
| The keyring does not open, for example after a read error of its dir. | failed precondition: the env of the machine as a shared machine does not resolve, so the machine stays private: service: open the keyring: seal: .... The rest says why, for example an error of the operating system or a key file of the wrong size. |
| A shared or an all secret does not open. | failed precondition: the env of the machine as a shared machine does not resolve, so the machine stays private: service: open the secret <name> of org <org ID>: seal: .... The rest is an error of Sealing, for example the sealed value does not open: it was changed, or it belongs to another place. |
A private value never reaches a shared machine. So a private secret of the creator that does not open does not stop the share. A failed read of the control store is not a refusal of this kind: the call fails with internal, and a retry can work. After a refused share, fix the cause, and share again. For example, put back the key file of the key-encryption key, or set the secret again (the executor protocol).
UnshareMachine
Section titled “UnshareMachine”Makes a shared machine private to its creator again. The other members stop seeing it: a watch of theirs gets its gone_machine_id.
| Item | Value |
|---|---|
| Procedure | /hopbox.v1.MachineService/UnshareMachine |
| Policy action | machine.unshare: the creator only |
| Idempotent option | no. A second call changes nothing. |
| Audit entry | action machine.unshare, target kind machine, details name and shared (false) |
The request UnshareMachineRequest names the machine. The response UnshareMachineResponse has the field machine.
An unshare never checks the env. If the env of the machine as a private machine does not resolve, the unshare still works. The machine then keeps its old env, which holds only the shared values and the all values of its org. Every member of the org already uses those values in the shared machines, so the old env shows nothing new to anyone.
A machine that an org key made has no creator account, so no account can own it alone. It stays shared, and its unshare fails with failed_precondition and the message failed precondition: an org key made this machine, and no account owns it, so it stays shared. A shared machine whose creator account was deleted, or whose creator org key was revoked, stays shared too. Its unshare fails with failed precondition: the account or the org key that made this machine is gone, so it stays shared. A revoke of an org key never stops or deletes the machines that it made.
UpdateMachine
Section titled “UpdateMachine”Changes the restart policy, the start command, a timeout of a machine (auto-delete, auto-standby, or auto-hibernate), or its backup schedule. A field that the request leaves out keeps its value. The executor applies a new restart policy at once, and a new start command at the next boot (the node executor).
| Item | Value |
|---|---|
| Procedure | /hopbox.v1.MachineService/UpdateMachine |
| Policy action | machine.update: those who use the machine |
| Idempotent option | no. A second call with the same request changes nothing. |
| Audit entry | action machine.update, target kind machine, details name and one detail for each field of the request. restart_policy is the new policy. start_command_changed is true or false. auto_delete_timeout, auto_standby_timeout, and auto_hibernate_timeout are the new timeouts as Go writes a duration, for example 1h0m0s, or 0s for off. backup_period and backup_retention are the new backup schedule, in the same form. The entry never holds the start command. |
| Field | Type | Description |
|---|---|---|
id or name |
string | The machine (Naming a machine). |
restart_policy |
RestartPolicy |
The new restart policy. RESTART_POLICY_UNSPECIFIED keeps it. |
start_command |
optional string | The new start command. Leave it out to keep it. An empty string removes it. |
auto_delete_timeout |
google.protobuf.Duration |
The new auto-delete timeout. Leave it out to keep it. A zero duration turns it off. |
auto_standby_timeout |
google.protobuf.Duration |
The new auto-standby timeout. Leave it out to keep it. A zero duration turns it off. |
auto_hibernate_timeout |
google.protobuf.Duration |
The new auto-hibernate timeout. Leave it out to keep it. A zero duration turns it off. |
backup_period |
google.protobuf.Duration |
The new backup period: 15 minutes to 365 days, in whole seconds. Leave it out to keep it. A zero duration turns the schedule off. |
backup_retention |
google.protobuf.Duration |
The new backup retention: 1 hour to 365 days, in whole seconds. Leave it out to keep it. A new retention also moves the end of the retention of each backup of the machine by the change. |
expected_version |
optional int64 | The version of the machine that the caller read. If the machine has another version now, the call fails with aborted and changes nothing. The version also grows without a request, for example at each report of the executor or after an env change. So a call can fail with aborted although no other request came in between. Read the machine again and retry. |
The response UpdateMachineResponse has the field machine. A new timeout counts from the time of the update: the call sets last_activity_time to now. So a new timeout never deletes a machine, or puts it to sleep, at once for its idle time before the update. The owner decided this on 2026-11-11, in Q232. All three timeouts count from last_activity_time, so a new idle timer also starts the count of the auto-delete timeout again. An update is allowed in a suspended org.
| Error | Code |
|---|---|
A request that sets no field: invalid argument: the update sets no field |
invalid_argument |
A start command, a timeout, a backup period, or a backup retention that breaks its rule (Domain rules), such as invalid argument: invalid machine config: the backup period 1m0s is not 0 and not 15m0s to 8760h0m0s |
invalid_argument |
A stale expected_version: conflict: the machine is at version <n>, not <m>. Read it again |
aborted |
The target is deleted: failed precondition: machine action not allowed: cannot update a machine that is being deleted |
failed_precondition |
browser -d '{"name":"box1","startCommand":"python3 -m http.server 8000","autoDeleteTimeout":"86400s","expectedVersion":"2"}' \ $API/hopbox.v1.MachineService/UpdateMachineSetMachineURLPort
Section titled “SetMachineURLPort”Sets the port in the machine that its URL reaches. The default is 8000.
| Item | Value |
|---|---|
| Procedure | /hopbox.v1.MachineService/SetMachineURLPort |
| Policy action | machine.set_url_port: the creator only |
| Idempotent option | no. A second call changes nothing. |
| Audit entry | action machine.set_url_port, target kind machine, details name, url_port, old_url_port, url_visibility, and old_url_visibility |
| Field | Type | Description |
|---|---|---|
id or name |
string | The machine. |
port |
int32 | The port in the machine, 1 to 65535. |
The edge sends the requests of the URL https://<name>.<domain> to this port of the machine (the edge role). The change event of the change pushes the routes to the edge servers again, also for a running machine (the control channel).
The response SetMachineURLPortResponse has the field machine. A port out of range gets invalid_argument with the message invalid argument: invalid machine config: the URL port <port> is not 1 to 65535. On a machine whose target is deleted, the error is failed precondition: machine action not allowed: cannot change the URL of a machine that is being deleted.
SetMachineURLVisibility
Section titled “SetMachineURLVisibility”Makes the URL of a machine public or private. A new machine is private.
| Item | Value |
|---|---|
| Procedure | /hopbox.v1.MachineService/SetMachineURLVisibility |
| Policy action | machine.set_url_visibility: the creator only |
| Idempotent option | no. A second call changes nothing. |
| Audit entry | action machine.set_url_visibility, target kind machine, details name, url_port, old_url_port, url_visibility, and old_url_visibility |
| Field | Type | Description |
|---|---|---|
id or name |
string | The machine. |
visibility |
URLVisibility |
URL_VISIBILITY_PRIVATE or URL_VISIBILITY_PUBLIC. |
A public URL needs no sign-in at the edge. A private URL sends a browser without a valid machine cookie to the sign-in (the edge role). The change reaches the edge servers with the next push of the routes. A change to private also tells the edges to check each private URL again.
The response SetMachineURLVisibilityResponse has the field machine. URL_VISIBILITY_UNSPECIFIED or an unknown value gets invalid_argument with the message invalid argument: the URL visibility must be private or public. On a machine whose target is deleted, the error is the one of SetMachineURLPort.
A change to public needs the limit public_urls of the org (the org API). The personal org of a limited account has public_urls false, unless an instance admin set an override. Such a change fails with permission_denied and the message permission denied: the org cannot make a machine URL public. Ask an instance admin to allow public URLs for the org, and counts in hopbox_limit_refusals_total with the limit public_urls. A URL that is public already stays public, and a change to private always works.
Backups
Section titled “Backups”A backup copies the main disk of a machine to the object storage of the install, without its memory and without its extra disks. The node of the machine makes a reflink copy of the disk. A running machine pauses for the copy, and the upload runs after the resume. The upload sends only the chunks that no earlier backup of the machine holds, encrypted with the data key of the machine. Object storage describes the objects, the steps, and the prune.
A backup period turns on the scheduled backups of a machine: the leader starts a backup once the period passed since the last backup of the machine. Each backup has an end of its retention, expire_time: its create time plus the backup retention of its machine. After that time, the prune removes it (Object storage).
Backup
Section titled “Backup”| Field | Type | Description |
|---|---|---|
id |
string | The UUID of the backup. |
machine_id |
string | The UUID of the machine. |
machine_name |
string | The name of the machine at its last backup, its delete, or its last share or unshare. |
kind |
BackupKind |
Who asked for the backup. |
state |
BackupState |
The state of the backup. |
error |
string | Why a failed backup failed. |
create_time |
google.protobuf.Timestamp |
The time of the request. |
copy_time |
google.protobuf.Timestamp |
The time of the copy of the disk: the moment that the backup holds. Unset while pending. |
finish_time |
google.protobuf.Timestamp |
The end of the backup, done or failed. |
expire_time |
google.protobuf.Timestamp |
The end of the retention of the backup. |
disk_bytes |
int64 | The size of the disk. |
chunks |
int32 | The chunks of 4 MiB of the copy that a region of data covers. |
chunks_done |
int32 | The chunks that the upload went through so far. |
new_chunks |
int32 | The chunks that the upload sent, because no earlier backup of the machine held them. |
data_bytes |
int64 | The bytes of the disk in the chunks of data so far. |
uploaded_bytes |
int64 | The bytes that the upload sent to the bucket, after the encryption. |
BackupState:
| Value | Meaning |
|---|---|
BACKUP_STATE_PENDING |
The node did not copy the disk yet. |
BACKUP_STATE_COPIED |
The node copied the disk, and the upload waits to start. |
BACKUP_STATE_UPLOADING |
The node uploads the copy. |
BACKUP_STATE_DONE |
The backup is whole in the bucket. |
BACKUP_STATE_FAILED |
The backup failed, and error says why. |
BackupKind:
| Value | Meaning |
|---|---|
BACKUP_KIND_MANUAL |
A caller asked for it with CreateBackup. |
BACKUP_KIND_SCHEDULED |
The backup period of the machine asked for it. Its audit entry has the actor system. |
BACKUP_STATE_UNSPECIFIED and BACKUP_KIND_UNSPECIFIED are never in a response.
CreateBackup
Section titled “CreateBackup”Starts a backup of the main disk of a machine, and returns it at once, pending. A running machine first gets a sync of its guest agent, then pauses for the copy of its disk. A machine in standby, hibernated, or stopped needs no pause.
| Item | Value |
|---|---|
| Procedure | /hopbox.v1.MachineService/CreateBackup |
| Policy action | backup.create: the rights of machine.exec, because a backup puts the disk in reach of whoever restores it |
| Idempotent option | yes. A retry with the same key returns the same backup. |
| Audit entry | action backup.create, target kind backup, and target ID the backup. Details: name (the name of the machine), machine (its ID), and kind. |
The request CreateBackupRequest names the machine by id or name. The response CreateBackupResponse has the field backup, with the state BACKUP_STATE_PENDING. The call locks the org row for an update, so two backups of one org never pass the backup limit together. A backup is allowed in a suspended org, because it removes no data.
| Error | Code |
|---|---|
The target is deleted: failed precondition: machine action not allowed: cannot back up a machine that is being deleted |
failed_precondition |
The machine is not running, in standby, hibernated, or stopped: failed precondition: the machine box1 is pending. A backup needs a machine that is running, in standby, hibernated, or stopped |
failed_precondition |
A live control process knows the migrations before 78: failed precondition: the control process <process> knows the migrations up to <n>, and only a hopboxd that knows migration 78 backs up machines. Upgrade it first |
failed_precondition |
A cold move of the machine runs: failed precondition: the machine box1 moves to another node. Back up it after the move |
failed_precondition |
The node names no feature backups, or its VMM driver cannot pause: failed precondition: the node of the machine box1 runs hopboxd <version>, whose heartbeats name no feature backups. An instance admin must upgrade the node first |
failed_precondition |
The install has no object storage: failed precondition: this install has no object storage, so it makes no backups. An instance admin sets it with hopboxd admin config object-storage set, or on the page Config of the Admin area |
failed_precondition |
A backup of the machine copies or uploads: failed precondition: the backup <id> of the machine box1 runs. Wait for its end |
failed_precondition |
The backups of the org reach its limit: usage limit exceeded: the backups of the org use <bytes> bytes, and its limit is <limit> |
resource_exhausted |
A removal of Q189 purges the old backups of the machine: unavailable: hopbox removes the old backups of the machine box1 now. Try again in a few minutes |
unavailable |
The size of a backup is known only after the copy. If the copy holds more data than the limit of the org has room for, the backup fails with usage limit exceeded: the backups of the org would use <bytes> bytes, and its limit is <limit> (Domain rules).
browser -d '{"name":"box1"}' $API/hopbox.v1.MachineService/CreateBackupListBackups
Section titled “ListBackups”Returns the backups of a machine that no user deleted, the newest first. A failed backup stays in the list until the end of its retention.
| Item | Value |
|---|---|
| Procedure | /hopbox.v1.MachineService/ListBackups |
| Policy action | backup.list: as GetMachine |
| Idempotent option | read only |
| Audit entry | none |
The request ListBackupsRequest names the machine by id or name. An ID also names a deleted machine whose backups stay (Q189 of the phase 3 plan). After the leader dropped the row of such a machine, the rights come from the machine at its delete: its org, its creator, and its share. The response ListBackupsResponse has the field backups. A machine without backups gets an empty list.
| Error | Code |
|---|---|
No machine and no backups have the ID or the name, or the caller cannot read the machine: not found: no machine has the ID <id> |
not_found |
browser -d '{"name":"box1"}' $API/hopbox.v1.MachineService/ListBackupsDeleteBackup
Section titled “DeleteBackup”Deletes one backup. The backup leaves the list at once. Its objects leave the bucket at the next prune, within 10 minutes (Object storage). A backup that copies or uploads ends on its node within a heartbeat.
| Item | Value |
|---|---|
| Procedure | /hopbox.v1.MachineService/DeleteBackup |
| Policy action | backup.delete: as DeleteMachine |
| Idempotent option | no. A second call fails with not_found. |
| Audit entry | action backup.delete, target kind backup, and target ID the backup. Details: name (the name of the machine), machine (its ID), and state (the state of the backup). |
The request DeleteBackupRequest has the field id, the UUID of the backup. The response DeleteBackupResponse has no fields.
| Error | Code |
|---|---|
The ID is not a UUID: invalid argument: the backup ID "<id>" is not a UUID |
invalid_argument |
No backup has the ID, a user deleted it already, or the caller cannot read its machine: not found: no backup has the ID <id> |
not_found |
A suspended org: failed precondition: org suspended: an instance admin suspended the org, so it cannot delete a backup |
failed_precondition |
browser -d '{"id":"01a1d722-d8ed-7a6e-b058-365cdfc60315"}' $API/hopbox.v1.MachineService/DeleteBackupSuspension
Section titled “Suspension”An instance admin can suspend an org (the org API). The suspension stops the machines of the org, and leaves a hibernated machine hibernated. The rule of each lifecycle action comes from Action.CheckSuspended() (Domain rules):
| Call | In a suspended org |
|---|---|
CreateMachine, StartMachine, ResumeMachine, WakeMachine, RebootMachine |
blocked, with failed_precondition and the message failed precondition: org suspended: an instance admin suspended the org, so it cannot <action> a machine |
DeleteMachine, DiscardMemory |
blocked, because a suspension keeps the data of the org |
StopMachine, PauseMachine, HibernateMachine, RenameMachine |
allowed |
GetMachine, ListMachines, WatchMachines, ListMachineSizes, ShareMachine, UnshareMachine, UpdateMachine, SetMachineURLPort, SetMachineURLVisibility, StreamMachineLogs, CreateBackup, ListBackups |
allowed |
DeleteBackup |
blocked, with failed_precondition and the message failed precondition: org suspended: an instance admin suspended the org, so it cannot delete a backup. The prune skips the org, and the retention clock of its backups stops (Domain rules). |
Exec, Upload, Download |
blocked, with failed_precondition and the message failed precondition: org suspended: an instance admin suspended the org of the machine. A suspension also ends the open ones (How a stream ends). |
The machine URLs of a suspended org are blocked too: the edge answers 403, and GET /auth/machine gives no code (the edge role).
The suspend of an account suspends its personal org and each org that it owns alone (the admin API). In each other org, it sets the target stopped on the private machines of the account, and leaves a hibernated one hibernated. Such an org is not suspended, so the rules of the table do not apply there. A private machine stays stopped until its creator starts it again.
Instance admins can stop and delete any machine of a suspended org through the admin API (the admin API). The auto-delete job and the idle timers of the leader skip the machines of a suspended org.
Usage and limits
Section titled “Usage and limits”A machine counts in the usage of its org (the org API):
| Usage | The machines that count |
|---|---|
| Machines and disk | every machine whose target is not deleted |
| vCPUs and RAM | the machines whose target is running or standby |
| Stored state | the memory files of the machines whose target is not deleted |
| Saves in 24 hours | the saves of the last 24 hours, also those of a deleted machine |
| Backups | the objects of the backups in the bucket, and the worst size of each backup that copies or uploads. The backups of a deleted machine count until the prune removes them (Domain rules). |
CreateMachine, the start of a stopped machine, and WakeMachine check the limits under the lock of the org row. A hibernated machine holds no vCPUs and no RAM, so a hibernate checks only the daily budget of saves, under the same lock (HibernateMachine). The other calls do not add to the usage, so they take only a shared lock of the org row (Control store tables). The limits that apply follow the tier of the org: the personal org of a limited account takes the limited defaults, and every other org the first defaults (the org API).
Auto-delete
Section titled “Auto-delete”A machine with an auto-delete timeout goes after that time without use. The leader checks every minute (hopboxd). The use is last_activity_time. Today these set it: the create, each start that changes the machine, each resume, each wake, and each update with a new timeout. The access calls set it too: each Exec, Upload, Download, and StreamMachineLogs at its start, and then every 30 s while it runs (How a stream ends). SSH sessions set it, and so does inbound traffic: each heartbeat of the node names the machines with inbound traffic (the node network). Each heartbeat of an edge server names the machines with connections that it holds or keeps open after their check of access, and those count too (the edge role). An SSH session calls Service.TouchMachine of internal/service after its own policy check. TouchMachine writes at most once a minute for each machine, and does not change the version of the machine. So last_activity_time can be up to a minute older than the last use. The job deletes a machine only once last_activity_time is older than its timeout plus 1 minute (service.TouchInterval). So a machine that someone used within its timeout always stays. The job reads the idle machines in pages of 100, in the order of their last use. It goes on after a machine that fails, so a few bad machines never hold back the others. The job deletes the machine as DeleteMachine does, so its name and its SSH port stay reserved for 7 days. It skips the machines of a suspended org. Its audit entry has the actor system.
Idle timers
Section titled “Idle timers”A machine has two idle timers, as on boxd. The auto-standby timeout puts a running machine in standby. The auto-hibernate timeout hibernates a machine, from running or from standby. Each one counts from last_activity_time, as the auto-delete timeout does (Auto-delete). An idle machine gets no inbound traffic. CPU use does not count.
| Timeout | Default for a new machine | Values |
|---|---|---|
auto_standby_timeout |
off | 0 for off, or 1 minute to 365 days in whole seconds |
auto_hibernate_timeout |
4 hours | 0 for off, or 1 minute to 365 days in whole seconds |
A machine that existed before the upgrade to the release with the timers has both timeouts off, so the upgrade puts no machine to sleep. The owner decided this in Q182. Its owner turns them on with UpdateMachine. A machine with a job that uses only the CPU, and gets no inbound traffic, needs the auto-hibernate timeout 0.
A leader job applies the timers every minute (hopboxd). A running machine whose last_activity_time is older than its auto-standby timeout plus 1 minute goes to standby, as with PauseMachine. A machine, running or in standby, whose last_activity_time is older than its auto-hibernate timeout plus 1 minute hibernates, as with HibernateMachine. A machine past both timeouts hibernates. So the step comes 1 to 2 minutes after the timeout, as the auto-delete does. Each step takes the checks of its call: the node must name the feature and have the capability, and a hibernate checks the daily budget of saves. On a node that can pause but not save, only the auto-standby timer acts. The auto-hibernate timer does nothing there. While a live control process runs a release before hibernate, the job hibernates no machine, and only the auto-standby timer acts. The job checks this once per run, so such a refusal holds back no machine that can go to standby. A connection brings the machine back, as after a call (the edge role). A heartbeat of an edge that names a machine with an open connection also sets its target back to running, with the checks of WakeForConnection, if an idle timer put it in standby or hibernated (the edge role). A pause or a hibernate by a user, an API key, or another actor stays: a sleep by hand wins over an open connection. That holds also for a pause of a machine that the auto-standby timer put in standby, and for a hibernate of a machine that the auto-hibernate timer hibernated. Such a call changes no target and writes no audit entry, but the heartbeats then leave the machine asleep. The owner decided this on 2026-11-11, in Q233.
The job skips these machines:
- A machine of a suspended org.
- A machine with a move, or with a memory file. In this release, the control role ends the memory file row at each report of
running, and a machine goes to standby only fromrunning. So today a machine that runs or is in standby has no such row, and the check holds only a machine whose row is out of step with its state. A move of a standby machine with its RAM, planned for T23 of the phase 3 plan, can change this. - A machine on its way to another state, and a machine whose target is not
runningorstandby. - Each machine, while a server with the role
edgenames no featurewake-on-connect. The heartbeats of such an edge name no open connection, so an open session there keeps no machine awake. The owner decided this on 2026-11-11, in Q231.
An open connection at an edge, an SSH session, an exec, and a file copy each count as a use, so they keep the machine awake (Auto-delete). A save that the free-space floor of the node or the daily budget of saves refuses leaves the machine as it was. Its auto-hibernate timeout then counts again from the refusal, so the job tries such a machine once per timeout, not every minute. The owner decided this on 2026-11-11, in Q230. A refusal of the daily budget also gives the instance admins a notice (HibernateMachine). Each step writes the audit entry of its call with the actor system (Audit entries).
Audit entries
Section titled “Audit entries”The machine calls write these entries in the transaction of the change. Their org is the org of the machine, so its owners and admins read them with ListAuditEntries (the sign-in, account, and audit API). The target kind is machine, and the target ID is the machine ID. Each entry has the detail name: the name of the machine before the change. The actor is the caller. The auto-delete, the idle timers, a lost standby, and a refused save have the actor system.
| Action | Written by | Details besides name |
|---|---|---|
machine.create |
CreateMachine |
size, image (the digest), shared |
machine.start |
StartMachine, and the report of a lost standby of a machine with the restart policy always, with the actor system |
old_target, retry, boot_again. For a lost standby, old_target and reason. |
machine.pause |
PauseMachine, and the auto-standby timeout with the actor system (Idle timers) |
old_target. For the timer, also reason (auto-standby), timeout, and last_activity_at (RFC 3339, UTC). |
machine.save_refuse |
A save that the node refused, with the actor system (HibernateMachine) |
old_target, target, refused, reason |
machine.resume |
ResumeMachine, also for an access call. A connection at an edge writes it with the actor system (the edge role). |
old_target, and channel for a connection: ssh, private_url, or public_url. A heartbeat of an edge that names the machine with an open connection, after an idle timer put it to sleep, writes reason (open_connection) instead of channel. |
machine.hibernate |
HibernateMachine, and the auto-hibernate timeout with the actor system |
old_target. For the timer, also reason (auto-hibernate), timeout, and last_activity_at. |
machine.wake |
WakeMachine, also for an access call. A connection at an edge writes it with the actor system. |
old_target, and channel for a connection, or reason (open_connection) for a heartbeat of an edge, as for machine.resume |
machine.discard_memory |
DiscardMemory |
old_target |
machine.stop |
StopMachine. Also the report of a lost standby of a machine with the restart policy never, with the actor system. Also SuspendOrg and SuspendAccount of the admin API for each machine that they stop. |
old_target, and reason for a stop of the admin API. The reason is org suspended in an org that the call suspends, and account suspended for a private machine of the account in another org. |
machine.reboot |
RebootMachine |
none |
machine.rename |
RenameMachine |
old_name, new_name |
machine.delete |
DeleteMachine, the calls of What a member leaves behind, and the auto-delete |
reason for a delete by hopbox or by another call. It is member left (LeaveOrg, RemoveOrgMember, DeleteAccount), org deleted (DeleteOrg, DeleteAccount for the personal org), or auto-delete. The auto-delete adds auto_delete_timeout and last_activity_at (RFC 3339, UTC). |
machine.share |
ShareMachine |
shared (true) |
machine.unshare |
UnshareMachine |
shared (false) |
machine.update |
UpdateMachine |
restart_policy, start_command_changed, auto_delete_timeout, auto_standby_timeout, auto_hibernate_timeout, backup_period, and backup_retention, each one only for a field that the request sets |
machine.set_url_port |
SetMachineURLPort |
url_port, old_url_port, url_visibility, old_url_visibility |
machine.set_url_visibility |
SetMachineURLVisibility |
the same as machine.set_url_port |
backup.create |
CreateBackup, and the backup period of a machine with the actor system |
the target kind is backup, and the target ID the backup. machine (the ID of the machine) and kind (manual or scheduled) |
backup.delete |
DeleteBackup |
the target kind is backup. machine and state (the state of the backup at the delete) |
A call that changes nothing writes no entry. The read calls write none. The admin calls on machines write machine.list_all, machine.admin_stop, machine.admin_delete, machine.move, machine.cancel_move, and machine.list_moves (the admin API). Each sign-in through the SSH front door writes machine.ssh, with the actor ssh_key (the SSH front door). Exec, Upload, and Download write no entry.
Change events
Section titled “Change events”Each change of a machine publishes a change event in its transaction (Control store tables). The control role feeds the events to the watches and the waits of its process. So a watch or a wait sees each change, also one that another control process or a node made.
| Kind | Published by | org_id |
subject_id |
payload |
|---|---|---|---|---|
machine.created |
CreateMachine |
the org | the machine | {"action":"machine.create"} |
machine.updated |
each other change that writes an audit entry. The calls of this page make such changes. So do What a member leaves behind, SuspendOrg, and the admin calls. The auto-delete and a machine that stopped by itself make them too. SetVar and DeleteVar publish it for each machine that the value reaches. |
the org | the machine | {"action":"<the audit action>"}, for example {"action":"machine.stop"} |
machine.state_changed |
each report of the executor that changes the current state (the executor protocol) | the org | the machine | {"action":"server.report_machine"} |
On each of these events, each control process also pushes the routes of the machine URLs to its edge servers. It tells them to check each private URL again too (the control channel).
The payload carries only the action. A reader reads the machine again for its state. A report of a machine with the restart policy never that stopped by itself also sets the target stopped. That change publishes machine.updated with {"action":"machine.stop"}.