---
title: "Execute a command (bash -lc command, or argv)"
method: POST
path: "/sandboxes/{id}/exec"
tags: ["sandboxes"]
---

# Execute a command (bash -lc command, or argv)

`POST /sandboxes/{id}/exec`

## Request

- Base URL: `https://api.eqvps.com/api/v1/eqvps`
- URL: `https://api.eqvps.com/api/v1/eqvps/sandboxes/{id}/exec`
- Auth: HTTP bearer

## Path parameters

- `id` string, required

## Request body

- ExecCommand: Exactly one of command / argv
  - `command` string: Run as bash -lc
  - `argv` string[]
  - `stdin` string
  - `cwd` string
  - `timeout` integer: Seconds. Synchronous: max 55 (default 30). With async: up to the sandbox's remaining lifetime (default).
  - `async` boolean: Run as a background task: returns 202 TaskStarted immediately; poll GET /sandboxes/{id}/tasks/{task_id}.
  - `env` SbxEnv: Environment variables for the process. Up to 64 names, 32 KB per value, 64 KB total. Values are stored encrypted, never returned by the API and not logged; responses show only env_keys. On create: applied to every exec/run in the sandbox. On exec/run: applied to that call and merged over the sandbox env.

## Response `200`

Execution result

- ExecResult
  - `exit_code` integer
  - `stdout` string
  - `stderr` string
  - `timed_out` boolean
  - `truncated` boolean
  - `duration_ms` integer

## Other responses

- `202`: Background task started (async: true)
- `404`: not_found
- `409`: sandbox_paused / sandbox_not_running / conflict
- `422`: invalid_request

---

[API](https://skmtc.dev/eqvps/apis/eqvps-api.md) · [All operations](https://skmtc.dev/eqvps/apis/eqvps-api/llms.txt) · [OpenAPI document](https://skmtc.dev/eqvps/apis/eqvps-api/revisions/2cbc15a2b088?raw)
