Skip to content

Restore a database backup

POST /api/v2/shared-hosting/{accountId}/backups/databases/{backupId}/actions/restore

Restore one database on a web hosting account from a backup. The database is replaced by its state in the backup. Website files, email, DNS and the account’s other databases are not touched. Check actions.canRestore on the backup in GET /api/v2/shared-hosting/{accountId}/backups/databases first. A damaged or unavailable backup answers 409 backup_not_restorable. The account must be active and on cPanel. Send no body or {}. The call answers 202 with a job (Jobs) and the database’s name. GET /api/jobs/{jobId} answers 404 for this ID. Poll operation.pollUrl instead. It points to GET /api/v2/shared-hosting/{accountId}/backups/queue/{queueRef}, which answers status and progressPercent at the top level.

Authentication: An API key with the scopes write:hosting and console:services. About keys and scopes

Request

Path parameters

accountIdstringrequired
The web hosting account ID (acct_…).
backupIdstringrequired
The database backup ID (bkp_…) from GET /api/v2/shared-hosting/{accountId}/backups/databases.

Example

POST /api/v2/shared-hosting/{accountId}/backups/databases/{backupId}/actions/restore
curl -X POST "https://cloud.hostup.se/api/v2/shared-hosting/acct_01hxa3b4c5d6e7f8g9h0j1k2m3/backups/databases/acct_01hxa3b4c5d6e7f8g9h0j1k2m3/actions/restore" \
-H "Authorization: Bearer $HOSTUP_API_KEY" \
-H "Content-Type: application/json"

Responses

202 Database restore queued.

Response 202
{
"operation": {
"status": "queued",
"jobId": "job_01hxa3b4c5d6e7f8g9h0j1k2m3",
"pollUrl": "/api/v2/shared-hosting/acct_01hxa3b4c5d6e7f8g9h0j1k2m3/backups/queue/job_01hxa3b4c5d6e7f8g9h0j1k2m3"
},
"database": {
"name": "abcde_wp"
}
}
Response fields
operationobject
statusstring
Always queued. One of queued.
jobIdstring
The restore job (job_…).
pollUrlstring
Path that reports the restore’s progress.
databaseobject
namestring
The database being restored.

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.
404The database backup is not on this account or is no longer in its list (backup_not_found). List the database backups again.
409The backup is damaged or not available for restore (backup_not_restorable). Also returned when the account is on Hostup’s previous hosting platform (account_not_eligible_cpanel).
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.
502Upstream failure. A dependent provider request failed; the Problem Details code is upstream_failed. Retry later or contact support if the issue persists.