The code interpreter API runs inside every sandbox via theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/opensandbox-group/OpenSandbox/llms.txt
Use this file to discover all available pages before exploring further.
execd daemon at http://localhost:44772. It exposes a Jupyter-compatible execution model with persistent kernel contexts: a context (session) is created once and reused across multiple code executions, maintaining in-memory state such as imported modules, defined variables, and open resources. Execution output is streamed in real-time using Server-Sent Events (SSE). Supported languages include Python, Bash, Java, JavaScript, and Go. The API also provides isolated execution sessions that run code in a namespace-isolated environment with a configurable workspace mount mode.
OpenSandbox SDK clients wrap these endpoints with higher-level abstractions. If you are using the SDK, you typically do not call these endpoints directly. Direct HTTP access requires a valid
X-EXECD-ACCESS-TOKEN header.POST /code/context
Creates a new code execution context for the specified language. Returns a context object containing a session ID (id) and the runtime language. The session ID is passed to subsequent POST /code requests to route executions into the correct kernel.
Auth: X-EXECD-ACCESS-TOKEN header required.
Request Body
Execution runtime to initialize. Examples:
python, bash, java, javascript, go.Response — 200 OK
Unique session identifier to use in subsequent code execution requests.
The execution runtime associated with this context.
Example
GET /code/contexts
Lists all active code execution contexts. Thelanguage query parameter is required and filters the results to contexts under that runtime.
Auth: X-EXECD-ACCESS-TOKEN header required.
Query Parameters
Filter contexts by execution runtime (e.g.
python, bash, java).Response — 200 OK
An array ofCodeContext objects:
Unique session identifier.
Execution runtime.
Example
GET /code/contexts/
Retrieves details of a specific code execution context by ID. Auth:X-EXECD-ACCESS-TOKEN header required.
Path Parameters
Session/context ID to retrieve.
Response — 200 OK
Unique session identifier.
Execution runtime.
Example
DELETE /code/contexts/
Deletes a specific code execution context by ID. Terminates the underlying kernel process and releases all associated resources. Auth:X-EXECD-ACCESS-TOKEN header required.
Path Parameters
Session/context ID to delete.
Example
DELETE /code/contexts
Bulk-deletes all code execution contexts under the specified language. This is a convenience cleanup operation — individual context IDs do not need to be enumerated. Auth:X-EXECD-ACCESS-TOKEN header required.
Query Parameters
Target execution runtime whose contexts should be deleted.
Example
POST /code
Executes code in a specified context using the Jupyter kernel model. Output is streamed in real-time via SSE. If no context is provided, a stateless execution is performed. Supports Python, JavaScript, and other runtimes depending on the installed kernels. Auth:X-EXECD-ACCESS-TOKEN header required.
Request Body
Source code to execute.
Target execution context. If omitted, a stateless execution is performed.
Response — 200 OK (text/event-stream)
SSE stream with the following event types:
Event type. One of:
init, status, stdout, stderr, result, execution_complete, execution_count, error, ping.Textual payload for
stdout, stderr, status, and init events.Execution output in various MIME types on
result events. Keys are MIME types (e.g. "text/plain", "text/html").Incremental cell execution counter in the context session.
Execution duration in milliseconds. Present on
execution_complete.Structured error details on
error events.Example
DELETE /code
Interrupts the currently running code execution in the specified context. Sends a kernel interrupt signal (equivalent to Jupyter kernel interrupt) to terminate the active execution and release resources. Auth:X-EXECD-ACCESS-TOKEN header required.
Query Parameters
Session ID of the execution context to interrupt.
Example
Supported Languages
| Language | Runtime |
|---|---|
python | IPython kernel (Jupyter) |
bash | Bash shell interpreter |
java | JVM-based kernel |
javascript | Node.js kernel |
go | Go runtime kernel |
Isolated Execution
The isolated execution API provides per-session namespace isolation for code and file operations. Each isolated session runs in its own sandboxed environment with a configurable workspace mount mode (rw, overlay, or ro). All isolated endpoints are served at the /v1/isolated path prefix and require the same X-EXECD-ACCESS-TOKEN header.
Isolated sessions depend on the isolator subsystem. Call
GET /v1/isolated/capabilities to verify availability before creating sessions. All isolated endpoints return 503 Service Unavailable when the isolation subsystem is not ready.GET /v1/isolated/capabilities
Returns whether the isolator subsystem is available, the isolator backend name and version, and which optional features (commit_supported, diff_supported) are enabled on this deployment.
Auth: X-EXECD-ACCESS-TOKEN header required.
Response — 200 OK
Whether the isolation subsystem is available.
Isolator backend identifier.
Isolator version string.
Diagnostic message when isolation is unavailable.
Whether the commit operation is supported by this backend.
Whether the diff operation is supported by this backend.
Example
POST /v1/isolated/session
Creates a new isolated bash session with a scoped workspace. Returns a session UUID and creation timestamp. Auth:X-EXECD-ACCESS-TOKEN header required.
Request Body
Workspace specification for the isolated session.
Security profile. Enum:
strict, balanced.Additional absolute paths to make writable inside the session (array of strings).
Whether to share the host network namespace. Default:
false.Environment variable passthrough policy.
Unix user ID for the session process.
Unix group ID for the session process.
Seconds of inactivity before the session is automatically destroyed.
Response — 201 Created
UUID of the newly created isolated session.
RFC 3339 session creation timestamp.
Example
GET /v1/isolated/session/
Returns the current state of an isolated session, including status, creation time, last run time, and remaining idle seconds. Auth:X-EXECD-ACCESS-TOKEN header required.
Path Parameters
UUID of the isolated session.
Response — 200 OK
Session status. Enum:
active, dead, destroyed.RFC 3339 creation timestamp.
RFC 3339 timestamp of the most recent run.
Seconds until idle timeout fires.
null when no idle timeout is configured.Example
DELETE /v1/isolated/session/
Destroys an isolated session, terminating the underlying process and releasing all associated resources. Auth:X-EXECD-ACCESS-TOKEN header required.
Path Parameters
UUID of the isolated session to delete.
Example
POST /v1/isolated/session//run
Executes a shell command or script inside an isolated session and streams output in real-time via SSE. Optionally inject environment variables or enforce a timeout. Auth:X-EXECD-ACCESS-TOKEN header required.
Path Parameters
UUID of the isolated session.
Request Body
Shell command or script to execute inside the isolated session.
Additional environment variables to inject (key-value string pairs).
Maximum execution time in seconds. The process is forcefully terminated when the limit is reached.
Response — 200 OK (text/event-stream)
SSE stream with the same event types as POST /command: init, status, stdout, stderr, result, execution_complete, error.
Example
GET /v1/isolated/session//diff
Returns a diff of upper-layer filesystem changes made within the isolated session. This is a stub endpoint — returns503 Service Unavailable until the backend implements the feature.
Auth: X-EXECD-ACCESS-TOKEN header required.
Path Parameters
UUID of the isolated session.
POST /v1/isolated/session//commit
Commits upper-layer filesystem changes back to the underlying workspace. This is a stub endpoint — returns503 Service Unavailable until the backend implements the feature.
Auth: X-EXECD-ACCESS-TOKEN header required.
Path Parameters
UUID of the isolated session.
Isolated Session File Operations
The following endpoints mirror the standard file and directory endpoints but scope all paths within the isolated session’s namespace. All require theX-EXECD-ACCESS-TOKEN header and a sessionId UUID path parameter. Unsupported operations return 503 Service Unavailable.
| Method | Path | Description |
|---|---|---|
GET | /v1/isolated/session/{sessionId}/files/info | Get file metadata for one or more paths. |
GET | /v1/isolated/session/{sessionId}/files/download | Download a file; supports offset/limit and Range header. |
POST | /v1/isolated/session/{sessionId}/files/upload | Upload a file via multipart/form-data. |
DELETE | /v1/isolated/session/{sessionId}/files | Delete one or more files (path query, repeatable). |
POST | /v1/isolated/session/{sessionId}/files/mv | Move or rename files (array of {src, dest} pairs). |
POST | /v1/isolated/session/{sessionId}/files/permissions | Change file owner/group/mode (map of path to Permission). |
POST | /v1/isolated/session/{sessionId}/files/replace | Batch replace file content; supports verbose query parameter. |
GET | /v1/isolated/session/{sessionId}/files/search | Search files by glob pattern under a root directory. |
GET | /v1/isolated/session/{sessionId}/directories/list | List directory contents with optional depth control. |
POST | /v1/isolated/session/{sessionId}/directories | Create directories with permissions (mkdir -p semantics). |
DELETE | /v1/isolated/session/{sessionId}/directories | Recursively delete directories (path query, repeatable). |