Skip to content

POST /api/vms/{id}/power-button

Updated

Ask the guest OS to shut down cleanly. The host falls back to a hard stop if the graceful path does not complete.

PropertyValue
Scopereadwrite
Request bodynone
Success204 No Content

Endpoint

POST ${baseUrl}/api/vms/${id}/power-button
readwrite

Ask the guest OS to shut down, with a hard-stop fallback.

Use your host URL and API key as shell variables:

baseUrl="https://agent.example.com"
VIRT_AGENT_API_KEY="<your-api-key>"

cURL template

curl --request POST "${baseUrl}/api/vms/${id}/power-button" \
  --header "Authorization: Bearer ${VIRT_AGENT_API_KEY}"
LocationNameTypeRequiredDescription
HeaderAuthorizationbearer tokenyesBearer ${VIRT_AGENT_API_KEY} from a readwrite key.
PathidstringyesVM id.
StatusBodyDescription
204 No ContentnoneACPI power button was sent or the host accepted the graceful shutdown flow.
Terminal window
baseUrl="https://agent.example.com"
VIRT_AGENT_API_KEY="<your-api-key>"
id="demo-api-vm"
curl --request POST "${baseUrl}/api/vms/${id}/power-button" \
--header "Authorization: Bearer ${VIRT_AGENT_API_KEY}"
HTTP/1.1 204 No Content
StatusCodeDescription
401UNAUTHORIZEDAPI key is missing or invalid.
403FORBIDDENKey is read-only or endpoint is outside the key allowlist.
404NOT_FOUNDVM id does not exist.
409INVALID_STATEVM state does not allow power-button shutdown.
500CH_ERROR or INTERNALHost failed to deliver or complete the shutdown flow.