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.
- Lifecycle —
getSandbox(),sandbox.id,sandbox.getInfo(),sandbox.destroy(), and theSandboxInfoshape (stateful mode) - Code interpreter —
sandbox.interpreter.*:createCodeContext(),listCodeContexts(),deleteCodeContext(),runCode()(stateful mode), plussandbox.setEnvVars()(stateful mode) and the freerunCode()(stateless mode) - Files — the workspace filesystem:
writeFile(),readFile(),mkdir(),deleteFile(),renameFile(),moveFile(),listFiles(),exists()(stateful mode) - Errors — the
SandboxErrorhierarchy, theErrorResponseshape, 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)
Related resources
- 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