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

**Restore a database backup**

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`](/endpoints/webhosting-services/get-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](/concepts/jobs/#jobs-polled-at-another-endpoint)) 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}`](/endpoints/webhosting-services/get-v2-shared-hosting-accountid-backups-queue-queueref/), which answers `status` and `progressPercent` at the top level.

### Related Endpoints

- `GET /api/v2/shared-hosting/{accountId}/backups/databases`: List database backups
- `GET /api/v2/shared-hosting/{accountId}/backups`: List web hosting backups
- `GET /api/v2/shared-hosting/{accountId}/backups/queue/{queueRef}`: Get the status of a web hosting restore

### Headers

- `Authorization`: Bearer $HOSTUP_API_KEY
- Scopes: `write:hosting`, `console:services`

### Parameters

- `accountId` (path, string, required): The web hosting account ID (`acct_…`). Example: `acct_01hxa3b4c5d6e7f8g9h0j1k2m3`
- `backupId` (path, string, required): The database backup ID (`bkp_…`) from `GET /api/v2/shared-hosting/{accountId}/backups/databases`. Example: `acct_01hxa3b4c5d6e7f8g9h0j1k2m3`

### Request Example

```bash
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"
```

### Response Schema

- `operation` (object, required)
- `operation.status` (string, required): Always `queued`.
  Allowed values: queued
- `operation.jobId` (string, required): The restore job (`job_…`). Example: `job_01hxa3b4c5d6e7f8g9h0j1k2m3`
- `operation.pollUrl` (string, required): Path that reports the restore's progress. Example: `/api/v2/shared-hosting/acct_01hxa3b4c5d6e7f8g9h0j1k2m3/backups/queue/job_01hxa3b4c5d6e7f8g9h0j1k2m3`
- `database` (object, required)
- `database.name` (string, required): The database being restored. Example: `abcde_wp`

### Responses

#### 202 - Database restore queued.
```json
{
  "operation": {
    "status": "queued",
    "jobId": "job_01hxa3b4c5d6e7f8g9h0j1k2m3",
    "pollUrl": "/api/v2/shared-hosting/acct_01hxa3b4c5d6e7f8g9h0j1k2m3/backups/queue/job_01hxa3b4c5d6e7f8g9h0j1k2m3"
  },
  "database": {
    "name": "abcde_wp"
  }
}
```

#### 400 - Invalid request. The response body is an RFC 7807 Problem Details document.
```json
{
  "type": "https://developer.hostup.se/errors/invalid_request",
  "title": "Invalid request",
  "status": 400,
  "detail": "The request is invalid.",
  "code": "invalid_request",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 401 - Unauthorized. Authentication is required.
```json
{
  "type": "https://developer.hostup.se/errors/unauthorized",
  "title": "Unauthorized",
  "status": 401,
  "detail": "Authentication is required.",
  "code": "unauthorized",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 403 - Forbidden. The caller lacks a required scope or does not own the resource.
```json
{
  "type": "https://developer.hostup.se/errors/forbidden",
  "title": "Forbidden",
  "status": 403,
  "detail": "The caller lacks a required scope or does not own the resource.",
  "code": "forbidden",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 404 - The database backup is not on this account or is no longer in its list (`backup_not_found`). List the database backups again.
```json
{
  "type": "https://developer.hostup.se/errors/backup_not_found",
  "title": "Database backup not found",
  "status": 404,
  "detail": "The requested database restore point could not be found for this hosting account. List the account's database backups to get valid ids.",
  "code": "backup_not_found",
  "instance": "/api/v2/shared-hosting/acct_01hxa3b4c5d6e7f8g9h0j1k2m3/backups/databases/bkp_01hxa3b4c5d6e7f8g9h0j1k2m3/actions/restore"
}
```

#### 409 - The 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`).
```json
{
  "type": "https://developer.hostup.se/errors/backup_not_restorable",
  "title": "Database backup cannot be restored",
  "status": 409,
  "detail": "This database backup is marked as damaged and cannot be restored.",
  "code": "backup_not_restorable",
  "instance": "/api/v2/shared-hosting/acct_01hxa3b4c5d6e7f8g9h0j1k2m3/backups/databases/bkp_01hxa3b4c5d6e7f8g9h0j1k2m3/actions/restore"
}
```

#### 429 - Rate limited. Retry after the limit resets. 429 responses include `Retry-After` seconds plus `X-RateLimit-*` headers.
```json
{
  "type": "https://developer.hostup.se/errors/rate_limit_exceeded",
  "title": "Too many requests",
  "status": 429,
  "detail": "Rate limit exceeded. Please try again later.",
  "code": "rate_limit_exceeded",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 500 - Internal error. Retry later or contact support if the issue persists.
```json
{
  "type": "https://developer.hostup.se/errors/internal_error",
  "title": "Internal server error",
  "status": 500,
  "detail": "An unexpected error occurred. Retry later or contact support if the issue persists.",
  "code": "internal_error",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```

#### 502 - Upstream failure. A dependent provider request failed; the Problem Details `code` is `upstream_failed`. Retry later or contact support if the issue persists.
```json
{
  "type": "https://developer.hostup.se/errors/upstream_failed",
  "title": "Upstream failure",
  "status": 502,
  "detail": "An upstream provider request failed. Retry later or contact support if the issue persists.",
  "code": "upstream_failed",
  "instance": "/api/v2/resource",
  "requestId": "req_01hxa3b4c5d6e7f8g9h0j1k2m3",
  "timestamp": "2026-04-27T12:34:56.000Z"
}
```
