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

# Back up and restore snapshots from the CLI

> Create, download, list and restore snapshots of Square Cloud applications and databases with squarecloud app snapshot and squarecloud db snapshot.

A snapshot is a backup of an application's files or a database's data. `squarecloud app snapshot` and `squarecloud db snapshot` work the same way: `create` makes one, `list` shows the ones stored, `restore` puts one back.

For `create`, the app ID is optional: see [how the CLI finds your app](/en/cli-reference/quickstart#how-the-cli-finds-your-app). The database ID is optional too: without it, the CLI opens a picker of your databases.

## `squarecloud app snapshot create`

```bash Usage theme={"system"}
squarecloud app snapshot create [appID] [--download]
```

| Flag | Description |
| - | - |
| `--download` | Saves the snapshot in the current folder as `Square Cloud - Snapshot <date> <time>.zip` instead of printing a download link. |

```bash theme={"system"}
squarecloud app snapshot create --download
```

```bash Output theme={"system"}
✓ Your snapshot was created. Download it at:
  <download link>
```

For a large application, the snapshot can still be generating when the command returns: the CLI says so, and the snapshot shows up in `snapshot list` in a few minutes. A download is saved readable only by you (0600 permissions), and a failed `--download` removes the partial file.

## `squarecloud app snapshot list`

```bash Usage theme={"system"}
squarecloud app snapshot list [snapshotID] [--json]
```

Without an argument, prints one row per snapshot of your applications, with the snapshot ID, how many versions it has, their total size and the last update. Recent snapshot IDs start with the application ID and end with tags such as `_javascript_manual`.

Pass a snapshot ID from that list to see its versions and their **version IDs**, which `restore` needs:

```bash theme={"system"}
squarecloud app snapshot list <snapshotID>
# One row per version: snapshot ID, version ID, size, last update.
```

With `--json`, the output keeps the same filter. Listing snapshots needs an active plan.

## `squarecloud app snapshot restore`

```bash Usage theme={"system"}
squarecloud app snapshot restore <appID> <snapshotID> <versionID> [-y]
```

| Flag | Description |
| - | - |
| `-y`, `--yes` | Skips the confirmation prompt. |

Replaces the application's current files with a snapshot version. Take `<snapshotID>` and `<versionID>` from [`app snapshot list`](#squarecloud-app-snapshot-list). It asks for `y/N` confirmation first.

```bash Output theme={"system"}
✓ Restore started successfully
```

## `squarecloud db snapshot create`

```bash Usage theme={"system"}
squarecloud db snapshot create [dbID] [--download]
```

| Flag | Description |
| - | - |
| `--download` | Saves the snapshot in the current folder as `Square Cloud - DB Snapshot <date> <time>.zip` instead of printing a download link. |

Works like `app snapshot create`, for a database.

## `squarecloud db snapshot list`

```bash Usage theme={"system"}
squarecloud db snapshot list [snapshotID] [--json]
```

Without an argument, one row per snapshot of your databases. With a snapshot ID, one row per version, with the version IDs `restore` takes.

## `squarecloud db snapshot restore`

```bash Usage theme={"system"}
squarecloud db snapshot restore <dbID> <snapshotID> <versionID> [-y]
```

| Flag | Description |
| - | - |
| `-y`, `--yes` | Skips the confirmation prompt. |

Replaces the database's current data with a snapshot version, after a `y/N` confirmation.

## Related

| Command | API | JavaScript SDK | VS Code |
| - | - | - | - |
| `app snapshot create` | [`POST .../snapshots`](/en/api-reference/endpoint/apps/snapshots/create) | [`api.apps.snapshots.create()`](/en/sdks/js/snapshots) | [Download snapshot](/en/vscode-extension/features#applications) |
| `app snapshot list` | [`GET /v2/users/snapshots`](/en/api-reference/endpoint/users/snapshots) | [`api.account.snapshots()`](/en/sdks/js/client) | [Restore snapshot](/en/vscode-extension/features#applications) |
| `app snapshot restore` | [`POST .../snapshots/restore`](/en/api-reference/endpoint/apps/snapshots/restore) | [`api.apps.snapshots.restore()`](/en/sdks/js/snapshots) | [Restore snapshot](/en/vscode-extension/features#applications) |
| `db snapshot create` | [`POST .../snapshots`](/en/api-reference/endpoint/databases/snapshots/create) | [`api.databases.snapshots.create()`](/en/sdks/js/snapshots) | |
| `db snapshot list` | [`GET /v2/users/snapshots`](/en/api-reference/endpoint/users/snapshots) | [`api.account.snapshots()`](/en/sdks/js/client) | |
| `db snapshot restore` | [`POST .../snapshots/restore`](/en/api-reference/endpoint/databases/snapshots/restore) | [`api.databases.snapshots.restore()`](/en/sdks/js/snapshots) | |
