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

# List sessions

> Returns a paginated list of organization's sessions.



## OpenAPI

````yaml /en/api-reference/openapi.en-v1.json get /v1/organizations/{organization_id}/sessions
openapi: 3.0.3
info:
  title: Public Portal API
  version: 1.0.0
  description: Public REST API for portal
servers:
  - url: https://api.staging.flxwvdexternal.com
    description: Staging API server.
security:
  - bearerAuth: []
tags: []
paths:
  /v1/organizations/{organization_id}/sessions:
    get:
      tags:
        - Sessions
      summary: List sessions
      description: Returns a paginated list of organization's sessions.
      operationId: get sessions
      parameters:
        - name: organization id
          in: path
          required: true
          schema:
            type: string
            pattern: ^[0-9a-f]{24}$
            minLength: 24
            maxLength: 24
          description: Organization identifier.
          example: 507f1f77bcf86cd799439011
        - name: page
          in: query
          required: false
          schema:
            type: integer
            default: 1
            minimum: 1
          description: Page number.
        - name: per_page
          in: query
          required: false
          schema:
            type: integer
            default: 100
            maximum: 100
            minimum: 1
          description: Number of items per page.
        - name: fields
          in: query
          required: false
          schema:
            type: string
            maxLength: 2048
          description: Field names of response elements, comma-separated.
        - name: filters
          in: query
          required: false
          schema:
            type: string
            maxLength: 5120
          description: JSON filter expression over paths of filterable response fields.
          examples:
            simple:
              summary: Filter by username
              value: '{"field":"user_name","op":"contains","value":"jdoe"}'
            complex-and:
              summary: Filter by status and connection state
              value: >-
                {"and":[{"field":"session_status","op":"eq","value":"active"},{"field":"connection_state","op":"eq","value":"active"}]}
            complex-or-and:
              summary: Combine OR and AND conditions
              value: >-
                {"and":[{"or":[{"field":"connection_state","op":"eq","value":"active"},{"field":"connection_state","op":"eq","value":"disconnected"}]},{"field":"current_dc_name","op":"contains","value":"dc-eu"}]}
        - name: sort
          in: query
          required: false
          schema:
            type: string
            pattern: ^([a-z_]+):(asc|desc)$
          description: >-
            Sorting expression in the format <field>:asc|desc. In aggregate
            mode, only accepts `group_by` fields or aggregated aliases (`count`,
            `<function>_<field>`).
        - name: aggregate
          in: query
          required: false
          schema:
            type: string
            maxLength: 1024
          description: >-
            JSON expression for aggregation. Structure:
            {"group_by":["field"],"aggregates":[{"field":"*","function":"count"}]}.
            Cannot be combined with `fields`.
          examples:
            group-by-connection-state-count:
              summary: Group by connection state and count
              value: >-
                {"group_by":["connection_state"],"aggregates":[{"field":"*","function":"count"}]}
            group-by-platform-avg-cpu:
              summary: Group by platform and calculate average
              value: >-
                {"group_by":["platform_type"],"aggregates":[{"field":"*","function":"count"},{"field":"cpu_usage","function":"avg"}]}
      responses:
        '200':
          description: Sessions retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetSessionsResponseV1'
              examples:
                paginated_result:
                  summary: Paginated list with sessions
                  value:
                    has_next: true
                    data:
                      - id: 550E8400-E29B-41D4-A716-446655440000
                        user_name: contoso\jdoe
                        session_type: vdi desktop
                        windows_session_id: 7
                        connection_state: active
                        start_date: '2026-03-15T08:30:00Z'
                        cpu_usage: 34.2
                        ram_usage_gb: 3.8
                        rtt_usage: 18.1
                        session_status: active
                        platform_type: windows
                        connected: true
                        current_session_id: 41
                        current_dc_name: dc-eu-01
                        current_uid_usage: 2.4
                        flexx_analyzer_executed: false
                        last_connection_time: '2026-03-15T09:45:11Z'
                        log_on_duration: 35
                        number_alerts_user: 0
                        number_alerts_vm: 1
                        ram_usage: 3891
                        ram_percentage: 47
                        session_key: 6BA7B810-9DAD-11D1-80B4-00C04FD430C8
                        workspace_id: 64f0c2a1b2d3e4f5060708aa
                        organization_id: 507f1f77bcf86cd799439011
                empty_result:
                  summary: No sessions found
                  value:
                    has_next: false
                    data: []
                aggregated_by_connection_state:
                  summary: Aggregated result by connection status
                  value:
                    has_next: false
                    data:
                      - connection_state: active
                        count: 120
                        avg_cpu_usage: 17.4
                      - connection_state: disconnected
                        count: 45
                        avg_cpu_usage: 3.1
        '400':
          description: Invalid request parameters.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                invalid_filters:
                  summary: Invalid filters format
                  value:
                    error:
                      message: Invalid filters format
                      code: bad_request
                      details: filters must be a valid JSON string
        '401':
          description: Not authorized or organization not accessible.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                organization_not_authorized:
                  summary: Organization access failure
                  value:
                    error:
                      message: Unauthorized
                      code: unauthorized
        '404':
          description: >-
            The requested resource was not found within the organization's
            authorized scope.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                resource_not_found:
                  summary: Requested resource not found
                  value:
                    error:
                      message: Not Found
                      code: not_found
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                unexpected_error:
                  summary: Unhandled failure
                  value:
                    error:
                      message: Internal Server Error
                      code: internal_error
