Skip to main content
POST
Create a sandbox from a template

Authorizations

Authorization
string
header
required

Your Styne API key: Authorization: Bearer $STYNE_API_KEY.

Body

application/json

Create a sandbox. Name a template (templateID), a saved snapshot (snapshot) or a size; with none of them the default size is used.

templateID
string

Template id or alias from GET /templates, for example base, code, small, large or browser.

snapshot
string

Name of a saved snapshot of your account to start from; replaces templateID.

size
enum<string>

The standard image at this size; replaces templateID.

Available options:
small,
default,
large,
xlarge
image
string

A container image to start from, for example alpine, python:3.12-slim or ghcr.io/org/app:tag; excludes templateID and snapshot. It starts on a node that holds a prepared build of the image; an image nobody prepared is a 404.

timeout
integer

Seconds until the sandbox times out.

idleTimeout
integer

Seconds without a call or connection after which the sandbox sleeps even if a process runs inside it; it wakes on the next call. 0 or absent: it sleeps only when nothing of yours runs inside.

Required range: 0 <= x <= 3600
autoPause
boolean

Pause instead of kill when the timeout is reached.

autoResume

Resume a paused sandbox on the next request: true, or {"enabled": true} as the SDKs send it.

lifecycle
object

What happens at the timeout.

secure
boolean

Require the access token on every sandbox call.

allow_internet_access
boolean

false blocks outbound internet access from the sandbox. Snake case, as the E2B SDK sends it.

network
object

Network rules.

metadata
object

String keys and values.

envVars
object

Environment variables set in every command of the sandbox.

environment
string

Stored environment to start from; the account default when left out.

vcpus
integer

vCPUs the sandbox needs; a request above the template size is refused.

memory_mib
integer

Memory in MiB the sandbox needs; a request above the template size is refused.

volumeMounts
object[]

Volumes of your account to mount, by name or id. The sandbox runs on the node that keeps them; see Volumes.

Response

Success. The answer is described on https://docs.styne.ai/quickstart.