Skip to content

Execute code (streaming)

POST
/execute/async

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.

object
code
required

Source code to execute.

string
Example
print('hello')
context_id

Link execution to an existing context.

string
language

Language runtime to use.

string
default: python
Allowed values: python py python3 typescript ts javascript js bun node
timeout_ms

Execution timeout in milliseconds.

integer
default: 30000

SSE stream of execution events.

object
type
required

Event type: 0 = stdout, 1 = stderr, 2 = exit, 3 = error.

integer
Allowed values: 0 1 2 3
data

Line of output text.

string
code

Process exit code (only present on exit events).

integer

Bad request – validation error.

object
message
required

Summary message.

string
Example
Invalid request
errors
required
Array<object>
object
field
required

JSON field name that failed validation.

string
error
required

Human-readable validation failure.

string

Internal error.

object
message
required

Human-readable error message.

string