curl -X POST "$BASE/api/v1/sandboxes/my-sandbox/exec?namespace=default" \
  -H "X-API-Key: $K7_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"command": "echo Hello"}'
{
  "data": {
    "exit_code": 0,
    "stdout": "Hello\n",
    "stderr": "",
    "duration_ms": 12
  }
}
Endpoint: POST /api/v1/sandboxes/{name}/exec
curl -X POST "$BASE/api/v1/sandboxes/my-sandbox/exec?namespace=default" \
  -H "X-API-Key: $K7_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"command": "echo Hello"}'
{
  "data": {
    "exit_code": 0,
    "stdout": "Hello\n",
    "stderr": "",
    "duration_ms": 12
  }
}
name
string
required
Sandbox name
namespace
string
default:"default"
Namespace
command
string
required
Shell command to execute

Semantics

  • exit_code: 0 on success, non-zero when the command fails.
  • stdout/stderr: Raw streams captured from the process; may include newlines.
  • duration_ms: Client-observed duration including stream lifecycle.

Examples

curl -X POST "$BASE/api/v1/sandboxes/my-sandbox/exec?namespace=default" \
  -H "Authorization: Bearer $K7_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"command": "apk add --no-cache curl && curl -I https://example.com"}'
Error example (non-zero exit):
{
  "data": {
    "exit_code": 2,
    "stdout": "",
    "stderr": "some error...",
    "duration_ms": 37
  }
}