components:
  schemas:
    GetSessionsResponseV1:
      type: object
      properties:
        has_next:
          type: boolean
          description: If another page is available.
        data:
          type: array
          items:
            $ref: '#/components/schemas/GetSessionItemV1'
      required:
        - has_next
        - data
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            code:
              type: string
            details:
              type: string
          required:
            - message
            - code
      required:
        - error
    GetSessionItemV1:
      type: object
      properties:
        id:
          type: string
          format: uuid
          pattern: ^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$
          minLength: 36
          maxLength: 36
          description: Session identifier.
        user_name:
          type: string
          description: User account of the session.
        session_type:
          type: string
          enum:
            - vdi desktop
            - application
            - sdi_desktop
            - device
          description: Session type.
        windows_session_id:
          type: integer
          description: Windows session identifier.
        connection_state:
          type: string
          enum:
            - unknown
            - connected
            - disconnected
            - terminated
            - preparing_session
            - active
            - reconnecting
            - non_broker_session
            - other
            - pending
          description: Session connection state.
        start_date:
          type: string
          description: Session start timestamp.
        cpu_usage:
          type: number
          nullable: true
          description: Current CPU usage.
        ram_usage_gb:
          type: number
          nullable: true
          description: Current RAM usage in gigabytes.
        rtt_usage:
          type: number
          nullable: true
          description: Current RTT usage.
        session_status:
          type: string
          description: Session status.
        platform_type:
          type: string
          enum:
            - windows
            - mac
            - linux
            - android
            - chrome_os
            - unknown
          description: Platform type.
        connected:
          type: boolean
          description: Current connection indicator.
        current_session_id:
          type: integer
          description: Current connection session identifier.
        current_dc_name:
          type: string
          description: Current data center name.
        current_uid_usage:
          type: number
          nullable: true
          description: Current UID usage.
        flexx_analyzer_executed:
          type: boolean
          description: If analyzer execution is finished.
        last_connection_time:
          type: string
          description: Timestamp string of the last connection.
        log_on_duration:
          type: number
          description: Login duration.
        number_alerts_user:
          type: number
          nullable: true
          description: Number of user alerts.
        number_alerts_vm:
          type: number
          nullable: true
          description: Number of Workspace alerts.
        ram_usage:
          type: number
          nullable: true
          description: Current RAM usage.
        ram_percentage:
          type: number
          nullable: true
          description: Current RAM usage percentage.
        session_key:
          type: string
          format: uuid
          pattern: ^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$
          minLength: 36
          maxLength: 36
          description: Session key.
        workspace_id:
          type: string
          pattern: ^[0-9a-f]{24}$
          minLength: 24
          maxLength: 24
          description: >-
            MongoDB identifier (_id) of the Workspace associated with the
            session, resolved from the session relationship.
        organization_id:
          type: string
          pattern: ^[0-9a-f]{24}$
          minLength: 24
          maxLength: 24
          description: Organization identifier associated with the session.
      required:
        - id
        - user_name
        - session_type
        - windows_session_id
        - connection_state
        - start_date
        - cpu_usage
        - ram_usage_gb
        - rtt_usage
        - session_status
        - platform_type
        - connected
        - current_session_id
        - current_dc_name
        - current_uid_usage
        - flexx_analyzer_executed
        - last_connection_time
        - log_on_duration
        - number_alerts_user
        - number_alerts_vm
        - ram_usage
        - ram_percentage
        - session_key
        - workspace_id
        - organization id
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````