Skip to content

AppVM lifecycle API

Updated

AppVM member operations use the /api/appvm/vms/{id} resource prefix. These routes reject classic VM ids with 404 NOT_FOUND.

The following endpoints require a readwrite API key and no request body:

MethodPathSuccessBehavior
POST/api/appvm/vms/{id}/boot204 No ContentStart a created or stopped AppVM.
POST/api/appvm/vms/{id}/shutdown204 No ContentStop the AppVM and tear down its host runtime.
POST/api/appvm/vms/{id}/reboot204 No ContentStop and boot the AppVM.
POST/api/appvm/vms/{id}/pause204 No ContentPause its vCPUs.
POST/api/appvm/vms/{id}/resume204 No ContentResume a paused AppVM.
POST/api/appvm/vms/{id}/power-button204 No ContentRequest a graceful guest shutdown with forced-stop timeout.
DELETE/api/appvm/vms/{id}204 No ContentDelete the AppVM and agent-owned resources.

Example:

Terminal window
baseUrl="https://agent.example.com"
VIRT_AGENT_API_KEY="<your-readwrite-api-key>"
id="demo-api-appvm"
curl --request POST "${baseUrl}/api/appvm/vms/${id}/boot" \
--header "Authorization: Bearer ${VIRT_AGENT_API_KEY}"

Read GET /api/appvm/vms/{id} after an action to confirm the resulting state and display_state.

GET /api/appvm/vms/{id}/logs requires a read API key and returns the tail of the AppVM workload stdout and stderr log:

{
"log": "workload output\n"
}

The response is capped at 256 KiB.

GET /api/appvm/vms/{id}/metrics/history requires a read API key. Supply range= with one of 1h, 24h, 7d, 30d, or 1y; it defaults to 1h, and any other value is rejected with 400. An optional from and to pair of Unix timestamps selects an exact window instead, overriding range; sending only one of the pair is rejected with 400.

Terminal window
curl "${baseUrl}/api/appvm/vms/${id}/metrics/history?range=1h" \
--header "Authorization: Bearer ${VIRT_AGENT_API_KEY}"

The response shape, including the interval_secs the host chose for the window, is documented under GET /api/vms/{id}/metrics/history.

StatusCodeDescription
400BAD_REQUESTQuery parameters or the requested operation are invalid.
401UNAUTHORIZEDAPI key is missing or invalid.
403FORBIDDENThe key is read-only for a mutation, or the endpoint is outside the key allowlist.
404NOT_FOUNDThe AppVM id does not exist or belongs to a classic VM.
409INVALID_STATEThe AppVM state does not allow the lifecycle action.