dots.code.execute.post()
Generated on 5 Nov 2026
from DoTs version
v1.23.0
Usage
client.code.execute.post(body: Execute_code_request, requestConfiguration?: RequestConfiguration<object>): Promise<undefined | Execute_code_response>Description
Runs Python code in an ephemeral sandbox and returns its stdout, stderr, and exit_code. This is the REST form of the action_code MCP tool. Use it for computation, parsing, and data processing, or to chain several catalog tools in one request.
The sandbox provides invoke_digitalocean_tool(name, arguments), which calls a catalog tool and returns a tool result. Those calls follow the session’s tool selection and policy. Each request runs in a fresh sandbox, so state is not kept between requests. Execution, including tool calls, is time limited. Code that runs too long fails with a timeout error.
A nonzero exit code is still a succeeded result; check output.exit_code. If the session policy requires approval for action_code, the response is a failed result with _meta.status set to requires_approval.
Parameters
Headers
X-Session-Idstring requiredExample:
2b3c9f0e-1a4d-4e5f-8a7b-6c5d4e3f2a1bThe session to act in: the UUID at the end of the session's
sessionUrnandmcpUrl. The session must belong to the authenticated user and team.
Request Body
codestring requiredExample:
print("hello from Action Gateway")Python source to run. The sandbox provides
invoke_digitalocean_tool(name: str, arguments: dict) -> dict, which calls a catalog tool under the session's policy and returns a tool result.
Request Sample
Response Example
More Information
See /code/execute in the API reference for additional detail on responses, headers, parameters, and more.