Skip to main content
POST
/
v2
/
sandcastles
/
{id}
/
execute
Execute Code
curl --request POST \
  --url https://app.textql.com/v2/sandcastles/{id}/execute \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "code": "<string>"
}
'
{
  "output": [
    "<string>"
  ],
  "error": "<string>",
  "execution_time_ms": 123,
  "files": [
    {
      "name": "<string>",
      "url": "<string>",
      "mime_type": "<string>"
    }
  ],
  "dataframes": [
    {
      "name": "<string>",
      "num_rows": 123,
      "num_cols": 123
    }
  ]
}

Authorizations

Authorization
string
header
required

API key or JWT token

Path Parameters

id
string
required

Sandbox ID

Body

application/json
code
string
required

Python code to execute

Response

Execution result

output
string[] | null

Stdout/stderr output as an array of strings, one element per print call. Null when execution fails with an error.

error
string

Execution error message, including the Python exception type and message (e.g. "executing Python code: ZeroDivisionError('division by zero')"). Only present when execution fails. When set, output is null.

execution_time_ms
integer<int64>

Execution duration in milliseconds

files
object[]
dataframes
object[]

Dataframes created or modified during execution. May be empty even if code creates dataframes — use GET /v2/sandcastles/{id} for the authoritative list of loaded dataframes.