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

# Resume, fork and restore

> Get a stopped sandbox back, copy a sandbox, and get files from an older snapshot back. Resume and fork always use the newest snapshot.

Resume and fork both start a machine from the **newest** snapshot of a sandbox.

| | Resume | Fork |
| - | - | - |
| You get | The same sandbox, with the same id | A new sandbox, with a new id |
| The source sandbox | Is the sandbox | Keeps running. boat does not change it |
| Use it to | Continue your work after a stop | Try something risky, start a second branch of work, give one sandbox to each of your users |

To deploy many sandboxes from one fixed state, use a [saved snapshot](https://docs.boat.dev/snapshots/templates.md) instead of forks.

## Resume

A resume brings a stopped sandbox back on a new machine. The sandbox keeps its id and its disk.

```bash CLI theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
boat resume bx_f7k2q9hd
boat resume bx_f7k2q9hd --type large      # different size: small, default, large or xlarge
boat resume bx_f7k2q9hd --ttl 7200        # new lifetime, in seconds
boat resume bx_f7k2q9hd --no-auto-stop    # runs until you stop it
```

```bash curl theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
curl -sS -X POST "$BOAT_API_BASE/sandboxes/bx_f7k2q9hd/resume" \
  -H "Authorization: Bearer $BOAT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"type":"large","ttlSeconds":7200}'
```

```ts TypeScript theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
await sandbox.resume({
  sandboxId: "bx_f7k2q9hd",
  type: "large", ttlSeconds: 7200,
});
```

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

sandbox.resume(sandbox_id="bx_f7k2q9hd", resume_request=ResumeRequest(type="large", ttl_seconds=7200))
```

`$BOAT_API_BASE` is `https://boat.dev/api/v1`.

* Every stop makes the snapshot that a resume needs: `boat stop`, auto-stop, and a stop for an empty wallet. Only `boat stop --force` and [snapshots off](https://docs.boat.dev/data-retention/snapshots-and-monitoring-off.md#snapshots-off) skip it.
* boat keeps the snapshot of a stopped sandbox for at least 14 days. After that, automated retention cleanup can delete it once enabled. Resume and fork fail with `409 snapshot_data_expired` once deletion completes. Save a [saved snapshot](https://docs.boat.dev/snapshots/templates.md) before day 14 to keep the disk longer. Read [Keep a stopped sandbox longer than 14 days](https://docs.boat.dev/snapshots/stop.md#keep-a-stopped-sandbox-longer-than-14-days).
* A sandbox in `error` can also resume. It comes back from its newest snapshot. Read [A sandbox is in error](https://docs.boat.dev/troubleshooting.md#a-sandbox-is-in-error).
* To change the size, stop the sandbox first. Then resume with `--type`. A resume of a running sandbox with a new `--type` fails.
* You can resume on a smaller size. If the sandbox has more data than the smaller size can hold, boat refuses the resume and does not change the sandbox. Read [Machines](https://docs.boat.dev/machines.md).
* If you do not send `ttlSeconds`, the sandbox keeps its current lifetime.
* To turn auto-stop off, send `null` (`--no-auto-stop`).
* `boat resume` waits until the sandbox runs a command. Then it returns. To return at once, add `--no-wait`.
* The IP address changes at every resume.

What works at `ready`, and what comes a few seconds later, is in [Readiness and resume speed](https://docs.boat.dev/readiness.md).

## Fork

A fork copies a sandbox into a new sandbox. The source keeps running, and boat does not change it.

```bash CLI theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
boat fork bx_f7k2q9hd
boat fork bx_f7k2q9hd --type small
boat fork bx_f7k2q9hd --ttl 600         # lifetime for the fork, in seconds
boat fork bx_f7k2q9hd --no-auto-stop    # runs until you stop it
```

```bash curl theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
curl -sS -X POST "$BOAT_API_BASE/sandboxes/bx_f7k2q9hd/fork" \
  -H "Authorization: Bearer $BOAT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"type":"small","ttlSeconds":600}'
```

```ts TypeScript theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
const forked = await sandbox.fork({
  sandboxId: "bx_f7k2q9hd",
  type: "small", ttlSeconds: 600,
});
```

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

forked = sandbox.fork(sandbox_id="bx_f7k2q9hd", fork_request=ForkRequest(type="small", ttl_seconds=600))
```

> [!WARNING]
>
> A fork of a **running** sandbox uses its last background snapshot. boat takes one each minute. Writes from the last minute or so can be missing from the fork.
>
> For an exact copy, save a saved snapshot first: `boat snapshot <id> <name>`. A save of a running sandbox takes a new snapshot at that moment. Then run `boat new --from <name>`. A fork of a **stopped** sandbox has everything, because the stop took the last snapshot.

What the fork gets from the source:

* The whole disk, as it was at the newest snapshot.
* The per-sandbox variables of the source. If you send your own `env`, the fork uses yours.
* The exact environment version of the source. Read [Environments](https://docs.boat.dev/environments.md).

What the fork does not get:

* The lifetime of the source. A fork stops after 1 hour by default, even if the source has auto-stop turned off. To change this, send `ttlSeconds` or use `--no-auto-stop`.
* A per-sandbox setup script (`--setup-file`) of the source. That script runs one time, on the sandbox that you created with it.

To make many copies at once, read [Make many copies](https://docs.boat.dev/snapshots/templates.md#make-many-copies).

## Restore an older snapshot (roll back)

Resume and fork always use the newest snapshot. **You cannot resume or fork an older snapshot.** There is no point-in-time restore.

The snapshot list of a sandbox holds only recent snapshots. boat removes older ones, usually within a day. Read [How long boat keeps data](https://docs.boat.dev/data-retention#how-long-boat-keeps-data).

To get files back from an older snapshot that is still in the list:

1. Find the snapshot: `boat snapshots <sandboxId>`.
2. Download its files: `boat snapshot pull <snapshotId> -o ./old`. Or download one path. Read [Download a snapshot](https://docs.boat.dev/snapshots/download-and-delete.md).
3. Copy the files into the sandbox: `boat scp`.

To keep states that you can go back to, save a saved snapshot at each point. A saved snapshot has no scheduled expiry, but unpaid extras can be deleted. For example, save one each day from cron:

```bash theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
boat snapshot bx_f7k2q9hd "daily-$(date +%F)"
```

Then start a sandbox from any of them with `boat new --from daily-2026-10-12`. Your plan includes some saved snapshots at no cost. Read [Saved snapshot pricing](https://docs.boat.dev/snapshots/templates.md#saved-snapshot-pricing).

## How fast a sandbox comes back

A resume, a fork or a deploy is ready in a few seconds, whatever the size of the disk. boat downloads your files in the background. What works at `ready`, how to wait for the rest, and how to make the first start faster are in [Readiness and resume speed](https://docs.boat.dev/readiness.md).

## No machine free

A resume or a fork waits for a machine when none is free. To get an answer at once instead, read [Fail fast when no machine is free](https://docs.boat.dev/machines/fail-fast.md).


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