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

# Restore Snapshot

> Restore a database based on a snapshot of it.

<Warning>This route has a rate limit of 1 request every 60 seconds.</Warning>

<ParamField header="Authorization" type="string" placeholder="API Key" required>
  The API key for your account. You can find this in your [account settings](https://squarecloud.app/en/account/security).
</ParamField>

Restores a database in-place from a previously taken snapshot, identified by the `snapshotId` and `versionId` returned from [Create Snapshot](/en/api-reference/endpoint/databases/snapshots/create) or [List Snapshots](/en/api-reference/endpoint/databases/snapshots/list). The snapshot's engine must match the target database's `type`, you cannot restore a Redis snapshot onto a MongoDB database, for example.

This overwrites the database's current data with the snapshot's contents; there is no undo beyond taking another snapshot first. While the restore is running, [Start](/en/api-reference/endpoint/databases/start), [Stop](/en/api-reference/endpoint/databases/stop) and [Delete Database](/en/api-reference/endpoint/databases/delete) are rejected for that database. Rate limited to 1 restore per 60 seconds per user, and 1 restore per 120 seconds per database.

### Parameters

<ParamField path="database_id" type="string" placeholder="Database ID" required>
  The ID of the database.
</ParamField>

<ParamField body="snapshotId" type="string" placeholder="Snapshot ID" required>
  The ID of the snapshot to restore for this database (database\_id).
</ParamField>

<ParamField body="versionId" type="string" placeholder="Snapshot Version Key" required>
  The version key of the snapshot.
</ParamField>

### Response

<ResponseField name="status" type="string">
  Indicates whether the call was successful.. `success` if successful, `error` if not.
</ResponseField>

<ResponseExample>
  ```json theme={null}
  {
    "status":"success"
  }
  ```
</ResponseExample>

### Common errors

| Code                         | HTTP | Meaning                                                        |
| ---------------------------- | ---- | -------------------------------------------------------------- |
| `MISSING_PARAMETERS`         | 400  | `snapshotId` or `versionId` was not provided.                  |
| `INVALID_SNAPSHOT_ID`        | 400  | `snapshotId` is not a valid UUID v4.                           |
| `INVALID_VERSION_ID`         | 400  | `versionId` does not match the expected format.                |
| `SNAPSHOT_DATABASE_MISMATCH` | 400  | The snapshot's engine does not match this database's `type`.   |
| `SNAPSHOT_NOT_FOUND`         | 404  | No snapshot exists for the given `snapshotId` and `versionId`. |
| `DATABASE_NOT_FOUND`         | 404  | The database does not exist or is not owned by the caller.     |
| `SNAPSHOT_RESTORE_FAILED`    | 404  | The cluster rejected the restore operation.                    |
