Sign up

Change the plan

POST/api/v1/vps/{vps_uuid}/plan

Moves the server to a bigger plan: more memory and at least the same disk, which grows and cannot shrink. The server restarts to pick it up, and the new price applies from the next hour.

Parameters

NameInDescription
vps_uuidpath, stringrequiredVPS id, from Create a VPS or List VPS

Request body

FieldTypeDescription
plan_idstringrequiredA bigger plan from GET /vps/plans

Example request

curl -X POST "https://platform.serverscamp.com/api/v1/vps/$VPS_UUID/plan" \
  -H "Authorization: Bearer $API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "plan_id": "vps2-2"
  }'

Answer

Status 200 with this body.

FieldTypeDescription
vps_uuidstringrequired
plan_idstringrequiredThe new plan
rebootedboolean, optionalThe server restarts to pick it up
{
  "vps_uuid": "12d46f8c-d66e-4163-99aa-1245d5b06e5b",
  "plan_id": "vps2-2",
  "rebooted": true
}

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": "starting",
  "ipv4": "185.236.9.61",
  "error": null
}
statusWhat it means
startingThe server restarts with the new plan
runningReady, on the new plan
errorSomething 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'

The bash version needs jq.

Errors

StatusWhen
400Not a bigger plan
401No token, or a token that is not valid
402The balance does not cover the new plan
409The plan is out of stock
422The body or a parameter is not what the operation takes

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