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

# Zero data retention

> Read and enable zero data retention (ZDR): boat deletes the data of each sandbox when it stops. How it works in an organization.

With zero data retention (ZDR), boat deletes the data of each sandbox when it stops. You cannot resume or fork a sandbox after it stops.

ZDR is a setting of your own account. In an organization, each member turns it on for the sandboxes that they create. Read [Organizations](#organizations).

## Read the setting

You can read the setting from anywhere. An API key works.

```bash CLI theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
boat data-retention status
```

```bash curl theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
curl -sS "$BOAT_API_BASE/account/data-retention" \
  -H "Authorization: Bearer $BOAT_API_KEY"
```

```ts TypeScript theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
const policy = await sandbox.getDataRetention();
console.log(policy.enabled);
```

```python Python theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
policy = sandbox.get_data_retention()
print(policy.enabled)
```

`$BOAT_API_BASE` is `https://boat.dev/api/v1`. `GET /me` also returns the setting, in the `zeroDataRetention` fields.

## Enable zero data retention

> [!WARNING]
>
> To **change** the setting, you need a browser sign-in session. An API key does not work. Run `boat login` without a key first, or use the dashboard. An SDK client that uses `BOAT_API_KEY` gets `403 session_required`. This is on purpose. Enabling ZDR deletes the data of every stopped sandbox, so a leaked API key must never reach it.

1. Sign in with a browser session. Run `boat login` without a key, or open the dashboard.
2. Send the exact phrase `delete archived sandbox data` as the confirmation. "Archived" is the API name of a stopped sandbox.

```bash CLI theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
boat data-retention enable          # prompts for the confirmation phrase
boat data-retention enable --yes    # skip the prompt
```

```bash curl theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
curl -sS -X PATCH "$BOAT_API_BASE/account/data-retention" \
  -H "Authorization: Bearer $BOAT_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"enabled":true,"confirmation":"delete archived sandbox data"}'
```

```ts TypeScript theme={"theme":{"light":"github-light","dark":"github-dark-default"}}
// Requires a browser session token, not an API key.
await sandbox.updateDataRetention({
  enabled: true,
  confirmation: "delete archived sandbox data",
});
```

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

# Requires a browser session token, not an API key.
sandbox.update_data_retention(DataRetentionUpdateRequest(
    enabled=True,
    confirmation="delete archived sandbox data",
))
```

In the dashboard, the toggle is under **Data & privacy** on the [Account](https://boat.dev/dashboard?tab=account) tab.

## What happens when ZDR is on

* boat queues the data of your stopped sandboxes for deletion.
* Each sandbox deletes its data when it stops. This includes auto-stop and a stop for an empty wallet.
* boat removes your saved snapshots and queues their data for deletion. You cannot save a new saved snapshot.
* Accepted deletions continue in the background until boat checks that they are complete.

> [!WARNING]
>
> You cannot cancel a deletion operation. If you disable ZDR, only future stops change. Operations that boat already accepted continue.

ZDR still snapshots a sandbox while it runs. boat uses these snapshots to rebuild a sandbox after a machine fails. To keep nothing at all, turn [snapshots off](https://docs.boat.dev/data-retention/snapshots-and-monitoring-off.md#snapshots-off).

## Organizations

| Question | Answer |
| - | - |
| Who turns ZDR on? | Each person, for their own account. An organization has no ZDR setting of its own |
| Which sandboxes does it cover? | Every sandbox that you create, also the ones that an organization pays for |
| Does it cover sandboxes of other members? | No. Each member turns it on for their own sandboxes |
| Does it need a role? | No. Any member can turn it on for their own account |

To cover a whole team, ask each member to turn ZDR on. Check each account with `boat data-retention status`.

The same rule applies to [snapshots off and monitoring off](https://docs.boat.dev/data-retention/snapshots-and-monitoring-off.md).


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