Cloud Panel

Delete a VM

DELETE/api/v1/vms/{vm_uuid}

Deletes the server and its root disk. Its public and floating addresses go back, attached volumes are detached and kept, and backups and snapshots are kept unless you ask to delete them too. Billing for the server stops at once; Get a VM shows status deleting and then answers 404.

Parameters

NameInDescription
vm_uuidpath, stringrequiredServer id, from Create a VM or List VMs
delete_backupsquery, booleanDelete the server's backups too; kept when left out
delete_snapshotsquery, booleanDelete the server's snapshots too; kept when left out
delete_volumesquery, booleanDelete the volumes attached to it too; they are detached and kept when left out

Example request

curl -X DELETE "https://platform.serverscamp.com/api/v1/vms/$VM_UUID" \
  -H "Authorization: Bearer $API_TOKEN"

Answer

Status 200 with this body.

FieldTypeDescription
successbooleanrequired
messagestringrequired
{
  "success": true,
  "message": "VM deletion queued"
}

Wait until it is ready

The answer comes at once. Get a VM shows status deleting while the server and its disk are removed, and then answers 404.

Check the status

Ask Get a VM with the server's id. After the delete it answers 404.

curl "https://platform.serverscamp.com/api/v1/vms/$VM_UUID" \
  -H "Authorization: Bearer $API_TOKEN"

Wait in a loop

Ask every few seconds until the answer is 404.

# VM_UUID: vm_uuid of the server, from the answer above
until [ "$(curl -s -o /dev/null -w '%{http_code}' \
    "https://platform.serverscamp.com/api/v1/vms/$VM_UUID" -H "Authorization: Bearer $API_TOKEN")" = 404 ]; do
  sleep 5
done
echo deleted

Errors

StatusWhen
401No token, or a token that is not valid
404No such server in your account
409The server is busy with another operation
422The body or a parameter is not what the operation takes

Every operation can also answer 401 without a valid token. All errors