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

# List Processes

> List all processes running on a specific Machine within an app, with optional sorting parameters. The Machine must be started.




## OpenAPI

````yaml /api/machines/openapi.json get /v1/apps/{app_name}/machines/{machine_id}/ps
openapi: 3.1.0
info:
  title: Machines API
  description: >-
    This site hosts documentation generated from the Fly.io Machines API OpenAPI
    specification. Visit our complete [Machines API
    docs](https://fly.io/docs/machines/api/) for how to get started, more
    information about each endpoint, parameter descriptions, and examples.
  contact: {}
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  version: '1.0'
servers:
  - url: https://api.machines.dev
security:
  - FlyBearerAuth: []
tags:
  - name: Apps
    description: >-
      This site hosts documentation generated from the Fly.io Machines API
      OpenAPI specification. Visit our complete [Machines API
      docs](https://fly.io/docs/machines/api/apps-resource/) for details about
      using the Apps resource.
  - name: Machines
    description: >-
      This site hosts documentation generated from the Fly.io Machines API
      OpenAPI specification. Visit our complete [Machines API
      docs](https://fly.io/docs/machines/api/machines-resource/) for details
      about using the Machines resource.
  - name: TLS Certificates
    description: >
      This site hosts documentation generated from the Fly.io Machines API
      OpenAPI specification. Visit our complete [Machines API
      docs](https://fly.io/docs/machines/api/certificates-resource/) for details
      about using the TLS Certificates resource.
  - name: Volumes
    description: >-
      This site hosts documentation generated from the Fly.io Machines API
      OpenAPI specification. Visit our complete [Machines API
      docs](https://fly.io/docs/machines/api/volumes-resource/) for details
      about using the Volumes resource.
  - name: Postgres Clusters
    description: >-
      Create and manage Postgres clusters, including databases, users,
      extensions, backups, and app attachments.
externalDocs:
  url: https://fly.io/docs/machines/working-with-machines/
paths:
  /v1/apps/{app_name}/machines/{machine_id}/ps:
    get:
      tags:
        - Machines
      summary: List Processes
      description: >
        List all processes running on a specific Machine within an app, with
        optional sorting parameters. The Machine must be started.
      operationId: Machines_list_processes
      parameters:
        - name: app_name
          in: path
          description: Fly App Name
          required: true
          schema:
            type: string
        - name: machine_id
          in: path
          description: Machine ID
          required: true
          schema:
            type: string
        - name: sort_by
          in: query
          description: Field to sort processes by
          schema:
            type: string
            enum:
              - cpu
              - pid
              - stime
              - rtime
        - name: order
          in: query
          description: Sort order. Requires sort_by. Defaults to asc.
          schema:
            type: string
            enum:
              - asc
              - desc
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ProcessStat'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    ProcessStat:
      type: object
      properties:
        command:
          type: string
          description: The process's command line, with arguments separated by spaces.
        cpu:
          type: integer
          description: >-
            Average CPU usage over the process's lifetime, in percent of one
            CPU. May exceed 100

            on Machines with more than one CPU.
        directory:
          type: string
          description: The process's working directory.
        listen_sockets:
          type: array
          description: TCP sockets the process is listening on.
          items:
            $ref: '#/components/schemas/ListenSocket'
        pid:
          type: integer
          description: Process ID inside the Machine.
        rss:
          type: integer
          description: 'Resident set size: the physical memory the process uses, in bytes.'
        rtime:
          type: integer
          description: How long the process has been running, in seconds.
        stime:
          type: integer
          description: When the process started, in seconds since the Machine booted.
    ErrorResponse:
      type: object
      properties:
        details:
          type: object
          description: 'Deprecated: details about some errors. Do not rely on its contents.'
        error:
          type: string
          description: >-
            Human-readable description of the error. Its wording may change; use
            `status` to tell

            errors apart.
        status:
          type: object
          description: >-
            Machine-readable error code, set for some errors, such as
            `insufficient_capacity`,

            `volume_placement_capacity`, `name_taken`, `exec_request_too_large`,
            or

            `exec_output_too_large`.
          allOf:
            - $ref: '#/components/schemas/main.statusCode'
    ListenSocket:
      type: object
      properties:
        address:
          type: string
          description: >-
            Local address and port the socket is bound to, such as
            `0.0.0.0:8080` or `[::]:8080`.
        proto:
          type: string
          description: Protocol of the socket. Always `tcp`.
    main.statusCode:
      type: string
      enum:
        - unknown
        - insufficient_capacity
        - volume_placement_capacity
        - exec_request_too_large
        - exec_output_too_large
        - name_taken
      x-enum-varnames:
        - unknown
        - capacityErr
        - volumePlacementCapacityErr
        - execRequestTooLargeErr
        - execOutputTooLargeErr
        - nameTakenErr
  securitySchemes:
    FlyBearerAuth:
      type: http
      scheme: bearer
      description: >-
        A Fly API token with access to the requested organization or resource.
        Send it as `Authorization: Bearer <Fly API token>`.

````