Reinstall
POST/api/v1/vps/{vps_uuid}/reinstall
A fresh disk with the image you give. The addresses, names and backups stay.
Parameters
| Name | In | Description |
|---|---|---|
| vps_uuid | path, stringrequired | VPS id, from Create a VPS or List VPS |
Request body
| Field | Type | Description |
|---|---|---|
| image | stringrequired | An image id from GET /vps/images |
| ssh_key_ids | list of integer | |
| password | string, optional | Root password |
Example request
curl -X POST "https://platform.serverscamp.com/api/v1/vps/$VPS_UUID/reinstall" \
-H "Authorization: Bearer $API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"image": "debian-13",
"ssh_key_ids": [42]
}'import os, requests
token = os.environ["API_TOKEN"]
vps_uuid = "12d46f8c-d66e-4163-99aa-1245d5b06e5b"
r = requests.post(
f"https://platform.serverscamp.com/api/v1/vps/{vps_uuid}/reinstall",
headers={"Authorization": f"Bearer {token}"},
json={
"image": "debian-13",
"ssh_key_ids": [42]
},
)
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}/reinstall`, {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.API_TOKEN}`, 'Content-Type': 'application/json' },
body: JSON.stringify({
"image": "debian-13",
"ssh_key_ids": [42]
}),
});
console.log(r.status, await r.json());curl -X POST "https://platform.serverscamp.com/api/v1/vps/$VPS_UUID/reinstall" \
-H "Authorization: Bearer $API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"image": "ubuntu-26.04",
"password": "change-me-to-a-long-one"
}'import os, requests
token = os.environ["API_TOKEN"]
vps_uuid = "12d46f8c-d66e-4163-99aa-1245d5b06e5b"
r = requests.post(
f"https://platform.serverscamp.com/api/v1/vps/{vps_uuid}/reinstall",
headers={"Authorization": f"Bearer {token}"},
json={
"image": "ubuntu-26.04",
"password": "change-me-to-a-long-one"
},
)
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}/reinstall`, {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.API_TOKEN}`, 'Content-Type': 'application/json' },
body: JSON.stringify({
"image": "ubuntu-26.04",
"password": "change-me-to-a-long-one"
}),
});
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": "reinstalling"
}Wait until it is ready
The answer comes at once and the work runs in the background, usually for a minute or two. Get a VPS shows how far it got in its status field.
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"The answer carries the whole server; the field to watch is status:
{
"vps_uuid": "12d46f8c-d66e-4163-99aa-1245d5b06e5b",
"name": "web-1",
"status": "reinstalling",
"ipv4": "185.236.9.61",
"error": null
}| status | What it means |
|---|---|
reinstalling | The old disk is removed |
cloning | A fresh copy of the image is made |
configuring | Network, keys and password are set |
starting | The server boots |
running | Ready, with the new system |
error | Something went wrong; the error field says what |
Wait in a loop
Ask every few seconds until the status is the one you wait for, and stop on error.
# VPS_UUID: vps_uuid of the server, from the answer above
WANT=running
while true; do
VPS=$(curl -s "https://platform.serverscamp.com/api/v1/vps/$VPS_UUID" -H "Authorization: Bearer $API_TOKEN")
STATUS=$(echo "$VPS" | jq -r .status)
echo "$STATUS"
[ "$STATUS" = "$WANT" ] && break
[ "$STATUS" = error ] && { echo "$VPS" | jq -r .error; exit 1; }
sleep 5
done
curl -s "https://platform.serverscamp.com/api/v1/vps/$VPS_UUID" -H "Authorization: Bearer $API_TOKEN" | jq -r '"ssh root@" + .ipv4'# vps_uuid: vps_uuid of the server, from the answer above
import os, time, requests
headers = {"Authorization": f"Bearer {os.environ['API_TOKEN']}"}
want = "running"
while True:
vps = requests.get(f"https://platform.serverscamp.com/api/v1/vps/{vps_uuid}", headers=headers).json()
print(vps["status"])
if vps["status"] == want:
break
if vps["status"] == "error":
raise SystemExit(vps["error"])
time.sleep(5)
print(f"ssh root@{vps['ipv4']}")// vpsUuid: vps_uuid of the server, from the answer above
const headers = { Authorization: `Bearer ${process.env.API_TOKEN}` };
const want = 'running';
let vps;
for (;;) {
vps = await (await fetch(`https://platform.serverscamp.com/api/v1/vps/${vpsUuid}`, { headers })).json();
console.log(vps.status);
if (vps.status === want) break;
if (vps.status === 'error') throw new Error(vps.error);
await new Promise((ok) => setTimeout(ok, 5000));
}
console.log(`ssh root@${vps.ipv4}`);The bash version needs jq.
Errors
| Status | When |
|---|---|
400 | An image or password that is not accepted |
401 | No token, or a token that is not valid |
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