Skip to content

Stop a VM

POST/v1/vms/{uid}/stop

Queues a stop. The VM's status changes to stopped as soon as the request is accepted.

This is asynchronous. It returns 202 Accepted with an operation_id. See Get an operation. Send an X-Idempotency key to make retries safe: a retry with the same key returns the original operation with 200, even though the VM is already stopped. Without a key, a second stop returns 409 (vm is already stopped).

Authentication

Send your API key as Authorization: Bearer <token>. The request is scoped to the workspace in X-Workspace-Slug.

Path parameters

uidstringRequired

The VM's uid.

Headers

X-Workspace-SlugstringRequired

Slug of the workspace the request acts on. You can also pass it as the workspace_slug query parameter.

X-Idempotencystring

Optional unique key for this request, such as a UUID. Leading and trailing spaces are ignored. If you send a key you already used for the same action on the same resource, the original operation is returned with 200 OK and X-Idempotency-Replay: true, and nothing new is queued. The replay check runs before the resource is loaded or its state is checked, so a retry gets the original result even after the action has finished. Reusing a key for a different action, resource type or resource returns 409 with action: idempotency_key_reused. Keys are shared across the workspace. Without a key, every request is treated as new.

Response

202

The stop operation was queued.

successbooleanRequired

true when the request succeeded.

messagestringRequired

Human-readable status message.

dataobject
Show attributes
operation_idstringRequired

UID of the queued operation. Poll it with Get an operation.

vm_uidstringRequired

UID of the VM.

namestringRequired

Name of the VM. On a replay, the name the VM had when the operation was queued.

actionstringRequired

The action that was queued.

One ofstartstoprebootdeleteresizeset_app_port

statusstringRequired

Status of the operation. queued for a newly queued action.

One ofqueuedrunningsucceededfailed

vm_statusstringRequired

Status of the VM (see VmStatus). For a new start, reboot or resize of a running VM, provisioning; for a stop, stopped; for a delete, deleting; for a resize of a stopped VM or an app port change, the VM's unchanged status. On a replay, the VM's current status, or deleted once it is gone. Empty in the rare case the VM could not be read during a replay.

events_urlstringRequired

Path of the server-sent events stream with the operation's progress.

is_replaybooleanRequired

true when an existing operation was returned for a reused X-Idempotency key.

is_completedbooleanRequired

true when a replayed operation has already finished. Always false for a newly queued action.

Response

200

Replay. The X-Idempotency key was already used for this action on this VM, so the existing operation is returned and nothing is queued. status is the operation's current status and vm_status the VM's current status (deleted once the VM is gone). For Set the app port the key is also tied to the requested port, and for Resize a VM to the requested plan; reusing it with a different one returns 409 with action: idempotency_key_reused.

successbooleanRequired

true when the request succeeded.

messagestringRequired

Human-readable status message.

dataobject
Show attributes
operation_idstringRequired

UID of the queued operation. Poll it with Get an operation.

vm_uidstringRequired

UID of the VM.

namestringRequired

Name of the VM. On a replay, the name the VM had when the operation was queued.

actionstringRequired

The action that was queued.

One ofstartstoprebootdeleteresizeset_app_port

statusstringRequired

Status of the operation. queued for a newly queued action.

One ofqueuedrunningsucceededfailed

vm_statusstringRequired

Status of the VM (see VmStatus). For a new start, reboot or resize of a running VM, provisioning; for a stop, stopped; for a delete, deleting; for a resize of a stopped VM or an app port change, the VM's unchanged status. On a replay, the VM's current status, or deleted once it is gone. Empty in the rare case the VM could not be read during a replay.

events_urlstringRequired

Path of the server-sent events stream with the operation's progress.

is_replaybooleanRequired

true when an existing operation was returned for a reused X-Idempotency key.

is_completedbooleanRequired

true when a replayed operation has already finished. Always false for a newly queued action.

Errors

StatusMeaning
400The request was malformed or failed validation.
401The API key is missing, invalid, expired or revoked.
403You cannot access the workspace, your role does not allow this action, or the account is suspended.
404The resource does not exist or you cannot access it.
409The VM is already stopped (vm is already stopped), is deleting or deleted (vm is not available for this action), or the X-Idempotency key was used for a different operation (action: idempotency_key_reused).

Errors use the standard error format.