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

# Sandboxes

> A sandbox is a microVM restored from a template snapshot that you create, run commands in, pause, fork and kill.

The unmodified E2B SDK works too: see [switch from E2B](https://docs.styne.ai/e2b-drop-in.md).

## Lifecycle

| State | What moves it there | What it does |
| - | - | - |
| Running | [Create](https://docs.styne.ai/quickstart.md) from a template (a create is a pop from a pool of warmed VMs), a [fork](https://docs.styne.ai/fork.md), or a resume: `POST /sandboxes/{id}/resume` or `POST /sandboxes/{id}/connect` | [Run commands](https://docs.styne.ai/exec.md), read and write files, open ports; metered per second. A resume keeps the `sandboxID` and the state, with a new `timeout` |
| Paused | `POST /sandboxes/{id}/pause` at a [tier](https://docs.styne.ai/pause-tiers.md) | Keeps its memory; no timeout runs; still counts against your sandboxes |
| Ended | Its `endAt` passes (the `timeout` you gave on create counts from the start; 300 seconds is the default), or `DELETE /sandboxes/{id}` | Gone; any call answers `410` (see [errors](https://docs.styne.ai/errors.md)) |

Move the end of a running sandbox with `POST /sandboxes/{id}/timeout`. A paused sandbox reports in `endAt` when it was paused:
no timeout runs while it is paused.

## Templates

A template is the prepared VM a sandbox starts from, and `base` is the general Linux image. See [Templates](https://docs.styne.ai/guide-templates.md)
for the list, the sizes and how to make your own start state.

## Region and class

A create may name `region` and `class`; both are optional and the E2B SDKs send neither. `region` is `ash` (US East, Ashburn; the default). `ams` is accepted and served in Ashburn for now; see [Regions](https://docs.styne.ai/regions.md). An unknown region answers
`422 unknown_region`, and a region with no machine taking VMs answers `503 region_unavailable`, so a sandbox never starts
somewhere other than asked.

`class` picks the CPU class. `burstable` runs on shared vCPUs that burst to full speed. `guaranteed` gives the sandbox
whole cores of its own, for paid accounts; when no node has the cores free right now, the create answers
`503 guaranteed_capacity` with a `Retry-After`, and the sandbox always runs in the class you asked for. Without `class`, a
paid sandbox of 4 vCPUs or more takes whole cores whenever a node has them. The create answer and
`GET /sandboxes/{id}` report the class the sandbox runs in as `"class": "guaranteed"` or `"class": "burstable"`.

## Metadata

`metadata` on create is a map of strings kept with the sandbox and returned by `GET /sandboxes/{id}` and the list.

## Ports and preview URLs

A port opened inside a sandbox gets a preview URL; see [Ports and preview URLs](https://docs.styne.ai/ports.md).

## Network

A sandbox reaches the internet by default. Close it, allow named destinations and change the rules of a running sandbox; see [Network and egress](https://docs.styne.ai/network.md).

## Limits

Plans and included hours are on [Plans and billing](https://docs.styne.ai/billing.md); every limit with its answer is on [limits](https://docs.styne.ai/limits.md).


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