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

# List processes

> The processes the workspace keeps, by pid: every live one and the
newest ended ones, a session's, those in a state, those a line ran,
those a job ran or those run on a machine (``provider:name``) when
named.

> [accordion] Errors
>
> | Status | Meaning |
> | - | - |
> | `400` | Bad request: malformed, a host not allowed, or a browser page from another origin |
> | `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}/processes
openapi: 3.2.0
info:
  title: Mirage API
  version: '0.1'
servers:
  - url: https://api.strukto.ai
    description: The hosted API
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
    parent: Workspace operations
  - name: Snapshots
  - name: Templates
  - name: Saved VFS
    x-group: VFS
    parent: Saved configurations
  - name: Saved CLIs
    x-group: CLIs
    parent: Saved configurations
  - name: Saved runtimes
    x-group: Runtimes
    parent: Saved configurations
  - name: Saved configurations
  - name: Policies
  - name: Asks
    parent: Workspace operations
  - name: Lines
    parent: Workspace operations
  - name: Jobs
    parent: Workspace operations
  - name: Processes
    parent: Workspace operations
  - name: Server
  - name: Auth
paths:
  /v1/workspaces/{workspace_id}/processes:
    get:
      tags:
        - Processes
      summary: List processes
      description: |-
        The processes the workspace keeps, by pid: every live one and the
        newest ended ones, a session's, those in a state, those a line ran,
        those a job ran or those run on a machine (``provider:name``) when
        named.
      operationId: list_processes_v1_workspaces__workspace_id__processes_get
      parameters:
        - $ref: '#/components/parameters/workspaceId'
        - name: session_id
          in: query
          required: false
          description: Only this session's records; every session's when absent.
          schema:
            type: string
        - name: state
          in: query
          required: false
          description: Only the records in this state.
          schema:
            $ref: '#/components/schemas/ProcessState'
        - name: line_id
          in: query
          required: false
          description: Only the processes this line ran.
          schema:
            type: string
        - name: job_id
          in: query
          required: false
          description: Only the processes this job ran, its own and every one under it.
          schema:
            type: string
        - name: machine
          in: query
          required: false
          description: Only the processes run on this machine, written `provider:name`.
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ProcessResponse'
                title: >-
                  Response List Processes V1 Workspaces  Workspace Id  Processes
                  Get
      servers:
        - url: http://127.0.0.1:8765
          description: A local daemon on its default port
components:
  parameters:
    workspaceId:
      name: workspace_id
      in: path
      required: true
      description: The workspace's id.
      schema:
        type: string
      example: demo
  schemas:
    ProcessState:
      enum:
        - running
        - stopping
        - exited
      title: ProcessState
      type: string
    ProcessResponse:
      properties:
        command:
          title: Command
          type: string
        cwd:
          type: string
          title: Cwd
        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
        group:
          title: Group
          type: integer
        line_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Line Id
        machine:
          title: Machine
          type: string
        machine_pid:
          anyOf:
            - $ref: '#/components/schemas/MachinePidResponse'
            - type: 'null'
        parent:
          anyOf:
            - type: integer
            - type: 'null'
          title: Parent
        pid:
          title: Pid
          type: integer
        runtime:
          anyOf:
            - type: string
            - type: 'null'
          title: Runtime
        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:
        - pid
        - session_id
        - line_id
        - parent
        - group
        - command
        - cwd
        - machine
        - runtime
        - machine_pid
        - state
        - started_at
        - ended_at
        - exit
        - signal
        - error
      title: ProcessResponse
      type: object
    MachinePidResponse:
      properties:
        exited:
          anyOf:
            - type: number
            - type: 'null'
          title: Exited
        pid:
          title: Pid
          type: integer
        started:
          title: Started
          type: number
      required:
        - pid
        - started
        - exited
      title: MachinePidResponse
      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.