Static Methods
Sandbox.create(opts?)
Create a new sandbox. HTTP API →
Template name
Idle timeout in seconds
API key (falls back to
OPENCOMPUTER_API_KEY env var)API URL (falls back to
OPENCOMPUTER_API_URL env var)Environment variables
Arbitrary metadata
Create a Burst Sandbox. Disk is preserved across infrastructure restarts; processes may restart.
CPU cores
Memory in MB
Secret store name — resolves encrypted secrets and egress allowlist
Name of a pre-built snapshot
Build log callback (when using
image)Promise<Sandbox>
Burst Sandboxes are alpha. They preserve filesystem state across
infrastructure restarts, may restart running processes, and are priced roughly
2x cheaper than on-demand sandboxes.
Sandbox.connect(sandboxId, opts?)
Connect to an existing sandbox. HTTP API →
Sandbox ID
API key
API URL
Promise<Sandbox>
Sandbox.createFromCheckpoint(checkpointId, opts?)
Create a new sandbox from a checkpoint. HTTP API →
Checkpoint ID
Idle timeout
Promise<Sandbox>
Sandbox.createCheckpointPatch(checkpointId, opts)
Create a patch for a checkpoint. HTTP API →
Target checkpoint
Bash script
Description
Promise<PatchResult>
Sandbox.listCheckpointPatches(checkpointId, opts?)
HTTP API →
Returns: Promise<PatchInfo[]>
Sandbox.deleteCheckpointPatch(checkpointId, patchId, opts?)
HTTP API →
Returns: Promise<void>
Instance Methods
sandbox.kill()
Terminate the sandbox. HTTP API →
Returns: Promise<void>
sandbox.isRunning()
Check if the sandbox is running.
Returns: Promise<boolean>
sandbox.hibernate()
Snapshot VM state and stop. No compute cost while hibernated. HTTP API →
Returns: Promise<void>
sandbox.wake(opts?)
Resume a hibernated sandbox. HTTP API →
Idle timeout after wake
Promise<void>
sandbox.setTimeout(timeout)
Update the idle timeout. HTTP API →
New timeout in seconds
Promise<void>
sandbox.createCheckpoint(name)
Create a named checkpoint. HTTP API →
Checkpoint name (unique per sandbox)
Promise<CheckpointInfo>
sandbox.listCheckpoints()
HTTP API → — Returns: Promise<CheckpointInfo[]>
sandbox.restoreCheckpoint(checkpointId)
Revert in-place to a checkpoint. HTTP API →
Returns: Promise<void>
sandbox.deleteCheckpoint(checkpointId)
HTTP API → — Returns: Promise<void>
sandbox.getPreviewDomain(port)
Get the preview URL domain for a specific port. No API call — constructs the hostname locally.
Port number
string (e.g., sb-abc123-p3000.workers.opencomputer.dev)
sandbox.downloadUrl(path, opts?)
Generate a signed download URL. HTTP API → · Guide →
Absolute path to the file
URL lifetime in seconds (max: 86400)
Promise<string>
sandbox.uploadUrl(path, opts?)
Generate a signed upload URL. HTTP API → · Guide →
Absolute path for the destination file
URL lifetime in seconds (max: 86400)
Promise<string>
sandbox.createPreviewURL(opts)
HTTP API →
Container port (1–65535)
Custom domain
Auth configuration
Promise<PreviewURLResult>
sandbox.listPreviewURLs()
HTTP API → — Returns: Promise<PreviewURLResult[]>
sandbox.deletePreviewURL(port)
HTTP API → — Returns: Promise<void>
sandbox.getAllowedHosts()
Return the egress allowlist + per-secret allowed hosts the sandbox’s secrets proxy enforces. Useful for debugging “why is my outbound HTTP call being blocked” without having to cross-reference the secret store config separately.
Sandboxes created without a secretStore option return an empty allowlist with secretStore undefined — the sandbox has no per-store egress restriction.
Returns: Promise<AllowedHostsInfo>
AllowedHostsInfo:
Sandbox ID
Name of the primary secret store the sandbox is bound to (the “winning” store on the row, whose secrets shadow the base store on env-name collisions). Empty when the sandbox was created without a
secretStore option.Name of the inherited parent store, present only when a fork layered an additional
secretStore on top of an inherited one. Empty for sandboxes created from scratch and for forks without an override.Hosts the sandbox can reach via the secrets proxy. For layered forks this is the union of every layered store’s allowlist (base first, primary’s additions appended, deduped) — matches what the runtime proxy actually enforces.
Optional per-secret restrictions. When the sandbox uses a listed secret in a request, only the listed hosts are reachable for that request. For layered forks, the primary store’s secrets shadow the base on name collisions (matches runtime env-collision behavior).
Properties
Sandbox ID (readonly)
Current status (readonly)
Preview URL domain for port 80 (e.g.,
sb-abc123-p80.workers.opencomputer.dev). Returns empty string if sandbox domain is not configured.Deprecated — alias for
execTypes
SandboxOpts
SandboxOpts
CheckpointInfo
CheckpointInfo
PatchInfo / PatchResult
PatchInfo / PatchResult
PreviewURLResult
PreviewURLResult