Code Interpreter
Sandbox apiExecutionExecute

Execute code in the sandbox

POST
/execute

Stages files into a fresh workspace, runs the entry point under NsJail with the configured limits, and returns the captured output plus refs to any files the run produced.

Concurrency is bounded by SANDBOX_MAX_CONCURRENT_JOBS. The request body is capped by SANDBOX_EXECUTE_BODY_LIMIT (50 MB by default).

Header Parameters

X-CodeAPI-Execution-Manifest?string

Header form of execution_manifest, for rolling upgrades.

X-CodeAPI-Egress-Grant?string

Header form of egress_grant, for rolling upgrades.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/execute" \  -H "Content-Type: application/json" \  -d '{    "language": "python",    "version": "3.14.4",    "files": [      {        "name": "main.py",        "content": "print(42)"      }    ]  }'
{  "session_id": "string",  "stdout": "string",  "stderr": "string",  "files": [    {      "id": "string",      "name": "string",      "storage_session_id": "string",      "modified_from": {        "id": "string",        "storage_session_id": "string"      },      "inherited": true,      "entity_id": "string"    }  ],  "code": 0,  "signal": "string",  "message": "string",  "status": "string",  "wall_time": 0,  "session_state_persisted": true,  "session_state_restore_failed": true}