> ## 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.

# Read a command's output

> Read the stored stdout or stderr of a command from a byte offset. Works while the sandbox is stopped.



## OpenAPI

````yaml openapi/boat-v1.yaml GET /sandboxes/{sandboxId}/command-history/{commandId}/logs
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/{commandId}/logs:
    get:
      tags:
        - Boat
      summary: Read a command's stored output
      description: >-
        Reads stdout or stderr from a byte offset, at most 1 MiB per call. Read
        on with `nextOffset` until `done`. A running detached command gains
        output every 30 s; a streamed one every 2 s. Works while the sandbox is
        stopped.
      operationId: commandLogs
      parameters:
        - $ref: '#/components/parameters/SandboxId'
        - name: commandId
          in: path
          required: true
          schema:
            type: string
        - name: stream
          in: query
          schema:
            type: string
            enum:
              - stdout
              - stderr
            default: stdout
        - name: offset
          in: query
          schema:
            type: integer
            minimum: 0
            default: 0
        - name: limit
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 1048576
            default: 1048576
        - name: encoding
          in: query
          schema:
            type: string
            enum:
              - utf8
              - base64
            default: utf8
          description: >-
            base64 returns the exact bytes. utf8 can split a character at the
            edge of a read.
      responses:
        '200':
          description: The bytes from `offset`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommandLogsResponse'
        '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:
    CommandLogsResponse:
      allOf:
        - $ref: '#/components/schemas/SuccessBase'
        - type: object
          required:
            - commandId
            - stream
            - offset
            - nextOffset
            - size
            - encoding
            - data
            - done
          properties:
            type:
              type: string
              const: command.logs
            commandId:
              type: string
            stream:
              type: string
              enum:
                - stdout
                - stderr
            offset:
              type: integer
              description: >-
                Byte position of the first byte in `data`. Greater than the
                requested offset only when output was not kept (see
                outputTruncated).
            nextOffset:
              type: integer
              description: Pass as `offset` to read on.
            size:
              type: integer
              description: Bytes the stream has so far.
            encoding:
              type: string
              enum:
                - utf8
                - base64
            data:
              type: string
            done:
              type: boolean
              description: >-
                True when the command ended and this read reached the end of the
                stream.
    SuccessBase:
      type: object
      required:
        - ok
        - type
      properties:
        ok:
          type: boolean
          examples:
            - true
        type:
          type: string
          description: Stable success envelope discriminator added by v1.
    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.