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
idstringrequiredvps_…).Body (optional)
forcebooleanfalse.Example
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"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" \ -d '{ "force": true }'Responses
202 The restart is queued. Follow the job.
{ "operation": { "status": "queued", "jobId": "job_01hxa3b4c5d6e7f8g9h0j1k2m3", "pollUrl": "/api/jobs/job_01hxa3b4c5d6e7f8g9h0j1k2m3" }}Response fields
operationobjectstatusstring202 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.jobIdstringpollUrlstring or nullnull when status is already completed or failed.Errors
Errors are Problem Details with a stable code. Branch on the code, not on the text.
| 400 | invalid_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. |
| 401 | Unauthorized. Authentication is required. |
| 403 | forbidden 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. |
| 404 | vps_not_found: no VPS on your account has this ID. Take the ID from GET /api/v2/vps. |
| 409 | upstream_failed: the VPS is still being set up. Wait until setup finishes. While setup runs, the call can also answer 400 or 403. |
| 429 | Rate limited. Retry after the limit resets. 429 responses include Retry-After seconds plus X-RateLimit-* headers. |
| 500 | Internal error. Retry later or contact support if the issue persists. |