Skip to main content
POST
/
v1
/
execute
# Simple execution
curl -X POST https://api.runtools.ai/v1/execute \
  -H "X-API-Key: rt_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "runtime": "python",
    "code": "print(sum([1, 2, 3, 4, 5]))"
  }'

# Multiple files
curl -X POST https://api.runtools.ai/v1/execute \
  -H "X-API-Key: rt_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "runtime": "python",
    "files": {
      "main.py": "import helper\nprint(helper.greet(\"World\"))",
      "helper.py": "def greet(name):\n    return f\"Hello, {name}!\""
    },
    "entrypoint": "main.py"
  }'
{
  "data": {
    "stdout": "15\n",
    "stderr": "",
    "exitCode": 0,
    "executionTime": 45,
    "timedOut": false
  }
}

Request Body

runtime
string
required
Runtime: python, node, bun, go, rust, ruby, php
code
string
Code to execute (mutually exclusive with files)
files
object
Multiple files as key-value pairs (path → content)
entrypoint
string
Entry file when using files
stdin
string
Standard input
timeout
number
default:"30000"
Timeout in milliseconds
env
object
Environment variables

Response

stdout
string
Standard output
stderr
string
Standard error
exitCode
number
Exit code (0 = success)
executionTime
number
Execution time in milliseconds
timedOut
boolean
Whether execution timed out
# Simple execution
curl -X POST https://api.runtools.ai/v1/execute \
  -H "X-API-Key: rt_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "runtime": "python",
    "code": "print(sum([1, 2, 3, 4, 5]))"
  }'

# Multiple files
curl -X POST https://api.runtools.ai/v1/execute \
  -H "X-API-Key: rt_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "runtime": "python",
    "files": {
      "main.py": "import helper\nprint(helper.greet(\"World\"))",
      "helper.py": "def greet(name):\n    return f\"Hello, {name}!\""
    },
    "entrypoint": "main.py"
  }'
{
  "data": {
    "stdout": "15\n",
    "stderr": "",
    "exitCode": 0,
    "executionTime": 45,
    "timedOut": false
  }
}

Notes

  • Code runs in an ephemeral sandbox (destroyed after execution)
  • No persistent state between executions
  • For stateful work, use Sandboxes