> ## 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 an application 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>

Restore Snapshot rolls an application's storage back to a previous [snapshot](/en/api-reference/endpoint/apps/snapshots/create), replacing its current files with the ones captured at snapshot time. Use it to recover from a bad deploy or accidental deletion. Get the `snapshotId` and `versionId` values from [List Snapshots](/en/api-reference/endpoint/apps/snapshots/list), they are not something you construct by hand.

`snapshotId` must be a UUID v4 and `versionId` must match the S3 version-key format; malformed values are rejected before the restore is dispatched. Restoring does not itself restart the application, run [Restart Application](/en/api-reference/endpoint/apps/restart) afterward if the running process needs to pick up the restored files.

Snapshots (and therefore restores) are only available on paid plans. On workspace-shared applications the caller needs the Administrator role.

### Parameters

<ParamField path="app_id" type="string" placeholder="Application ID" required>
  The ID of the application. You can find this in the URL of your application's dashboard.
</ParamField>

<ParamField body="snapshotId" type="string" placeholder="Snapshot ID" required>
  The ID of the snapshot to restore for this application (app\_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` is missing.                         |
| `INVALID_SNAPSHOT_ID`     | 400  | `snapshotId` is not a valid UUID v4.                            |
| `INVALID_VERSION_ID`      | 400  | `versionId` does not match the expected S3 version-key format.  |
| `SNAPSHOT_NOT_FOUND`      | 404  | No snapshot exists at that ID and version for this application. |
| `USER_NOT_FOUND`          | 404  | The application's owner could not be resolved.                  |
| `SNAPSHOT_RESTORE_FAILED` | 404  | The cluster could not dispatch the restore.                     |
