Skip to content

Restore a snapshot

POST/v1/vms/{uid}/snapshots/{snapshot_uid}/restore

Restores the VM from one of its own snapshots. The snapshot must be available. While the restore runs, the snapshot shows restoring and the VM shows provisioning.

To start a new VM from a snapshot instead, pass snapshot_uid to Create a VM.

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 for the same snapshot returns the original operation with 200, even after the restore has finished.

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.

snapshot_uidstringRequired

The snapshot'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 snapshot action, the original operation is returned with 200 OK and X-Idempotency-Replay: true, and nothing new is queued. Reusing a key for a different action or snapshot 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 restore 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. The snapshot is the operation's resource_uid.

vm_uidstringRequired

UID of the VM from the request path. For Delete a snapshot, the snapshot's source VM, or empty on a replay.

namestringRequired

Name of the VM for VM-scoped requests (empty on a replay if the VM is gone). Name of the snapshot for Delete a snapshot.

actionstringRequired

The action that was queued.

One ofvm_snapshot.createvm_snapshot.restorevm_snapshot.delete

statusstringRequired

Status of the operation.

One ofqueuedrunningsucceededfailed

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 returned existing operation has already finished.

Response

200

Replay. The X-Idempotency key was already used for this snapshot action, so the existing operation is returned and nothing is queued. vm_uid is the VM from the request path and name is that VM's current name (empty if it is gone). For Delete a snapshot, vm_uid is empty and name is the snapshot's name.

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. The snapshot is the operation's resource_uid.

vm_uidstringRequired

UID of the VM from the request path. For Delete a snapshot, the snapshot's source VM, or empty on a replay.

namestringRequired

Name of the VM for VM-scoped requests (empty on a replay if the VM is gone). Name of the snapshot for Delete a snapshot.

actionstringRequired

The action that was queued.

One ofvm_snapshot.createvm_snapshot.restorevm_snapshot.delete

statusstringRequired

Status of the operation.

One ofqueuedrunningsucceededfailed

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 returned existing operation has already finished.

Errors

StatusMeaning
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 VM or snapshot does not exist, or the snapshot was not taken from this VM.
409The snapshot is not available (snapshot is not in available state for restore), or the X-Idempotency key was used for a different operation (action: idempotency_key_reused).

Errors use the standard error format.