/v1/vms/{uid}/snapshotsQueues a snapshot of the VM's disk. The snapshot starts as creating and becomes
available when it is ready. consumed_bytes is filled in then.
This is asynchronous. It returns 202 Accepted with an operation_id. See
Get an operation. The new snapshot's UID is the
operation's resource_uid. In the response, name is the VM's name, not the snapshot's.
Send an X-Idempotency key to make retries safe: a retry with the same key returns the
original operation with 200 and nothing new is queued. The key is tied to the VM and
the snapshot name: reusing it for another VM or name 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
uidstringRequiredThe VM's uid.
Headers
X-Workspace-SlugstringRequiredSlug of the workspace the request acts on. You can also pass it as the workspace_slug query parameter.
X-IdempotencystringOptional 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.
Request body
namestringRequiredName of the snapshot. Its slug is derived from it.
min length 1 · max length 100
shutdown_before_snapshotbooleanShut the VM down before taking the snapshot, for a consistent copy of a busy disk.
Default false
Response
The snapshot operation was queued.
successbooleanRequiredtrue when the request succeeded.
messagestringRequiredHuman-readable status message.
dataobjectShow attributesHide attributes
operation_idstringRequiredUID of the queued operation. Poll it with Get an operation. The snapshot is the operation's resource_uid.
vm_uidstringRequiredUID of the VM from the request path. For Delete a snapshot, the snapshot's source VM, or empty on a replay.
namestringRequiredName of the VM for VM-scoped requests (empty on a replay if the VM is gone). Name of the snapshot for Delete a snapshot.
actionstringRequiredThe action that was queued.
One ofvm_snapshot.createvm_snapshot.restorevm_snapshot.delete
statusstringRequiredStatus of the operation.
One ofqueuedrunningsucceededfailed
events_urlstringRequiredPath of the server-sent events stream with the operation's progress.
is_replaybooleanRequiredtrue when an existing operation was returned for a reused X-Idempotency key.
is_completedbooleanRequiredtrue when a returned existing operation has already finished.
Response
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.
successbooleanRequiredtrue when the request succeeded.
messagestringRequiredHuman-readable status message.
dataobjectShow attributesHide attributes
operation_idstringRequiredUID of the queued operation. Poll it with Get an operation. The snapshot is the operation's resource_uid.
vm_uidstringRequiredUID of the VM from the request path. For Delete a snapshot, the snapshot's source VM, or empty on a replay.
namestringRequiredName of the VM for VM-scoped requests (empty on a replay if the VM is gone). Name of the snapshot for Delete a snapshot.
actionstringRequiredThe action that was queued.
One ofvm_snapshot.createvm_snapshot.restorevm_snapshot.delete
statusstringRequiredStatus of the operation.
One ofqueuedrunningsucceededfailed
events_urlstringRequiredPath of the server-sent events stream with the operation's progress.
is_replaybooleanRequiredtrue when an existing operation was returned for a reused X-Idempotency key.
is_completedbooleanRequiredtrue when a returned existing operation has already finished.
Errors
| Status | Meaning |
|---|---|
400 | name is missing or longer than 100 characters (invalid request payload). |
401 | The API key is missing, invalid, expired or revoked. |
403 | You cannot access the workspace, your role does not allow this action, or the account is suspended. |
404 | The resource does not exist or you cannot access it. |
409 | The VM is deleting or deleted (vm is not available for snapshots), or the X-Idempotency key was used for a different operation (action: idempotency_key_reused). |
Errors use the standard error format.