> ## Documentation Index
> Fetch the complete documentation index at: https://docs.akua.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# List commands

Commands run in the sandbox, newest first. Works in every sandbox state. Requires `run_commands`.

`GET https://api.akua.dev/v1/sandboxes/{id}/commands`

## Authorizations

- `Authorization: Bearer <token>` (BearerAuth): Bearer token for the authenticated caller.

## Headers

- `akua-context` (string): Optional workspace/scope context for the request. Carries a single workspace wire id (`ws_…`) today. Only needed for broad tokens - a workspace-owned token implies its workspace. Required string length: `1 - 53`. Example: `"ws_j572abc123def4"`.

## Path Parameters

- `id` (string, required): Sandbox id (`sbx_...`). Pattern: `^sbx_[A-Za-z0-9]{1,64}$`. Example: `"sbx_j572abc123def456"`.

## Query Parameters

- `cursor` (string): Pagination cursor from a previous response's `next_cursor`. Maximum string length: `512`.
- `limit` (integer, default 50): Items per page (1-100, default 50). Required range: `1 <= x <= 100`. Example: `50`.
- `state` (enum<string>): `SUCCEEDED`: exited with code 0. `FAILED`: exited with another code, was killed, or hit its timeout (exit code 124). Available options: `"RUNNING"`, `"SUCCEEDED"`, `"FAILED"`, `"CANCELLED"`.

## Response

### 200: SandboxCommandList

`application/json`: `SandboxCommandList`

- `data` (object[], required)
  - `id` (string, required): Sandbox command id (`cmd_...`). Pattern: `^cmd_[A-Za-z0-9]{1,64}$`. Example: `"cmd_j572abc123def456"`.
  - `sandbox_id` (string, required): Sandbox id (`sbx_...`). Pattern: `^sbx_[A-Za-z0-9]{1,64}$`. Example: `"sbx_j572abc123def456"`.
  - `argv` (string[] | null, required)
  - `shell` (string | null, required)
  - `cwd` (string, required)
  - `timeout_seconds` (integer, required)
  - `state` (enum<string>, required): `SUCCEEDED`: exited with code 0. `FAILED`: exited with another code, was killed, or hit its timeout (exit code 124). Available options: `"RUNNING"`, `"SUCCEEDED"`, `"FAILED"`, `"CANCELLED"`.
  - `exit_code` (integer | null, required): Set once the command finished.
  - `created_by` (object, required)
    - `type` (enum<string>, required): `user`: a workspace member. `opencode`: an OpenCode Server (`oc_...`). Available options: `"user"`, `"opencode"`.
    - `id` (string, required): Required string length: `1 - 100`.
  - `created_at` (integer, required): Start time (Unix seconds). Required range: `x >= 0`.
  - `finished_at` (integer | null, required): Finish time (Unix seconds). Required range: `x >= 0`.
  - `output` (object | null, required): Captured output, only on the response to a `wait: true` request that finished in time; `null` elsewhere.
    - `stdout` (string, required)
    - `stderr` (string, required)
    - `truncated` (boolean, required): True when the output is longer than the 64 KiB returned here; read it all with `logs:stream`.
- `has_more` (boolean, required): True if more items exist after this page.
- `next_cursor` (string | null, required): Opaque cursor for the next page, or null if no more pages.

### 400: The request is malformed.

`application/json`: `ApiBadRequest`

- `_tag` (enum<string>, required): Available options: `"Validation"`.
- `success` (enum<boolean>, required): Available options: `false`.
- `errors` (object[], required): Minimum array length: `1 element`.
  - `code` (integer, required): Machine-readable error code. Required range: `-9007199254740991 <= x <= 9007199254740991`. Example: `7002`.
  - `message` (string, required): Human-readable error message. Example: `"Resource not found"`.
  - `path` (string[]): Field path that caused the error, when applicable. Example: `["body","name"]`.
  - `metadata` (record<string, string>)
- `result` (object, required)

### 403: The credential may not act in this workspace.

`application/json`: `ApiForbidden`

- `_tag` (enum<string>, required): Available options: `"Forbidden"`.
- `success` (enum<boolean>, required): Available options: `false`.
- `errors` (object[], required): Minimum array length: `1 element`.
  - `code` (integer, required): Machine-readable error code. Required range: `-9007199254740991 <= x <= 9007199254740991`. Example: `7002`.
  - `message` (string, required): Human-readable error message. Example: `"Resource not found"`.
  - `path` (string[]): Field path that caused the error, when applicable. Example: `["body","name"]`.
  - `metadata` (record<string, string>)
- `result` (object, required)

### 404: The resource was not found in this workspace.

`application/json`: `ApiNotFound`

- `_tag` (enum<string>, required): Available options: `"NotFound"`.
- `success` (enum<boolean>, required): Available options: `false`.
- `errors` (object[], required): Minimum array length: `1 element`.
  - `code` (integer, required): Machine-readable error code. Required range: `-9007199254740991 <= x <= 9007199254740991`. Example: `7002`.
  - `message` (string, required): Human-readable error message. Example: `"Resource not found"`.
  - `path` (string[]): Field path that caused the error, when applicable. Example: `["body","name"]`.
  - `metadata` (record<string, string>)
