Skip to content
Cloudflare Docs

API Reference

The Sandbox SDK provides a comprehensive API for executing code, managing files, running processes, and exposing services in isolated sandboxes.

Lifecycle

Create and manage sandbox containers. Get sandbox instances, configure options, and clean up resources.

Commands

Execute commands and stream output. Run scripts, manage background processes, and capture execution results.

Files

Read, write, and manage files in the sandbox filesystem. Includes directory operations and file metadata.

Code Interpreter

Execute Python and JavaScript code with rich outputs including charts, tables, and formatted data.

Ports

Expose services running in the sandbox via preview URLs. Access web servers and APIs from the internet.

Sessions

Create isolated execution contexts within a sandbox. Each session maintains its own shell state, environment variables, and working directory.