Snapshot a running VM
Checkpoints a running VM into a new snapshot. Creation is
synchronous; the 201 body is the persisted record, already in
state ready, with parent_snapshot_id pointing at the VM’s
previous ready snapshot. mode defaults to manual.
live: false (the default, and the value of an omitted body)
copies the rootfs and nothing else, so restoring cold-boots the
guest. live: true additionally captures the guest’s memory and
vCPU state inside a single pause window, so restoring resumes the
guest where it stopped. It costs the environment’s full configured
memory in bytes on every create, pauses the guest for the length
of the capture, and produces an artifact pinned to the host that
took it.
The response’s kind is what was actually written, not what was
requested. A host running an agent too old to know about live
snapshots answers live: true with a disk snapshot and the record
says disk, so a caller that depends on the memory being present
must read kind rather than assume the request was honoured.
Preconditions are reported as 4xx, not 5xx:
- 404
not_found— unknown VM. - 409
conflict— the VM is not running (e.g. draining), the per-tenant snapshot quota (count or bytes) is exhausted, or the VM holds a GPU passthrough device. A vfio device cannot be checkpointed, so GPU environments can never be snapshotted; this is permanent and must not be retried. A GPU VM asking forlive: truegets this same 409 and the same GPU-specific message, not the 501 below: the device is what cannot be checkpointed, so droppinglivewill not help. - 501
unimplemented— the provider has no snapshot support (e.g. the in-memory stub), orlive: truewas requested against a provider that supports disk snapshots but not live ones. The latter is not a conflict: nothing about the VM’s state is wrong and retrying it unchanged can never succeed, but the same call withoutlivewill, and the message says so. Only Firecracker hosts running an agent new enough to capture memory implement it.
Byte quotas were calibrated against rootfs-only snapshots, so a
workload that switches to live: true reaches the 409 quota case
far sooner than its snapshot count suggests.
A lifecycle hitl gate matching snapshot can hold the create
(202) or deny it (403 hitl_denied). A held create runs on
approval and the intervention’s result.snapshot_id names the
snapshot.
/v1/environments/{vmId}/snapshotsAuthorizationBearer token · headerrequiredfuse_sessionAPI key · cookierequiredvmIdstringrequiredapplication/jsoncommentstringmodestringmanualautoretention_secondsinteger<int64>metadataobjectlayer_keystringlivebooleanexport_refstringexport_statusstringpendingreadyerroridstringrequiredvm_idstringrequiredtask_idstringtenant_idstringparent_snapshot_idstringmodestringstatestringcreatingreadyrestoringdeletingerrorcommentstringlayer_keystringarchstringamd64arm64digeststringkindstringdisklivesize_bytesinteger<int64>created_atstring<date-time>requiredupdated_atstring<date-time>retention_untilstring<date-time> | nulllast_errorstringexport_refstringexportsSnapshotExport[]Show propertiesHide properties
SnapshotExportdestinationstringrequiredstatusstringrequested_atstring<date-time>updated_atstring<date-time>last_errorstringintervention_idstringrequiredinterventionInterventionrequiredShow propertiesHide properties
idstringrequiredenv_idstringrequiredkindstringrequiredasksecrettakeoverreviewexeclifecyclecomputerstallexpirygatestringmodestringasknotifydenystatestringrequiredpendingapprovedrejectedexpiredcancelledpayloadobjectrequiredShow propertiesHide properties
questionstringchoicesstring[]execExecPayloadShow propertiesHide properties
argvstring[]requiredshellstringtimeout_msinteger<int64>lifecycleLifecyclePayloadShow propertiesHide properties
actionstringrequireddestroyforkmigratedrainsnapshotrotate-tokensecretInterventionSecretShow propertiesHide properties
targetstringrequiredlabelstringrequiredmessagestringtakeoverInterventionTakeoverShow propertiesHide properties
viastringrequiredterminaldesktopreasonstringholderActorShow propertiesHide properties
idstringrequirednamestringsourcestringrequiredpinnedassertedkeysystemdeciderkey_idstringstarted_atstring<date-time>signalInterventionSignalShow propertiesHide properties
failuresintegerlast_exit_codeintegerquiet_secondsinteger<int64>reaperstringidle_timeoutmax_runtimereap_atstring<date-time>extended_untilstring<date-time>computerComputerPayloadShow propertiesHide properties
actionstringrequiredtextstringinputobjectrequiredreviewInterventionReviewShow propertiesHide properties
pathstringcontentstringrequiredformatstringrequiredtextdiffmessagestringtruncatedbooleandeciderInterventionDeciderShow propertiesHide properties
verdictstringrequiredaskreasonstringerrorstringtriggered_byActorrequiredShow propertiesHide properties
idstringrequirednamestringsourcestringrequiredpinnedassertedkeysystemdeciderkey_idstringdeadlinestring<date-time>requiredon_timeoutstringrequiredrejectallowdecisionobjectShow propertiesHide properties
outcomestringrequiredapproverejectanswerstringreasonstringdecided_byActorrequiredShow propertiesHide properties
idstringrequirednamestringsourcestringrequiredpinnedassertedkeysystemdeciderkey_idstringdecided_atstring<date-time>requirededited_argvstring[]edited_textstringgrantstringresultInterventionResultShow propertiesHide properties
execExecEnvironmentResponseShow propertiesHide properties
exit_codeintegerrequiredstdoutstringrequiredstderrstringrequiredcomputerComputerActionResponseShow propertiesHide properties
outputstringscreenshotstringenv_idstringsnapshot_idstringerrorstringfinished_atstring<date-time>requiredcreated_atstring<date-time>requiredupdated_atstring<date-time>requirederrorobjectrequiredShow propertiesHide properties
codestringrequirednot_foundroute_not_foundconflictinvalid_argumentunauthorizedforbiddenunavailableinternalunimplementedlockedmessagestringrequireddetailsobjecterrorobjectrequiredShow propertiesHide properties
codestringrequirednot_foundroute_not_foundconflictinvalid_argumentunauthorizedforbiddenunavailableinternalunimplementedlockedmessagestringrequireddetailsobjecterrorobjectrequiredShow propertiesHide properties
codestringrequirednot_foundroute_not_foundconflictinvalid_argumentunauthorizedforbiddenunavailableinternalunimplementedlockedmessagestringrequireddetailsobjecterrorobjectrequiredShow propertiesHide properties
codestringrequirednot_foundroute_not_foundconflictinvalid_argumentunauthorizedforbiddenunavailableinternalunimplementedlockedmessagestringrequireddetailsobjecterrorobjectrequiredShow propertiesHide properties
codestringrequirednot_foundroute_not_foundconflictinvalid_argumentunauthorizedforbiddenunavailableinternalunimplementedlockedmessagestringrequireddetailsobjecterrorobjectrequiredShow propertiesHide properties
codestringrequirednot_foundroute_not_foundconflictinvalid_argumentunauthorizedforbiddenunavailableinternalunimplementedlockedmessagestringrequireddetailsobjectcurl -X POST "http://localhost:8080/v1/environments/string/snapshots" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"comment": "string",
"mode": "manual",
"retention_seconds": 0,
"metadata": {},
"layer_key": "string",
"live": false,
"export_ref": "string",
"export_status": "pending"
}'const response = await fetch("http://localhost:8080/v1/environments/string/snapshots", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"comment": "string",
"mode": "manual",
"retention_seconds": 0,
"metadata": {},
"layer_key": "string",
"live": false,
"export_ref": "string",
"export_status": "pending"
})
});import requests
response = requests.post(
"http://localhost:8080/v1/environments/string/snapshots",
headers={
"Authorization": "Bearer YOUR_TOKEN",
"Content-Type": "application/json"
},
json={
"comment": "string",
"mode": "manual",
"retention_seconds": 0,
"metadata": {},
"layer_key": "string",
"live": False,
"export_ref": "string",
"export_status": "pending"
},
){
"id": "string",
"vm_id": "string",
"task_id": "string",
"tenant_id": "string",
"parent_snapshot_id": "string",
"mode": "manual",
"state": "creating",
"comment": "string",
"layer_key": "string",
"arch": "amd64",
"digest": "string",
"kind": "disk",
"size_bytes": 0,
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z",
"retention_until": "2024-01-01T00:00:00Z",
"last_error": "string",
"export_ref": "string",
"exports": [
{
"destination": "string",
"status": "pending",
"requested_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z",
"last_error": "string"
}
]
}{
"intervention_id": "string",
"intervention": {
"id": "string",
"env_id": "string",
"kind": "ask",
"gate": "string",
"mode": "ask",
"state": "pending",
"payload": {
"question": "string",
"choices": [
"string"
],
"exec": {
"argv": [
"string"
],
"shell": "string",
"timeout_ms": 0
},
"lifecycle": {
"action": "destroy"
},
"secret": {
"target": "string",
"label": "string",
"message": "string"
},
"takeover": {
"via": "terminal",
"reason": "string",
"holder": {
"id": "string",
"name": "string",
"source": "pinned",
"key_id": "string"
},
"started_at": "2024-01-01T00:00:00Z"
},
"signal": {
"failures": 0,
"last_exit_code": 0,
"quiet_seconds": 0,
"reaper": "idle_timeout",
"reap_at": "2024-01-01T00:00:00Z",
"extended_until": "2024-01-01T00:00:00Z"
},
"computer": {
"action": "string",
"text": "string",
"input": {}
},
"review": {
"path": "string",
"content": "string",
"format": "text",
"message": "string",
"truncated": true
},
"decider": {
"verdict": "ask",
"reason": "string",
"error": "string"
}
},
"triggered_by": {
"id": "string",
"name": "string",
"source": "pinned",
"key_id": "string"
},
"deadline": "2024-01-01T00:00:00Z",
"on_timeout": "reject",
"decision": {
"outcome": "approve",
"answer": "string",
"reason": "string",
"decided_by": {
"id": "string",
"name": "string",
"source": "pinned",
"key_id": "string"
},
"decided_at": "2024-01-01T00:00:00Z",
"edited_argv": [
"string"
],
"edited_text": "string",
"grant": "string"
},
"result": {
"exec": {
"exit_code": 0,
"stdout": "hi\n",
"stderr": ""
},
"computer": {
"output": "string",
"screenshot": "string"
},
"env_id": "string",
"snapshot_id": "string",
"error": "string",
"finished_at": "2024-01-01T00:00:00Z"
},
"created_at": "2024-01-01T00:00:00Z",
"updated_at": "2024-01-01T00:00:00Z"
}
}{
"error": {
"code": "not_found",
"message": "string",
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "string",
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "string",
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "string",
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "string",
"details": {}
}
}{
"error": {
"code": "not_found",
"message": "string",
"details": {}
}
}