- `result` (object, required)

### 409: The request conflicts with existing resource state or immutable intent. | The resource changed since the etag the client sent; the current etag is in the metadata.

`application/json`: `object`

- Any of:
  - `Conflict`
    - `_tag` (enum<string>, required): Available options: `"Conflict"`.
    - `success` (enum<boolean>, required): Available options: `false`.
    - `errors` (object[], required): Minimum array length: `1 element`.
      - `code` (integer, required): Machine-readable error code. Required range: `-9007199254740991 <= x <= 9007199254740991`. Example: `7002`.
      - `message` (string, required): Human-readable error message. Example: `"Resource not found"`.
      - `path` (string[]): Field path that caused the error, when applicable. Example: `["body","name"]`.
      - `metadata` (record<string, string>)
    - `result` (object, required)
  - `PreconditionFailed`
    - `_tag` (enum<string>, required): Available options: `"PreconditionFailed"`.
    - `success` (enum<boolean>, required): Available options: `false`.
    - `errors` (object[], required): Required array length: `1 - 1 element`.
      - `code` (enum<number>, required): Available options: `7006`.
      - `message` (string, required)
      - `metadata` (object, required)
        - `current_etag` (string, required)
        - `{key}` (string)
    - `result` (object, required)

### 422: The request is well-formed but cannot be processed.

`application/json`: `ApiUnprocessable`

- `_tag` (enum<string>, required): Available options: `"Unprocessable"`.
- `success` (enum<boolean>, required): Available options: `false`.
- `errors` (object[], required): Minimum array length: `1 element`.
  - `code` (integer, required): Machine-readable error code. Required range: `-9007199254740991 <= x <= 9007199254740991`. Example: `7002`.
  - `message` (string, required): Human-readable error message. Example: `"Resource not found"`.
  - `path` (string[]): Field path that caused the error, when applicable. Example: `["body","name"]`.
  - `metadata` (record<string, string>)
- `result` (object, required)

### 429: The Workspace or owner sandbox quota has been reached.

`application/json`: `ApiTooManyRequests`

- `_tag` (enum<string>, required): Available options: `"TooManyRequests"`.
- `success` (enum<boolean>, required): Available options: `false`.
- `errors` (object[], required): Minimum array length: `1 element`.
  - `code` (integer, required): Machine-readable error code. Required range: `-9007199254740991 <= x <= 9007199254740991`. Example: `7002`.
  - `message` (string, required): Human-readable error message. Example: `"Resource not found"`.
  - `path` (string[]): Field path that caused the error, when applicable. Example: `["body","name"]`.
  - `metadata` (record<string, string>)
- `result` (object, required)

### 502: An upstream provider failed.

`application/json`: `ApiExternalServiceError`

- `_tag` (enum<string>, required): Available options: `"ExternalServiceError"`.
- `success` (enum<boolean>, required): Available options: `false`.
- `errors` (object[], required): Minimum array length: `1 element`.
  - `code` (integer, required): Machine-readable error code. Required range: `-9007199254740991 <= x <= 9007199254740991`. Example: `7002`.
  - `message` (string, required): Human-readable error message. Example: `"Resource not found"`.
  - `path` (string[]): Field path that caused the error, when applicable. Example: `["body","name"]`.
  - `metadata` (record<string, string>)
- `result` (object, required)

### 503: The service is temporarily unavailable.

`application/json`: `ApiServiceUnavailable`

- `_tag` (enum<string>, required): Available options: `"ServiceUnavailable"`.
- `success` (enum<boolean>, required): Available options: `false`.
- `errors` (object[], required): Minimum array length: `1 element`.
  - `code` (integer, required): Machine-readable error code. Required range: `-9007199254740991 <= x <= 9007199254740991`. Example: `7002`.
  - `message` (string, required): Human-readable error message. Example: `"Resource not found"`.
  - `path` (string[]): Field path that caused the error, when applicable. Example: `["body","name"]`.
  - `metadata` (record<string, string>)
- `result` (object, required)

## Example request

```bash
curl --request GET \
  --url 'https://api.akua.dev/v1/sandboxes/sbx_j572abc123def456/commands' \
  --header 'Authorization: Bearer <token>'
```

## Example response

`200` `application/json`

```json
{
  "data": [
    {
      "id": "cmd_j572abc123def456",
      "sandbox_id": "sbx_j572abc123def456",
      "argv": [
        "<string>"
      ],
      "shell": "<string>",
      "cwd": "<string>",
      "timeout_seconds": 123,
      "state": "RUNNING",
      "exit_code": 123,
      "created_by": {
        "type": "user",
        "id": "<string>"
      },
      "created_at": 123,
      "finished_at": 123,
      "output": {
        "stdout": "<string>",
        "stderr": "<string>",
        "truncated": true
      }
    }
  ],
  "has_more": true,
  "next_cursor": "<string>"
}
```
