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 SSE event shape.
Path parameters
24-char hex id of the sandbox.
Request body
Example request
{
"env": {
"OPENAI_API_KEY": "sk-..."
}
}Response
Code completed.
When the request body has stream: true, the response is text/event-stream, one ExecStreamFrame per data: event.
Example response
{
"message": "Exec completed"
}Changes
Changed in 2 of the 5 revisions of this API.12
- ▲
removed the media type
application/x-ndjsonfor the response with the status200response-media-type-removed
- ○
added the media type
text/event-streamfor the response with the status200response-media-type-added
- ▲
- ○
added the new optional request property
envnew-optional-request-property
This revision also has 1 change that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog
- ○