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

# Download and delete

> Look inside a snapshot, download its files, see how long Boat keeps snapshots, and delete a sandbox and its data.

## Look inside and download

<CodeGroup>
  ```bash CLI theme={null}
  boat snapshots                                 # across your sandboxes
  boat snapshot latest bx_f7k2q9hd
  boat snapshot tree <snapshotId>                # files + sizes
  boat snapshot pull <snapshotId> -o ./restore   # download and reassemble
  ```

  ```bash curl theme={null}
  curl -sS "$BOAT_API_BASE/snapshots" \
    -H "Authorization: Bearer $BOAT_API_KEY"
  curl -sS "$BOAT_API_BASE/sandboxes/bx_f7k2q9hd/snapshots/latest" \
    -H "Authorization: Bearer $BOAT_API_KEY"
  curl -sS "$BOAT_API_BASE/snapshots/<snapshotId>/tree" \
    -H "Authorization: Bearer $BOAT_API_KEY"

  # grab one file (or a folder as .tar) straight from a snapshot; sandbox can be stopped
  curl -sS "$BOAT_API_BASE/snapshots/<snapshotId>/files?path=projects/app/.env" \
    -H "Authorization: Bearer $BOAT_API_KEY" -o .env
  curl -sS "$BOAT_API_BASE/snapshots/<snapshotId>/files?path=projects/app" \
    -H "Authorization: Bearer $BOAT_API_KEY" -o app.tar
  ```

  ```ts TypeScript theme={null}
  await sandbox.listSnapshots();                                   // across your sandboxes
  await sandbox.listSandboxSnapshots({ sandboxId: "bx_f7k2q9hd" });        // one sandbox's history
  await sandbox.getLatestSandboxSnapshot({ sandboxId: "bx_f7k2q9hd" });
  await sandbox.getSnapshotTree({ snapshotId: "<snapshotId>" });   // files + sizes

  const file = await sandbox.getSnapshotFile({
    snapshotId: "<snapshotId>",
    path: "projects/app/.env",
  });
  const archive = await sandbox.getSnapshotDownload({ snapshotId: "<snapshotId>" });
  ```

  ```python Python theme={null}
  sandbox.list_snapshots()                          # across your sandboxes
  sandbox.list_sandbox_snapshots("bx_f7k2q9hd")         # one sandbox's history
  sandbox.get_latest_sandbox_snapshot("bx_f7k2q9hd")
  sandbox.get_snapshot_tree("<snapshotId>")         # files + sizes

  file = sandbox.get_snapshot_file("<snapshotId>", path="projects/app/.env")
  archive = sandbox.get_snapshot_download("<snapshotId>")
  ```
</CodeGroup>

`pull` writes two folders:

* `home_user/`: your `/home/user`.
* `docker/`: your Docker named volumes.

They hold the files exactly as they were at that snapshot.

The SDKs have no `pull`. Use `getSnapshotDownload`, then put the files together on your computer.

You can also see the files, and download them, in the [Snapshots](https://boat.dev/dashboard?tab=snapshots) tab of the dashboard.

For all calls, read the [Snapshots API](/api/reference/snapshots/list-snapshots).

## How long Boat keeps snapshots

* Boat keeps the snapshots of a stopped sandbox for the life of the sandbox. You can resume or fork it after one day or after many months.
* Boat removes old snapshots when new ones replace them.
* With [zero data retention](/data-retention), Boat deletes the data of stopped sandboxes and named snapshots. It does not keep them.

## Delete a sandbox

A stop keeps the snapshots. A **delete** removes them.

<Warning>
  A delete stops the sandbox and deletes its snapshots for good. You cannot resume it, fork it or get it back. There is no list of deleted sandboxes.

  **If you want to use the data later, stop the sandbox. Do not delete it.** A stopped sandbox costs nothing and keeps its disk.
</Warning>

<CodeGroup>
  ```bash CLI theme={null}
  boat stop bx_f7k2q9hd            # keeps the data; `boat resume` brings it back
  boat delete bx_f7k2q9hd          # deletes the sandbox AND its snapshots, permanently
  boat delete bx_f7k2q9hd --yes    # same, without the confirmation prompt
  ```

  ```bash curl theme={null}
  curl -sS -X DELETE "$BOAT_API_BASE/sandboxes/bx_f7k2q9hd" \
    -H "Authorization: Bearer $BOAT_API_KEY" \
    -H "X-Ascii-Confirm-Delete: bx_f7k2q9hd"
  ```

  ```ts TypeScript theme={null}
  await sandbox.deleteSandbox({
    sandboxId: "bx_f7k2q9hd",
    xAsciiConfirmDelete: "bx_f7k2q9hd",
  });
  ```

  ```python Python theme={null}
  sandbox.delete_sandbox(
      x_ascii_confirm_delete="bx_f7k2q9hd",
      sandbox_id="bx_f7k2q9hd",
  )
  ```
</CodeGroup>

* Each delete must name its sandbox. `X-Ascii-Confirm-Delete` must be the exact sandbox id. If it is not, Boat refuses the request with `409` and deletes nothing.
* A delete gives you an operation to follow. Read [Data retention and deletion](/data-retention).
* You can also delete a sandbox from the `⋯` menu on its row in the [dashboard](https://boat.dev/dashboard?tab=sandboxes).
* The sandbox leaves your account at once. Boat deletes the snapshot data when the machine has shut down.

### What a delete keeps

Sandboxes can share snapshot data. A fork, a resume and a template deploy read the same data as their source. So a delete removes only the data that nothing else uses. Boat keeps:

* The data that a fork or a resume of this sandbox still needs.
* Your **named snapshots** from this sandbox. They exist to outlive it. To remove one, run `boat snapshot rm <name>`.

Boat frees the storage when no sandbox and no named snapshot uses it.

When you remove a named snapshot, Boat deletes its data at least six hours later. This lets upload links that Boat already gave out expire first.


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