Skip to content

Resize a VM

POST/v1/vms/{uid}/resize

Moves the VM to a different compute plan. Billing switches to the new plan's rate right away (usage so far is settled at the old rate first).

  • A running VM is restarted so the new CPU and memory take effect. It shows provisioning until it is back.
  • A stopped VM gets the new resources on its next start.
  • The root disk can only grow. Moving to a plan with a larger included disk expands it. Plans whose included disk is smaller than the VM's current disk are rejected.
  • Ephemeral VMs can only move between ephemeral-eligible plans, and persistent VMs between persistent plans.
  • VMs on a desktop image need a plan with at least 2 vCPU and 2048 MiB of memory.

The VM must be running or stopped. 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 after the resize has finished. The same key with a different plan_slug returns 409 with action: idempotency_key_reused.

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.

Request body

plan_slugstringRequired

Slug of the available compute plan to move to. Case-insensitive. Must differ from the current plan.

Response

202

The resize 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
400Validation failed: invalid request, plan_slug is required, invalid compute plan, this compute plan is not available, this plan is not available for this VM type, This VM is already on the <plan> plan., the disk-size message, or the desktop plan-size message.
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 not running or stopped (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.