Delete a VPS
DELETE/api/v1/vps/{vps_uuid}
Deletes the server, its disk and its backups. Billing stops at once, and from then on Get a VPS answers 404 while the host removes the server in the background.
Parameters
| Name | In | Description |
|---|---|---|
| vps_uuid | path, stringrequired | VPS id, from Create a VPS or List VPS |
Example request
curl -X DELETE "https://platform.serverscamp.com/api/v1/vps/$VPS_UUID" \
-H "Authorization: Bearer $API_TOKEN"import os, requests
token = os.environ["API_TOKEN"]
vps_uuid = "12d46f8c-d66e-4163-99aa-1245d5b06e5b"
r = requests.delete(
f"https://platform.serverscamp.com/api/v1/vps/{vps_uuid}",
headers={"Authorization": f"Bearer {token}"},
)
r.raise_for_status()
print(r.json())const vpsUuid = '12d46f8c-d66e-4163-99aa-1245d5b06e5b';
const r = await fetch(`https://platform.serverscamp.com/api/v1/vps/${vpsUuid}`, {
method: 'DELETE',
headers: { Authorization: `Bearer ${process.env.API_TOKEN}` },
});
console.log(r.status, await r.json());Answer
Status 200 with this body.
| Field | Type | Description |
|---|---|---|
| vps_uuid | stringrequired | |
| status | stringrequired | What the server does now; poll Get a VPS to see it finish |
{
"vps_uuid": "12d46f8c-d66e-4163-99aa-1245d5b06e5b",
"status": "deleting"
}Wait until it is ready
The answer comes at once. From then on Get a VPS answers 404, and the host removes the server, its disk and its backups in the background within a minute or two.
Check the status
Ask Get a VPS with the server's id:
curl "https://platform.serverscamp.com/api/v1/vps/$VPS_UUID" \
-H "Authorization: Bearer $API_TOKEN"After the delete it answers 404:
{
"detail": "VPS not found"
}Wait in a loop
Ask every few seconds until the answer is 404.
# VPS_UUID: vps_uuid of the server, from the answer above
until [ "$(curl -s -o /dev/null -w '%{http_code}' \
"https://platform.serverscamp.com/api/v1/vps/$VPS_UUID" -H "Authorization: Bearer $API_TOKEN")" = 404 ]; do
sleep 5
done
echo deleted# vps_uuid: vps_uuid of the server, from the answer above
import os, time, requests
headers = {"Authorization": f"Bearer {os.environ['API_TOKEN']}"}
while requests.get(f"https://platform.serverscamp.com/api/v1/vps/{vps_uuid}", headers=headers).status_code != 404:
time.sleep(5)
print("deleted")// vpsUuid: vps_uuid of the server, from the answer above
const headers = { Authorization: `Bearer ${process.env.API_TOKEN}` };
while ((await fetch(`https://platform.serverscamp.com/api/v1/vps/${vpsUuid}`, { headers })).status !== 404) {
await new Promise((ok) => setTimeout(ok, 5000));
}
console.log('deleted');Errors
| Status | When |
|---|---|
401 | No token, or a token that is not valid |
404 | No such VPS in your account |
409 | The server is busy with another task |
422 | The body or a parameter is not what the operation takes |
Every operation can also answer 401 without a valid token. All errors