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

> Roll an application's files back to a snapshot with POST /v2/apps/{app_id}/snapshots/restore, using the snapshotId and versionId from the list.

<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>

Requires an API key with the `snapshots:write` [scope](/en/api-reference/authentication#scopes).

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` is the snapshot `name` exactly as [List Snapshots](/en/api-reference/endpoint/apps/snapshots/list) returns it (the application ID, optionally suffixed with `_<runtime>` and `_<origin>`), and `versionId` must match the S3 version-key format; malformed values are rejected before the restore is dispatched. The restore stops the application, replaces its files with the snapshot's and starts it again, so no separate restart is needed. While it runs (up to about 2 minutes), [start](/en/api-reference/endpoint/apps/start), [stop](/en/api-reference/endpoint/apps/stop), [restart](/en/api-reference/endpoint/apps/restart) and delete answer `403 RESTORE_IN_PROGRESS`.

Snapshots (and therefore restores) are only available with an active plan. On workspace-shared applications the caller needs the `admin` [role](/en/api-reference/endpoint/workspace/members/invite#roles).

## 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 snapshot `name` from the listing (the application ID, optionally suffixed with `_<runtime>` and `_<origin>`), passed exactly as returned.
</ParamField>

<ParamField body="versionId" type="string" placeholder="Snapshot Version Key" required>
  The snapshot's `version_id`, as [List Snapshots](/en/api-reference/endpoint/apps/snapshots/list) returns it.
</ParamField>

## Response

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

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

## Common errors

| Code | HTTP | Meaning |
| - | - | - |
| `MISSING_PARAMETERS` | 400 | `snapshotId` or `versionId` is missing. |
| `INVALID_SNAPSHOT_ID` | 400 | `snapshotId` is not a snapshot name as returned by the listing (an ID, optionally with up to two `_<tag>` suffixes). |
| `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. |
| `APP_NOT_FOUND` | 404 | The application does not exist, or its owner no longer exists. |
| `SNAPSHOT_RESTORE_FAILED` | 404 | The restore failed. This is the only failure code; `SNAPSHOT_NOT_FOUND` means the snapshot does not exist. |

## Related

* CLI: [`squarecloud app snapshot restore`](/en/cli-reference/snapshots#squarecloud-app-snapshot-restore)
* SDKs: [`api.apps.snapshots.restore()`](/en/sdks/js/snapshots) (JavaScript), [`client.apps.snapshots.restore()`](/en/sdks/py/snapshots) (Python), [`c.Apps.Snapshots.Restore()`](/en/sdks/go/snapshots) (Go)


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