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

# Saved snapshots

> Save a sandbox under a name, use it as a template for many new sandboxes, make many copies at once, and share it with another account.

A saved snapshot is a copy of a sandbox disk that you save under a name. Each new sandbox that you start from it gets the same disk. Use a saved snapshot as a template: install your tools one time, then start many sandboxes from it.

```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
boat snapshot bx_23456789 web-stack     # save the disk under a name
boat new --from web-stack               # start a new sandbox from it
```

## Automatic and saved snapshots

| | Automatic snapshot | Saved snapshot |
| - | - | - |
| Who makes it | boat, every minute and at each stop | You, with `boat snapshot <id> <name>` |
| Belongs to | One sandbox | Your account or your organization |
| Kept | The newest one while the sandbox runs and **at least 14 days after it stops**. Older ones expire ([details](https://docs.boat.dev/data-retention#how-long-boat-keeps-data)) | No scheduled expiry, even after the sandbox is gone. Unpaid extras can be deleted ([details](https://docs.boat.dev/data-retention#how-long-boat-keeps-data)) |
| Used by | `boat resume`, `boat fork`, `boat snapshot pull` | `boat new --from <name>` |
| Price | Free, no count limit | Included in your plan, then \$0.056 a day each from the wallet ([details](#saved-snapshot-pricing)) |

## Save a saved snapshot

1. Create a sandbox. Install everything: runtimes, packages, your app.
2. Save it with `boat snapshot <id> <name>`. This saves the disk as it is now, under the name.
3. Start each new sandbox with `boat new --from <name>`.

Each deploy is ready in a few seconds. The time and the cost stay about the same, whatever the saved snapshot holds.

```bash CLI theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
boat new                                # install your stack, then:
boat snapshot bx_23456789 web-stack     # save it under a name
boat new --from web-stack               # deploy as many as you want
boat snapshots                          # your saved snapshots, then recent automatic snapshots
boat snapshot rm web-stack              # remove it and release its storage
```

```bash curl theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
curl -sS -X POST "$BOAT_API_BASE/saved-snapshots" \
  -H "Authorization: Bearer $BOAT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"sandboxId":"bx_23456789","name":"web-stack"}'

curl -sS -X POST "$BOAT_API_BASE/sandboxes" \
  -H "Authorization: Bearer $BOAT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"from":"web-stack","environment":"users","env":{"TENANT_ID":"acme"}}'
```

```ts TypeScript theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
await sandbox.saveSavedSnapshot({ sandboxId: "bx_23456789", name: "web-stack" });

// poll until it settles at "ready"
const saved = await sandbox.getSavedSnapshot({ name: "web-stack" });

await sandbox.create({ from: "web-stack", environment: "users", env: { TENANT_ID: "acme" } });

await sandbox.listSavedSnapshots();
await sandbox.deleteSavedSnapshot({ name: "web-stack" });
```

```python Python theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
from boat_sdk.models.saved_snapshot_save_request import SavedSnapshotSaveRequest
from boat_sdk.models.create_sandbox_request import CreateSandboxRequest

sandbox.save_saved_snapshot(SavedSnapshotSaveRequest(sandbox_id="bx_23456789", name="web-stack"))

# poll until it settles at "ready"
saved = sandbox.get_saved_snapshot("web-stack")

sandbox.create(create_sandbox_request=CreateSandboxRequest(
    var_from="web-stack",
    environment="users",
    env={"TENANT_ID": "acme"},
))

sandbox.list_saved_snapshots()
sandbox.delete_saved_snapshot("web-stack")
```

`$BOAT_API_BASE` is `https://boat.dev/api/v1`. In Python, `from` is a reserved word, so the field is `var_from`.

* `current` works only in a terminal that has the boat shell integration. In scripts, pass the sandbox id.
* If the sandbox runs, the save takes a new snapshot of its disk. The call returns at once with status `saving`. The capture runs after that, in the background. A file that is on the disk when you run the command is in the save.
* A write after the call can also land in the save. To save an exact state, wait until `getSavedSnapshot` shows `ready` before you write again.
* If the sandbox is stopped, the save uses its last snapshot.
* The save does not run your [pre-stop command](https://docs.boat.dev/snapshots/stop.md#save-app-state-before-a-stop).
* `boat snapshots` shows the size of each saved snapshot.

Docker containers and every tagged Docker image are in a saved snapshot. The build cache is not. Read [Docker](https://docs.boat.dev/snapshots/whats-saved.md#docker).

### A saved snapshot does not depend on its sandbox

A saved snapshot is a full copy. The source sandbox can change, stop or be deleted. The name still deploys the exact disk that you saved.

A saved snapshot does not expire.

## Make many copies

To start many sandboxes with the same disk, save a saved snapshot one time. Then start each sandbox with `--from`. Do not fork a running sandbox again and again: each fork gets a slightly different disk.

Each start counts against your start limits. Above a limit, the start fails with `429 rate_limited`.

| Plan | Starts per minute / hour / day | Sandboxes at once |
| - | - | - |
| \$20 | 12 / 60 / 200 | 100 |
| \$100 | 30 / 210 / 840 | 300 |
| \$500 | 65 / 420 / 1,680 | 1,000 |
| \$2000 | 90 / 600 / 2,400 | 2,000 |
| [Free trial](https://docs.boat.dev/free-trial.md) | 5 / 25 / 75 | 2 |

The example below paces for the \$20 plan. Change the wait for your plan.

```bash CLI theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
# 50 copies, paced for 12 starts per minute
for i in $(seq 50); do
  boat new --from web-stack --json > "sandbox-$i.json" &
  sleep 5
done
wait
```

```ts TypeScript theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
const ids: string[] = [];
for (let i = 0; i < 50; i++) {
  const created = await sandbox.create({ from: "web-stack" });
  ids.push(created.sandbox.id);
  await new Promise((r) => setTimeout(r, 5000)); // 12 starts per minute
}
```

* To get an answer at once when no machine is free, add `--fail-fast`. Read [Fail fast when no machine is free](https://docs.boat.dev/machines/fail-fast.md).
* To retry a create safely, send an `Idempotency-Key` header. A retry with the same key returns the same sandbox.
* During the free trial, you can run 2 sandboxes at once. Read [Free trial](https://docs.boat.dev/free-trial.md).

## Update a saved snapshot

Save the same name again:

1. Resume the sandbox, or use any sandbox that has the setup you want.
2. Update your tools.
3. Run `boat snapshot <id> <name>` with the same name.

The name now deploys the new disk. boat removes the old copy. Sandboxes that you already deployed do not change.

If the new save fails, the name keeps the last good save.

To keep the old version too, save under a new name, for example `web-stack-v2`.

## Saved snapshots and environments

A saved snapshot holds the **disk**. An [environment](https://docs.boat.dev/environments.md) holds the **settings**. Most setups use both.

| | Saved snapshot | Environment |
| - | - | - |
| Holds | Installed packages, builds, caches | Repositories to clone, secrets, logins |
| Answers | "What is already on this machine?" | "What can this machine use?" |
| Costs | Storage, and a few seconds per deploy | Nothing |
| To change it | Save the name again. Deployed sandboxes do not change | boat makes a new version. Running sandboxes change only when you upgrade them |
| Used at | Deploy, one time | Every start, resume and fork |

A simple rule: what you put in a Dockerfile goes in a saved snapshot. What you put in a `.env` file goes in an environment. Use both together:

```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
boat new --from web-stack --environment users --env TENANT_ID=acme
```

This sandbox starts with your tools installed, none of your logins, and one variable of its own.

> [!WARNING]
>
> A deploy from a saved snapshot does **not** get the **environment** of the source sandbox. It gets the environment from `--environment`, or your default environment. So a saved snapshot that you saved while logged in to your GitHub does not give that access to its deploys.
>
> A deploy **does** get the **per-sandbox variables** of the source, the same as a fork. Each `--env KEY=VALUE` that you gave the source is set on every deploy, unless the deploy sends its own `env`. Do not put a secret in `--env` on a sandbox that you will save as a saved snapshot.

## Saved snapshot pricing

Each account and each organization has included saved snapshots: 10 for every \$20 of plan per seat, and never fewer than 10. A \$100 plan includes 50. You cannot save a snapshot during the free trial. Saved snapshots that you already have stay free. You can keep more. Each saved snapshot above the included count costs \$0.056 a day (\$1.68 for 30 days).

* boat takes this cost each day from your [wallet](https://docs.boat.dev/billing.md#wallet). The plan's included VM time does not pay it.
* When you remove a saved snapshot, it stops costing from the next day.
* A save goes to your active organization, or to the one that you pass with `--org`. All members of an organization share its included saved snapshots. See [Team images](#team-images-saved-snapshots-of-an-organization).
* If a member leaves an organization, the organization keeps the saved snapshots that the member saved for it.
* To save a new saved snapshot above the included count, the wallet needs money. With an empty wallet, the save fails with `credit_required`.
* With [zero data retention](https://docs.boat.dev/data-retention/zero-data-retention.md) on, you cannot save a saved snapshot.

`boat snapshots` shows how many saved snapshots you keep and their monthly cost. The API gives the same numbers in `allowance` on `GET /saved-snapshots`.

### When your wallet is empty

1. Your sandboxes get the usual grace period. Read [Why did my sandbox stop?](https://docs.boat.dev/troubleshooting.md#why-did-my-sandbox-stop).
2. Your saved snapshots above the included count get 7 days.
3. boat sends you an email. It lists these saved snapshots and the date that boat deletes them. boat sends a reminder one day before.
4. If your wallet is still empty on that date, boat deletes them.

boat never deletes your most recent saved snapshots, up to the included count.

To cancel the deletion, add money to the wallet: `boat wallet pay 20`. You can also remove saved snapshots until you are at or below the included count.

## Team images: saved snapshots of an organization

A saved snapshot that you save under an organization belongs to the organization. Every member sees it in `boat snapshots` and starts sandboxes from it. No share code is necessary.

```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
boat --org acme snapshot bx_23456789 web-stack   # save it for the organization
boat --org acme new --from web-stack             # any member deploys it
```

* The name counts on the organization's allowance, not on yours.
* Any member can save the name again to update it.
* The member who saved it, or an owner or admin of the organization, can remove it or make a share code.
* It holds the disk of the member who saved it. If that member turns on zero data retention or deletes their account, boat deletes it. If the member only leaves the organization, the organization keeps it.
* A sandbox that a teammate deploys gets none of your logins. Before it opens, boat removes your Claude, Codex and GitHub logins, your SSH keys and your environment secret files from its disk. The teammate's own environment then applies. Files that you cloned yourself stay.
* Saved snapshots that you saved before 2026-10-22 under `--org` stay personal. Save them again under `--org` to make them team images.

## Share a saved snapshot with another account

A share code lets another boat account deploy one of your saved snapshots. The other account runs `boat new --from <code>`. The new sandbox is in their account, and they pay for it.

A share has two values:

| Value | Prefix | Use |
| - | - | - |
| Share code | `bsh_...` | The secret that you give out. The other account deploys with it |
| Share id | `shr_...` | Not secret. You use it to revoke the code |

1. Create the source sandbox.
2. Install your tools and save them: `boat snapshot <id> <name>`.
3. Make a code: `boat snapshot share <name>`. Give the `bsh_...` code to the other account.

```bash CLI theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
boat snapshot share web-stack              # prints the bsh_... code one time only
boat snapshot shares web-stack             # list share ids (shr_...), use counts, status
boat snapshot unshare web-stack shr_...    # revoke one code, by its share id

# in the other account
boat new --from bsh_...
```

```bash curl theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
curl -sS -X POST "$BOAT_API_BASE/saved-snapshots/web-stack/shares" \
  -H "Authorization: Bearer $BOAT_API_KEY"

curl -sS "$BOAT_API_BASE/saved-snapshots/web-stack/shares" \
  -H "Authorization: Bearer $BOAT_API_KEY"

curl -sS -X DELETE "$BOAT_API_BASE/saved-snapshots/web-stack/shares/shr_..." \
  -H "Authorization: Bearer $BOAT_API_KEY"

# in the other account
curl -sS -X POST "$BOAT_API_BASE/sandboxes" \
  -H "Authorization: Bearer $BOAT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"from":"bsh_..."}'
```

```ts TypeScript theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
const { shareCode, share } = await sandbox.createSnapshotShare({ name: "web-stack" });

await sandbox.listSnapshotShares({ name: "web-stack" });
await sandbox.revokeSnapshotShare({ name: "web-stack", shareId: share.id });

// in the other account
await sandbox.create({ from: shareCode });
```

```python Python theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
from boat_sdk.models.create_sandbox_request import CreateSandboxRequest

created = sandbox.create_snapshot_share("web-stack")

sandbox.list_snapshot_shares("web-stack")
sandbox.revoke_snapshot_share("web-stack", created.share.id)

# in the other account
sandbox.create(create_sandbox_request=CreateSandboxRequest(var_from=created.share_code))
```

* boat shows the code one time only, when you make it. boat keeps only a hash of the code.
* If you lose a code, revoke it and make a new one.
* A code has 256 random bits. Nobody can guess it.

> [!WARNING]
>
> Before the other account can use its sandbox, boat removes these from the disk: your logins and API keys, the secret files of your environment, your repository clones, and your SSH authorized keys.
>
> boat shares everything else on the disk. This includes secrets that you wrote into files yourself.

The other account gets:

* A sandbox in their account, which they pay for.
* None of your per-sandbox variables. Their own environment applies, as with any `boat new`. To use no environment, they send `noEnv: true` (`--no-env`).

What happens to a code over time:

| You do this | Result |
| - | - |
| Save the same name again | The code deploys the new save |
| Revoke the code | New deploys with the code fail. Sandboxes made before keep their copy |
| Remove the name | boat removes its codes too. Sandboxes made before keep their copy |
| Delete your account | Sandboxes made from your codes keep their copy |

A wrong or revoked code fails with `404 snapshot_not_found`.

API keys need these scopes:

| Action | Scope |
| - | - |
| Make or revoke a code | `snapshot.write` |
| List codes | `snapshot.read` |
| Deploy from a code | `sandbox.create` and `snapshot.read`, the same as any `from` |


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