Skip to content

Restore a backup of another VPS

POST /api/v2/vps/{id}/backups/actions/restore-from-vps

Replaces the disks of this VPS with a backup from another VPS on the same account. Everything on the target’s disks is lost. Take sourceVpsId and backupId from GET /api/v2/vps/{id}/backups/restore-sources and read that backup’s targetFit first. The target must be active and have no backup or restore running. The target is stopped, its disks are replaced, its own network settings are put back and it starts again. To restore a VPS from its own backup, use POST /api/v2/vps/{id}/backups/{backupId}/actions/restore instead. When the backup is larger than a Cloud VPS target, send growTargetStorage: true to grow the target. The extra storage is billed as Cloud VPS usage. A fixed-plan target cannot grow. The restore runs as a job. Poll operation.pollUrl until it finishes (Jobs).

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

Request

Path parameters

idstringrequired
The ID of the target VPS (vps_…).

Body

sourceVpsIdstringrequired
The source from sources[].id on restore-sources. It equals this VPS’s ID only for a retained source with backups of the server this VPS had before.
backupIdstringrequired
The backup from sources[].backups[].id of that source.
growTargetStorageboolean
Grow the storage of a Cloud VPS target to the size the backup needs. Use it when the backup’s targetFit.status is grow_required. Ignored when the backup already fits. Default false.

Example

POST /api/v2/vps/{id}/backups/actions/restore-from-vps
curl -X POST "https://cloud.hostup.se/api/v2/vps/vps_01hxa3b4c5d6e7f8g9h0j1k2m3/backups/actions/restore-from-vps" \
-H "Authorization: Bearer $HOSTUP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"sourceVpsId": "vps_01j0b3c4d5e6f7g8h9j0k1m2n3",
"backupId": "bkp_01hxa3b4c5d6e7f8g9h0j1k2m3"
}'

Responses

202 The restore job is queued.

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 response body is an RFC 7807 Problem Details document.
401Unauthorized. Authentication is required.
403Forbidden. The caller lacks a required scope or does not own the resource.
404Not found. The resource does not exist or is not owned by the caller; code is vps_not_found.
409The restore cannot start. Branch on code: target_storage_too_small (the backup is larger than the target; storageGrowth.allowed says whether a retry with growTargetStorage: true works), target_storage_unconfirmed (the target’s storage could not be read), target_vps_not_active, target_vps_not_ready, target_restore_blocked (a backup or restore already runs on the target), source_target_same_vps (use the normal restore for the VPS’s own backups), source_owner_unconfirmed or target_owner_unconfirmed.
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.