---
title: "ExecuteCode"
method: POST
path: "/v1/sandbox/execute"
tags: ["textql.rpc.platform.SandboxService"]
---

# ExecuteCode

`POST /v1/sandbox/execute`

Execute Python code in a running sandbox

## Headers

- `Connect-Protocol-Version` 1, required — Define the version of the Connect protocol
- `Connect-Timeout-Ms` number — Define the timeout, in ms

## Request body

- TextqlRpcPlatformExecuteCodeRequest
  - `sandboxId` string, required
  - `code` string, required — Python code to execute

## Response `200`

Success

- TextqlRpcPlatformExecuteCodeResponse
  - `output` string[] — Lines of stdout output
  - `error` string, nullable — Error message if execution failed
  - `files` TextqlRpcPlatformFileOutput[] — Files generated during execution
    - `name` string
    - `url` string
    - `mimeType` string
  - `dataframes` TextqlRpcPlatformDataFrameOutput[] — DataFrames created or modified during execution
    - `name` string
    - `numRows` integer
    - `numCols` integer
  - `executionTimeMs` integer

## Other responses

- `default` — Error

---

[API](https://skmtc.net/textql/apis/textql-rpc-platform.md) · [All operations](https://skmtc.net/textql/apis/textql-rpc-platform/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/textql/textql-rpc-platform/revisions/31ce2b0c4427/schema)
