Skip to content

Restart a VPS

POST /api/v2/vps/{id}/actions/restart

Restart a VPS. It is shut down and started again. The restart is graceful by default: the operating system gets 60 seconds to shut down. After that the VPS is powered off and started anyway. Send {"force": true} to power it off at once, as POST /api/v2/vps/{id}/actions/reset does.

Before you call it, read GET /api/v2/vps/{id}/details. Restart when actions.canRestart.allowed is true and bandwidth.hasOverage is false. A stopped VPS is not refused. The call returns 202 and the VPS is started, although canRestart is false. Start a stopped VPS with POST /api/v2/vps/{id}/actions/start instead.

The call returns 202 with a job. Follow it at operation.pollUrl until it finishes (Jobs). If the same action is already queued or running for the VPS, you get that job back. The force you sent is then ignored. The response’s operation.status then says queued even when the job already runs. The job’s own status at pollUrl is the real one. Restart a VPS and wait until it is back shows the check, the call and the wait.

Authentication: An API key with the scope power:vm. About keys and scopes

Request

Path parameters

idstringrequired
The VPS ID (vps_…).

Body (optional)

forceboolean
Power the VPS off at once instead of waiting up to 60 seconds for the operating system to shut down. Default false.

Example

POST /api/v2/vps/{id}/actions/restart
curl -X POST "https://cloud.hostup.se/api/v2/vps/vps_01hxa3b4c5d6e7f8g9h0j1k2m3/actions/restart" \
-H "Authorization: Bearer $HOSTUP_API_KEY" \
-H "Content-Type: application/json"

Responses

202 The restart is queued. Follow the job.

Response 202
{
"operation": {
"status": "queued",
"jobId": "job_01hxa3b4c5d6e7f8g9h0j1k2m3",
"pollUrl": "/api/jobs/job_01hxa3b4c5d6e7f8g9h0j1k2m3"
}
}
Response fields
operationobject
statusstring
Where the job is. A 202 Accepted response only has pending, queued or in_progress. completed and failed appear when you poll pollUrl. They also appear in a 200 OK response when the action finished during the request. One of pending, queued, in_progress, completed, failed.
jobIdstring
pollUrlstring or null
Where to poll the job while it runs. null when status is already completed or failed.

Errors

Errors are Problem Details with a stable code. Branch on the code, not on the text.

400invalid_request: the body has a field other than force, or force is not true or false. Also while the VPS is still being set up: wait until setup finishes.
401Unauthorized. Authentication is required.
403forbidden with requiredScopes: the key lacks power:vm. forbidden without requiredScopes: the VPS is not active (for example suspended), it is still being set up, another operation runs on it, or its bandwidth allowance is used up (bandwidth.hasOverage on the details). The detail is the same in each case. Add bandwidth with POST /api/v2/vps/{id}/actions/config. payg_payment_overdue: a Cloud VPS whose account has an overdue invoice. Pay it first.
404vps_not_found: no VPS on your account has this ID. Take the ID from GET /api/v2/vps.
409upstream_failed: the VPS is still being set up. Wait until setup finishes. While setup runs, the call can also answer 400 or 403.
429Rate limited. Retry after the limit resets. 429 responses include Retry-After seconds plus X-RateLimit-* headers.
500Internal error. Retry later or contact support if the issue persists.