---
title: "Run a command inside a running sandbox (synchronous)."
method: POST
path: "/v1/sandboxes/{id}/commands"
tags: ["Sandboxes"]
---

# Run a command inside a running sandbox (synchronous).

`POST /v1/sandboxes/{id}/commands`

## Request

- Base URL: `https://api.scalix.world`
- URL: `https://api.scalix.world/v1/sandboxes/{id}/commands`
- Auth: HTTP bearer

## Path parameters

- `id` string, required

## Request body

- SandboxCommandRequest: Request body for running a command inside a sandbox.
  - `cmd` string, required
  - `args` string[], nullable
  - `cwd` string, nullable: Working directory inside the guest.
  - `env` object
  - `detached` boolean, nullable: Run without waiting for completion.

## Response `200`

Command result

- SandboxCommandResult: Result of a synchronous command execution.
  - `exit_code` integer, required
  - `stdout` string, required
  - `stderr` string, required
  - `duration_ms` integer, required

## Other responses

- `400`: Sandbox is not running
- `404`: Not found

---

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