Execute code (streaming)
Run code and stream stdout/stderr via Server-Sent Events. Unlike `/execute`, this spawns a fresh subprocess per request. Each SSE message is a JSON `StreamEvent`.
POST
/execute/asyncRun code and stream stdout/stderr via Server-Sent Events.
Unlike /execute, this spawns a fresh subprocess per request.
Each SSE message is a JSON StreamEvent.
Authorization
BearerAuth AuthorizationBearer <token>
API key passed as a Bearer token.
In: header
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
code*string
Source code to execute.
context_id?string
Link execution to an existing context.
language?string
Language runtime to use.
Default
"python"Value in
"python" | "py" | "python3" | "typescript" | "ts" | "javascript" | "js" | "bun" | "node"timeout_ms?integer
Execution timeout in milliseconds.
Default
30000Response Body
text/event-stream
application/json
application/json
curl -X POST "https://<sandbox_id>.sandbox.leap0.dev/execute/async" \ -H "Content-Type: application/json" \ -d '{ "code": "print(\'hello\')" }'{ "type": 0, "data": "string", "code": 0}{ "message": "Invalid request", "errors": [ { "field": "string", "error": "string" } ]}{ "message": "string"}
