v4

latestOpenAPI 3.1.0MIT2026-08-04193459793.6 KB
Code Interpreter

Execute code

Executes the given code snippet and returns the output. Without a session_id, a new session is created to run the code. If you pass a valid session_id, the code runs in that session. This is useful for running multiple code snippets in the same environment, because dependencies and similar things are persisted between calls to the same session.

post/tci/execute

Request body

codestring required

Code snippet to execute.

language'python' required

Programming language for the code to execute. Currently only supports Python.

session_idstring

Identifier of the current session. Used to make follow-up calls. Returns an error if the session does not belong to the caller or has expired.

Example request

{
  "code": "print('Hello, world!')",
  "session_id": "ses_abcDEF123"
}

Response

Execute Response

OR

Example response

{
  "data": {
    "session_id": "ses_abcDEF123"
  }
}