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

# Get command

> Get a command execution with its job, process, and machine IDs. Use the `line_id` returned by the shell endpoint.

Completed commands are retained for up to one hour, with a maximum of 1,024 records. Servers sharing a workspace store share these records; snapshots preserve completed records. Timestamps are Unix seconds.

> [accordion] Errors
>
> | Status | Meaning |
> | - | - |
> | `401` | The token is missing or wrong |
> | `404` | The workspace, session, job or file does not exist |
> | `422` | Validation Error |
> | `429` | Past a rate limit, or a new session past max\_sessions |
>
> See [error examples and recovery steps](https://docs.mirage.strukto.ai/api/errors.md). The [complete OpenAPI contract](https://github.com/strukto-ai/mirage/blob/main/docs/openapi.yaml) includes every response schema.


## OpenAPI

````yaml /openapi.yaml get /v1/workspaces/{workspace_id}/lines/{line_id}
openapi: 3.2.0
info:
  title: Mirage API
  version: '0.1'
servers:
  - url: http://127.0.0.1:8765
    description: A local server on its default port
security:
  - bearerAuth: []
tags:
  - name: Workspace operations
    x-group: Workspaces
  - name: Workspaces
    x-group: Lifecycle
    parent: Workspace operations
  - name: Sessions
  - name: Shell
    parent: Workspace operations
  - name: VFS
    parent: Workspace operations
  - name: Tools
  - name: Documents
    x-group: Agent Instructions
    parent: Workspace operations
  - name: Snapshots
  - name: Templates
    parent: Configuration
  - name: Saved VFS
    x-group: VFS
    parent: Configuration
  - name: Saved CLIs
    x-group: CLI
    parent: Configuration
  - name: Saved runtimes
    x-group: Runtime
    parent: Configuration
  - name: Saved machines
    x-group: Machine
    parent: Configuration
  - name: Configuration
  - name: Policies
    parent: Configuration
  - name: Asks
    parent: Workspace operations
    x-group: Approval requests
  - name: Lines
    parent: Workspace operations
    x-group: Commands
  - name: Jobs
    parent: Workspace operations
  - name: Processes
    parent: Workspace operations
  - name: Machines
    parent: Workspace operations
  - name: Server
  - name: Service
    parent: Server
  - name: Daemon
    parent: Server
  - name: Auth
paths:
  /v1/workspaces/{workspace_id}/lines/{line_id}:
    get:
      tags:
        - Lines
      summary: Get command
      description: >-
        Get a command execution with its job, process, and machine IDs. Use the
        `line_id` returned by the shell endpoint.


        Completed commands are retained for up to one hour, with a maximum of
        1,024 records. Servers sharing a workspace store share these records;
        snapshots preserve completed records. Timestamps are Unix seconds.
      operationId: get_line_v1_workspaces__workspace_id__lines__line_id__get
      parameters:
        - $ref: '#/components/parameters/workspaceId'
        - name: line_id
          in: path
          required: true
          description: Command execution ID returned as `line_id` by the shell endpoint.
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LineDetailResponse'
              example:
                id: line_019a5e2c-7b41-7c3e-9f20-4d8e1a6b5c37
                session_id: default
                command: sleep 30 & wait
                state: running
                started_at: 1794009600
                ended_at: null
                exit: null
                signal: null
                error: null
                jobs:
                  - job_019a5e2c-7b41-7c3e-9f20-4d8e1a6b5c38
                processes:
                  - 42
                machines:
                  - host:my-laptop
components:
  parameters:
    workspaceId:
      name: workspace_id
      in: path
      required: true
      description: Workspace ID.
      schema:
        type: string
      example: demo
  schemas:
    LineDetailResponse:
      properties:
        command:
          title: Command
          type: string
        ended_at:
          anyOf:
            - type: number
            - type: 'null'
          title: Ended At
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
        exit:
          anyOf:
            - type: integer
            - type: 'null'
          title: Exit
        id:
          title: Id
          type: string
        jobs:
          items:
            type: string
          title: Jobs
          type: array
        machines:
          items:
            type: string
          title: Machines
          type: array
        processes:
          items:
            type: integer
          title: Processes
          type: array
        session_id:
          type: string
          title: Session Id
        signal:
          anyOf:
            - type: integer
            - type: 'null'
          title: Signal
        started_at:
          title: Started At
          type: number
        state:
          title: State
          type: string
      required:
        - id
        - session_id
        - command
        - state
        - started_at
        - ended_at
        - exit
        - signal
        - error
        - jobs
        - processes
        - machines
      title: LineDetailResponse
      type: object
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        The server's token (MIRAGE_AUTH_TOKEN) or a JWT. A daemon in the default
        local mode with no token accepts requests without one.

````

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