Skip to content

Create a VM

POST/v1/vms

Queues a new VM and returns 202 Accepted with the operation_id of the create operation. The VM starts in provisioning. Poll Get an operation or Get a VM to see when it is running.

X-Idempotency is optional but recommended. If you repeat a request with the same key and the same name, you get the original operation back with 200 OK and X-Idempotency-Replay: true, and nothing new is queued. The replay check runs after the basic field checks (required fields, SSH keys, zone) but before the billing, plan, image, quota and name checks, so a retry after the VM was created still returns the original operation. Reusing the key with a different name returns 409 with action: idempotency_key_reused. Without a key, every request queues a new VM.

Things to know:

  • You must accept the acceptable use policy before creating your first VM. Until then this endpoint returns 428 with action: accept_acceptable_use_policy.
  • Provide image_slug, or snapshot_uid to create the VM from a snapshot. A VM created from a snapshot uses the snapshot's image and login user and is always persistent.
  • New VMs from an image log in as root.
  • If the plan is ephemeral-eligible, the VM is ephemeral even when ephemeral is false. Ephemeral VMs expire after the plan's default_runtime_mins (72 hours if the plan sets none). Each account can have one active ephemeral VM.
  • Desktop images need a plan with at least 2 vCPU and 2048 MiB of memory.
  • The VM gets an HTTPS app URL that forwards to port 8080 by default. Change it with Set the VM app port.
  • VM names must be unique in the workspace. Uniqueness is checked on the slug of the name, so Web 1 and web-1 clash.

Authentication

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

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

namestringRequired

Display name of the VM. Leading and trailing spaces are trimmed. Its slug must be unique among the workspace's VMs.

plan_slugstringRequired

Slug of a compute plan from List plans. Case-insensitive.

image_slugstring

Slug of an image from List images. Required unless snapshot_uid is set, and ignored when it is.

vpc_slugstringRequired

Slug of the VPC to attach the VM to. Use default for the platform's default private network.

zone_slugstring

Zone to run the VM in. Defaults to olas-closet, currently the only zone.

Default olas-closet

ssh_key_uidsarray of stringsRequired

UIDs of SSH keys to install on the VM. At least one is required. Each key must be yours or belong to the workspace.

ephemeralboolean

Request a short-lived ephemeral VM. Only allowed on ephemeral-eligible plans. On those plans the VM is ephemeral whatever you send. Ignored when snapshot_uid is set.

Default false

snapshot_uidstring

UID of an available snapshot in this workspace to create the VM from. When set, image_slug is not needed.

startup_scriptstring

Optional shell script to run on the VM's first boot.

Response

202

The create operation was queued.

successbooleanRequired

true when the request succeeded.

messagestringRequired

Human-readable status message.

dataobject
Show attributes
operation_idstringRequired

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

vm_uidstringRequired

UID of the new VM.

namestringRequired

Name of the VM.

statusstringRequired

Status of the create operation. queued for a newly queued VM.

One ofqueuedrunningsucceededfailed

vm_statusstringRequired

Status of the VM (see VmStatus). provisioning for a newly queued VM. 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.

Response

200

Replay. The X-Idempotency key was already used to create a VM with this name, 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).

successbooleanRequired

true when the request succeeded.

messagestringRequired

Human-readable status message.

dataobject
Show attributes
operation_idstringRequired

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

vm_uidstringRequired

UID of the new VM.

namestringRequired

Name of the VM.

statusstringRequired

Status of the create operation. queued for a newly queued VM.

One ofqueuedrunningsucceededfailed

vm_statusstringRequired

Status of the VM (see VmStatus). provisioning for a newly queued VM. 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.

Errors

StatusMeaning
400Validation failed. Possible messages: invalid request (malformed JSON), name, plan_slug, and vpc_slug are required, image_slug is required, at least one ssh key is required, invalid zone, invalid compute plan, this compute plan is not available, invalid image, invalid snapshot, snapshot source image is unavailable, selected plan is not eligible for ephemeral compute, invalid ssh key, invalid vpc, or the desktop plan-size message.
401The API key is missing, invalid, expired or revoked.
402The account is past due and cannot create new paid resources.
403You cannot access the workspace, your role does not allow this action, or the account is suspended.
409Conflict: A VM with this name already exists., ephemeral compute limit reached, snapshot is not ready to restore, or the X-Idempotency key was already used for a different operation (action: idempotency_key_reused).
428You have not accepted the acceptable use policy yet.

Errors use the standard error format.