> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dbhost.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Restore a database from a DBHost backup

> Restore a DBHost database in place from one of its own verified backups, from the dashboard or the API, and what to expect during the cutover.

You can restore a database in place from a backup that DBHost made of **that
same database**. The restore replaces the current contents, so any writes made
after the backup was taken are gone afterwards.

To load a dump from somewhere else, see
[Restore your own dump](/guides/restore-your-own-dump) instead.

<Note>
  In-place restore is available for every database. To load a dump from
  somewhere else, download the backup and
  [restore your own dump](/guides/restore-your-own-dump).
</Note>

## Before you start

* Only the database owner (or an admin, in the dashboard) can restore.
* Pick a backup that is listed for the database and is less than 30 days old;
  see [Backups and retention](/backups-and-retention).
* Expect a short cutover. Open connections are dropped and your app must
  reconnect. Plan a quiet moment or a maintenance window.

DBHost restores into an isolated copy first, verifies it, and takes a fresh
backup of the current database before it switches over. If verification
fails, the current database is left unchanged.

## From the dashboard

1. Open the database and go to **Backups**.
2. Choose **Restore** on a verified backup.
3. Confirm. The page shows progress until the operation finishes.

The dashboard shows **Restore** when it can restore that database, which
includes databases with managed SQL roles. If the button is not shown, use the
API flow below.

## With the API

API access requires Pro or Business. The additional-roles and managed SQL roles
routes also need a full-account API key; a key scoped to selected databases
gets `403 KEY_SCOPE_DENIED`. List backups first to find the `filename` and,
where present, the backup `id`:

```bash theme={null}
curl -H "Authorization: Bearer $DBHOST_API_KEY" \
  https://dbhost.app/api/v1/databases/<database-id>/backups
```

Then use the route that matches the database:

| Database | Route |
| - | - |
| Single login, no additional roles | [`POST /api/v1/databases/{id}/backups/{filename}`](/api-reference/backups/restore) |
| Single login with additional roles | `POST /api/v1/databases/{id}/legacy-overlay-restores`; see [Restore a v4 backup](/api-reference/databases/additional-roles#restore-a-v4-backup) |
| Managed SQL roles | `POST /api/v1/databases/{id}/managed-restores` with `{"backupId":"..."}` and an `Idempotency-Key`, then `POST /api/v1/operations/{operationId}/managed-restore/advance` until it succeeds |

Send an `Idempotency-Key` header with a value you generate and keep, on every
route, including the first request:

```bash theme={null}
curl -X POST \
  -H "Authorization: Bearer $DBHOST_API_KEY" \
  -H "Idempotency-Key: restore-2026-10-14-orders" \
  https://dbhost.app/api/v1/databases/<database-id>/backups/<filename>
```

Every route returns an operation. Poll
[`GET /api/v1/operations/{id}`](/api-reference/operations/get) until its
status is `succeeded` or `failed`. If a request times out, retry with the same
`Idempotency-Key` to get the original operation back. Without it, a retry can
start a second restore that overwrites writes made after the first one.

The CLI has no restore command.

## After the restore

* Check that your application reconnects and its queries work.
* Logins and passwords stay the same; you do not need a new connection string.
* A database that has additional roles can only be restored from a backup
  taken after the opt-in. Older backups do not contain those roles.

## Limits

* No point-in-time recovery: you can restore to a backup, not to an arbitrary
  moment.
* You cannot restore one database's backup into a different database.
* Cloning a database that has additional roles returns
  `409 LEGACY_OVERLAY_REQUIRES_V4`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.