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

# Auto-stop

> Turn off auto-stop, read the auto-stop deadline, and extend a sandbox with a timed deadline.

Every sandbox has an auto-stop timer.

* The default is 1 hour.
* The timer counts from creation, not from your last activity.
* A sandbox with a 1 hour TTL stops one hour after it starts, even in the middle of work.
* A resume of a stopped sandbox starts the timer again.

<Note>
  Everything on this page needs a payment method on the account. On the free trial, you cannot turn off auto-stop. The TTL also cannot be more than 2 hours. Boat refuses the call with `trial_auto_stop_required`. See [Pricing](/pricing#concurrency).
</Note>

## Turn off auto-stop

Use this when the sandbox must run until you stop it yourself. Examples are demos, browser sessions, long setup jobs and unattended workflows. A stop interrupts this work, and you must then start the processes again.

Turn off auto-stop when you create the sandbox. For a sandbox that exists, set its TTL to `null`.

<CodeGroup>
  ```bash CLI theme={null}
  boat new --no-auto-stop
  boat extend bx_f7k2q9hd --no-auto-stop
  ```

  ```bash curl theme={null}
  curl -sS -X POST "$BOAT_API_BASE/sandboxes" \
    -H "Authorization: Bearer $BOAT_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"ttlSeconds":null}'

  curl -sS -X PATCH "$BOAT_API_BASE/sandboxes/bx_f7k2q9hd" \
    -H "Authorization: Bearer $BOAT_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"ttlSeconds":null}'
  ```

  ```ts TypeScript theme={null}
  const created = await sandbox.create({ ttlSeconds: null });

  await sandbox.update({
    sandboxId: "bx_f7k2q9hd",
    ttlSeconds: null,
  });
  ```

  ```python Python theme={null}
  created = sandbox.create(CreateSandboxRequest(ttl_seconds=None))

  sandbox.update("bx_f7k2q9hd", UpdateSandboxRequest(ttl_seconds=None))
  ```
</CodeGroup>

You can also select **No auto-stop** in the dashboard.

### TTL on resume and fork

`resume` and `fork` also accept `ttlSeconds`. Thus a sandbox that comes back does not need a second call to set its lifetime.

| Call | When you do not give `ttlSeconds` |
| - | - |
| Resume | The sandbox keeps its current setting. |
| Fork | The new sandbox gets 1 hour. It does not copy the setting of the source sandbox. |

Thus a fork of a sandbox with auto-stop off does not silently make a second sandbox that never stops. See [Snapshots](/snapshots).

## Read the auto-stop deadline

Each resume sets the deadline again. The new deadline is the resume time plus the TTL of the sandbox.

If you schedule long jobs, do these steps:

1. Read the deadline after each resume.
2. Before a job that runs past the deadline, extend the sandbox.

`archiveAfter` is the deadline. It is `null` when auto-stop is off.

<CodeGroup>
  ```bash CLI theme={null}
  boat info bx_f7k2q9hd          # shows the deadline and the time left
  ```

  ```bash curl theme={null}
  curl -sS "$BOAT_API_BASE/sandboxes/bx_f7k2q9hd" \
    -H "Authorization: Bearer $BOAT_API_KEY" | jq -r .sandbox.archiveAfter
  ```

  ```ts TypeScript theme={null}
  const info = await sandbox.get({ sandboxId: "bx_f7k2q9hd" });
  console.log(info.sandbox.archiveAfter);
  ```

  ```python Python theme={null}
  info = sandbox.get("bx_f7k2q9hd")
  print(info.sandbox.archive_after)
  ```
</CodeGroup>

At the deadline, the sandbox stops the same as with `boat stop`. Boat cuts off the jobs that run. See [what a stop does to running work](/snapshots/stop#what-a-stop-does).

There is one exception. While a prompt to the agent of the sandbox runs, Boat moves the deadline forward by one TTL. Your own jobs do not move the deadline. Examples are `boat exec` commands and services. Read `archiveAfter` again each time. Do not keep the first value.

## Extend with a deadline

To keep an auto-stop deadline, extend the sandbox:

<CodeGroup>
  ```bash CLI theme={null}
  boat extend bx_f7k2q9hd --hours 12
  boat extend bx_f7k2q9hd --ttl 2592000
  ```

  ```bash curl theme={null}
  curl -sS -X PATCH "$BOAT_API_BASE/sandboxes/bx_f7k2q9hd" \
    -H "Authorization: Bearer $BOAT_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"ttlSeconds":43200}'
  ```

  ```ts TypeScript theme={null}
  await sandbox.update({
    sandboxId: "bx_f7k2q9hd",
    ttlSeconds: 12 * 60 * 60,
  });
  ```

  ```python Python theme={null}
  sandbox.update("bx_f7k2q9hd", UpdateSandboxRequest(ttl_seconds=12 * 60 * 60))
  ```
</CodeGroup>

* `2592000` seconds is 30 days.
* 30 days is the maximum numeric TTL that the Boat API accepts.
* Boat caps larger values to 30 days.


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