Runtime

Run a code snippet

Writes code to a temp file and runs it with the chosen interpreter. Cleaner than /exec for multi-line scripts because you don't have to deal with shell escaping. Response shape matches /exec.

Supports the same stream: true opt-in as /exec; see that endpoint's description for the NDJSON frame shape.

post/sandboxes/{id}/code

Path parameters

idstring required

24-char hex id of the sandbox.

Request body

language'python' | 'node' required
codestring required

Snippet source. Multi-line via \n in the JSON string.

timeout_secondsinteger
cwdstring
streamboolean

When true, the response is NDJSON streamed as the snippet runs — same behaviour as /exec with stream: true.

Response

Code completed.

When the request body has stream: true, the response is application/x-ndjson, one ExecStreamFrame per line.

messagestring required

Example response

{
  "message": "Exec completed"
}

Changes