Skip to content
sandbox-workers
Esc
navigateopen⌘Jpreview
On this page

API reference

Method signatures, types, and the raw HTTP contract for @sandbox-workers/core.

This section documents the @sandbox-workers/core typed client and the JSON HTTP contract it sits on top of, for every method, option, result shape, and error you’ll encounter. For task-oriented walkthroughs, see Stateless mode and Stateful mode instead.

  • LifecyclegetSandbox(), sandbox.id, sandbox.getInfo(), sandbox.destroy(), and the SandboxInfo shape (stateful mode)
  • Code interpretersandbox.interpreter.*: createCodeContext(), listCodeContexts(), deleteCodeContext(), runCode() (stateful mode), plus sandbox.setEnvVars() (stateful mode) and the free runCode() (stateless mode)
  • Files — the workspace filesystem: writeFile(), readFile(), mkdir(), deleteFile(), renameFile(), moveFile(), listFiles(), exists() (stateful mode)
  • Errors — the SandboxError hierarchy, the ErrorResponse shape, and the full error code table (both modes)
  • HTTP API — the raw JSON contract behind the client, on both sides of the wire (both modes)
  • Stateless mode — task-oriented how-tos for one-shot execution with the free runCode
  • Stateful mode — task-oriented how-tos for code contexts and the shared workspace
  • Concepts — architecture, sandbox lifecycle, code contexts, runtimes, and the security model
  • Configuration — the caller’s and runtime Worker’s wrangler.jsonc, bindings, and environment variables