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

# List the command history

> List the commands run in a sandbox in the last 90 days, newest first. Works while the sandbox is stopped.



## OpenAPI

````yaml openapi/boat-v1.yaml GET /sandboxes/{sandboxId}/command-history
openapi: 3.1.0
info:
  title: Boat Public API v1
  version: 1.0.0
  description: >
    Public JSON API for creating, operating, prompting, observing, and exposing
    sandboxes from backend services, CI jobs, hosted workers, and Boat
    automation products.


    The v1 reference intentionally documents the developer integration surface
    only. Dashboard billing actions are not part of v1.
servers:
  - url: https://boat.dev/api/v1
security:
  - BoatBearerAuth: []
tags:
  - name: Boat
    description: >-
      Unified Boat account, setup, lifecycle, prompting, event history, desktop
      access, and SSH operations.
paths:
  /sandboxes/{sandboxId}/command-history:
    get:
      tags:
        - Boat
      summary: List the command and process history
      description: >-
        Every command run through `POST /sandboxes/{sandboxId}/commands` in the
        last 90 days, and every other process that wrote to its stdout/stderr in
        the last 72 hours (mode `process`), newest first. Works while the
        sandbox is stopped.
      operationId: commandHistory
      parameters:
        - $ref: '#/components/parameters/SandboxId'
        - name: mode
          in: query
          schema:
            type: string
            examples:
              - process
              - commands
              - sync,detached
          description: >-
            Only these modes, comma-separated: sync, stream, detached, process,
            or `commands` for the first three. Default: all.
        - name: q
          in: query
          schema:
            type: string
            maxLength: 200
            examples:
              - npm run
          description: Only commands whose command line contains this text, in any case.
        - name: limit
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 20
        - name: cursor
          in: query
          schema:
            type: string
          description: The `nextCursor` of the previous page.
      responses:
        '200':
          description: One page of commands.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommandListResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  parameters:
    SandboxId:
      name: sandboxId
      in: path
      required: true
      schema:
        type: string
        pattern: ^bx_[23456789abcdefghjkmnpqrstuvwxyz]{8}$
      description: Public Sandbox id returned by create/list/get sandbox calls.
  schemas:
    CommandListResponse:
      allOf:
        - $ref: '#/components/schemas/SuccessBase'
        - type: object
          required:
            - commands
            - nextCursor
          properties:
            type:
              type: string
              const: command.list
            commands:
              type: array
              description: Newest first.
              items:
                $ref: '#/components/schemas/CommandRecord'
            nextCursor:
              type:
                - string
                - 'null'
              description: Pass as `cursor` to get the next page. Null on the last page.
    SuccessBase:
      type: object
      required:
        - ok
        - type
      properties:
        ok:
          type: boolean
          examples:
            - true
        type:
          type: string
          description: Stable success envelope discriminator added by v1.
    CommandRecord:
      type: object
      description: >-
        One command run through the commands endpoint (kept 90 days), or one
        process of the sandbox with mode `process` (kept 72 hours). Readable
        while the sandbox is stopped.
      required:
        - commandId
        - sandboxId
        - command
        - mode
        - status
        - stdoutBytes
        - stderrBytes
        - outputTruncated
        - startedAt
      properties:
        commandId:
          type: string
          examples:
            - cmd_k3v9x2mq7tbw
          description: Id of the record in the command history.
        sandboxId:
          type: string
        command:
          type: string
          description: The command text as sent (first 64 KiB).
        cwd:
          type:
            - string
            - 'null'
        mode:
          type: string
          enum:
            - sync
            - stream
            - detached
            - process
          description: >-
            sync: the request waited for the result. stream: the output was
            streamed. detached: started in the background. process: any other
            process of the sandbox, recorded from what it wrote to its
            stdout/stderr.
        processId:
          type:
            - integer
            - 'null'
          description: 'detached: the process id on the sandbox.'
        status:
          type: string
          enum:
            - running
            - exited
            - timed_out
            - failed
            - killed
            - lost
          description: >-
            failed: the command could not start or its result never arrived.
            killed: ended by a signal or by DELETE /commands/{processId}. lost:
            the sandbox stopped or its agent restarted while the command ran.
        exitCode:
          type:
            - integer
            - 'null'
        signal:
          type:
            - string
            - 'null'
        stdoutBytes:
          type: integer
          description: Bytes of stdout written so far.
        stderrBytes:
          type: integer
          description: Bytes of stderr written so far.
        outputTruncated:
          type: boolean
          description: >-
            True when part of the output is not kept: the sandbox cut the output
            of a waiting command at 8 MiB, or the account wrote more than 10 MiB
            (compressed) of command output, or of process output, in one hour.
        startedAt:
          type: string
          format: date-time
        finishedAt:
          type:
            - string
            - 'null'
          format: date-time
    ErrorEnvelope:
      type: object
      required:
        - ok
        - type
        - status
        - code
        - message
        - error
        - requestId
      properties:
        ok:
          type: boolean
          examples:
            - false
        type:
          type: string
          examples:
            - sandbox.error
        status:
          type: integer
          examples:
            - 409
        code:
          type: string
          examples:
            - provider_not_configured
        message:
          type: string
          examples:
            - Prompting is locked until Codex is configured on the Agents page.
        requestId:
          type: string
          examples:
            - req_01HX...
        error:
          type: object
          required:
            - code
            - message
            - status
          properties:
            code:
              type: string
            message:
              type: string
            status:
              type: integer
            details:
              type: object
              additionalProperties: true
  responses:
    BadRequest:
      description: Invalid request body or parameters.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          examples:
            invalid:
              value:
                ok: false
                type: sandbox.error
                status: 400
                code: invalid_json
                message: Request body must be valid JSON.
                error:
                  code: invalid_json
                  message: Request body must be valid JSON.
                  status: 400
                requestId: req_01HX...
    Unauthorized:
      description: Missing or invalid bearer token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
          examples:
            unauthorized:
              value:
                ok: false
                type: sandbox.error
                status: 401
                code: unauthorized
                message: Unauthorized
                error:
                  code: unauthorized
                  message: Unauthorized
                  status: 401
                requestId: req_01HX...
    NotFound:
      description: Resource not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
  securitySchemes:
    BoatBearerAuth:
      type: http
      scheme: bearer
      bearerFormat: sandbox_api_key
      description: >-
        Boat bearer token in the form `boat_...`. Service API keys authenticate
        sandbox operations.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.