---
title: "Execute a command within a session"
method: POST
path: "/sandbox-sessions/{sessionId}/exec"
tags: ["Sandboxes"]
---

# Execute a command within a session

`POST /sandbox-sessions/{sessionId}/exec`

## Request

- Base URL: `https://api.volcano.dev`
- URL: `https://api.volcano.dev/sandbox-sessions/{sessionId}/exec`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer
  - HTTP bearer
  - HTTP bearer

## Path parameters

- `sessionId` string, uuid, required

## Headers

- `Idempotency-Key` string, uuid, required

## Request body

- SandboxCommandRequest
  - `command` string, required
  - `timeout_seconds` integer: Command execution time from process start. Cloud defaults to 60 seconds and accepts 1–28800; local defaults to 0 (unlimited) and accepts nonnegative values. VM expiry always takes precedence. Cloud synchronous requests must return within the public connection idle limit (1000 seconds); use a session with a background process and short polling requests for longer work.
  - `environment` object

## Response `200`

Execute a command within a session

- SandboxCommandResult
  - `stdout` string, required
  - `stderr` string, required
  - `exit_code` integer, required
  - `stdout_truncated` boolean, required
  - `stderr_truncated` boolean, required
  - `timed_out` boolean, required

## Other responses

- `default`: Request refused or unavailable. Errors include invalid input (400), unauthenticated (401), forbidden (403), not found (404), conflicting retry (409), capacity exhausted (429), and temporarily unavailable (503). Code `feature_unavailable` with 404 means sandboxes are not available in this environment.

## Changes

- **2026-10-14** `d8d8f53d847b`: 4 info
  - the endpoint scheme security `ProjectAccessToken` was added to the API
  - the `timeout_seconds` request property default value `60` was removed
  - the `timeout_seconds` request property's max was increased from `3600.00` to `2147483647.00`
  - the `timeout_seconds` request property's min was decreased from `1.00` to `0.00`
- **2026-10-05** `d350e7525428`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/kong/apis/volcano-api/changes/sandbox-sessions/:sessionId/exec/post.md)

---

[API](https://skmtc.dev/kong/apis/volcano-api.md) - [All operations](https://skmtc.dev/kong/apis/volcano-api/llms.txt) - [OpenAPI document](https://skmtc.dev/kong/apis/volcano-api/revisions/84c4488f91e9?raw)
