Execute Python code

View as markdown
POST /z1/code/execute

Execute Python code in a sandboxed environment.

Timeout Limits by Tier

  • Free: 5 seconds
  • Startup: 15 seconds
  • Business: 60 seconds
  • Enterprise: 120 seconds
application/json

Body Required

  • code string Required

    Python code to execute

  • user_id string Required

    User ID for tracking

  • timeout integer

    Timeout in seconds (tier-dependent)

Responses

  • 200 application/json

    Code executed successfully

    Hide response attributes Show response attributes object
    • output string
    • error string | null
    • execution_time_ms integer
  • 400 application/json

    Bad request - invalid parameters

    Hide response attributes Show response attributes object
    • status string
    • message string
    • code string
    • details object | null
  • 401 application/json

    Unauthorized - invalid or missing API key

    Hide response attributes Show response attributes object
    • status string
    • message string
    • code string
    • details object | null
  • 408 application/json

    Code execution timeout

    Hide response attributes Show response attributes object
    • status string
    • message string
    • code string
    • details object | null
POST /z1/code/execute
curl \
 --request POST 'https://api.plimverai.tech/z1/code/execute' \
 --header "Authorization: Bearer $ACCESS_TOKEN" \
 --header "Content-Type: application/json" \
 --data '{"code":"print('Hello, World!')","user_id":"string","timeout":15}'
Request examples
{
  "code": "print('Hello, World!')",
  "user_id": "string",
  "timeout": 15
}
Response examples (200)
{
  "output": "Hello, World!\n",
  "error": "string",
  "execution_time_ms": 125
}
Response examples (400)
{
  "code": "INVALID_MODEL",
  "status": "error",
  "message": "Invalid model specified"
}
Response examples (401)
{
  "code": "UNAUTHORIZED",
  "status": "error",
  "message": "Invalid API key"
}
Response examples (408)
{
  "status": "error",
  "message": "Invalid model specified",
  "code": "INVALID_MODEL",
  "details": {}
}