Restore a snapshot on a VPS
POST /api/v2/vps/{id}/snapshots/{snapshotId}/actions/restore
Rolls a VPS back to one of its snapshots. Use a backup restore instead for a copy older than 24 hours. Check actions.canRestore on GET /api/v2/vps/{id}/snapshots first. Take the name from data[].name on that list. The route does not check it. An unknown name still answers 202 and the job still completes. A running VPS is then switched off and stays off. Start it again with POST /api/v2/vps/{id}/actions/start. With a valid name, a running VPS is powered off without a clean shutdown, rolled back and started again. Mounted ISO images are detached before it starts. Everything written to the disks after the snapshot was taken is lost. This cannot be undone. The restore runs in the background. Follow operation.pollUrl (Jobs).
Authentication: An API key with the scope backup:vm. About keys and scopes
Request
Path parameters
idstringrequiredvps_…).snapshotIdstringrequireddata[].name on GET /api/v2/vps/{id}/snapshots. Letters, digits, _ and -.Example
curl -X POST "https://cloud.hostup.se/api/v2/vps/vps_01hxa3b4c5d6e7f8g9h0j1k2m3/snapshots/before-upgrade/actions/restore" \ -H "Authorization: Bearer $HOSTUP_API_KEY" \ -H "Content-Type: application/json"Responses
202 The restore job is queued. Follow operation.pollUrl.
{ "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 response body is an RFC 7807 Problem Details document. |
| 401 | Unauthorized. Authentication is required. |
| 403 | Forbidden. The caller lacks a required scope or does not own the resource. |
| 404 | Not found. The resource does not exist or is not owned by the caller; code is vps_not_found. |
| 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. |