> ## 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 patch policy targets

> Retrieve a paginated list of patch policy targets for an organization. Supports pagination, sorting, and filtering via a JSON filter string. The patch policy targets define when and how patches are applied to Workspaces.



## OpenAPI

````yaml /en/api-reference/openapi.en-v1.json get /v1/organizations/{organization_id}/patch-policy-targets
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}/patch-policy-targets:
    get:
      tags:
        - Patch policy targets
      summary: List patch policy targets
      description: >-
        Retrieve a paginated list of patch policy targets for an organization.
        Supports pagination, sorting, and filtering via a JSON filter string.
        The patch policy targets define when and how patches are applied to
        Workspaces.
      operationId: list patch policy targets
      parameters:
        - name: organization id
          in: path
          required: true
          schema:
            type: string
            maxLength: 24
            pattern: ^[0-9a-f]{24}$
          description: The unique identifier of the organization
          example: 507f1f77bcf86cd799439011
        - name: page
          in: query
          required: false
          schema:
            type: integer
            default: 1
            minimum: 1
          description: 'Page number (default: 1)'
        - name: per_page
          in: query
          required: false
          schema:
            type: integer
            default: 100
            maximum: 100
            minimum: 1
          description: 'Items per page (default: 100, max: 100)'
        - name: sort
          in: query
          required: false
          schema:
            type: string
          description: >-
            Sorting field with optional suffix order (:asc or :desc). Use
            response property names. Valid fields: id, name, created_at,
            timezone, should_restart, wake_on_lan, force_patching_configuration,
            is_in_maintenance, patch_policy_target_type. Example: "name:asc" or
            "created_at:desc"
        - name: fields
          in: query
          required: false
          schema:
            type: string
            maxLength: 2048
          description: >-
            Comma-separated list of fields to include in each patch policy
            target item. Selectable fields: id, name, created_by, created_at,
            timezone, should_restart, wake_on_lan, force_patching_configuration,
            is_in_maintenance, weeks, schedule, patch_policy_target_type,
            patch_policy_id. The field id is always included.
          example: name, timezone, patch policy id
        - name: filters
          in: query
          required: false
          schema:
            type: string
            maxLength: 5120
          description: >-
            Filter patch policy targets by one or more criteria. Provide a JSON
            object with filter conditions. You can filter by any field returned
            in the response. Use comparison operators (eq, ne, gt, gte, lt, lte,
            in, nin, contains, startsWith, endsWith, between) and combine
            multiple conditions with logical operators (and, or). Maximum
            length: 5120 characters.
          examples:
            simple:
              summary: Filter by target name
              description: >-
                Returns patch policy targets whose name contains the provided
                text.
              value: '{"field": "name", "op": "contains", "value": "Base"}'
            complex-and:
              summary: Filter by target type and restart behavior
              description: Returns Windows targets needing restart post-patching.
              value: >-
                {"and": [{"field": "patch_policy_target_type", "op": "eq",
                "value": "windows"}, {"field": "should_restart", "op": "eq",
                "value": true}]}
            complex-or-and:
              summary: Combine OR and AND conditions
              description: Match multiple time zones and exclude targets under maintenance.
              value: >-
                {"and": [{"or": [{"field": "timezone", "op": "eq", "value":
                "UTC"}, {"field": "timezone", "op": "eq", "value":
                "America/New_York"}]}, {"field": "is_in_maintenance", "op":
                "eq", "value": false}]}
      responses:
        '200':
          description: Paginated list of patch policy targets successfully retrieved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PatchPolicyTargetV1ListResponseV1'
              examples:
                single-target:
                  summary: Single patch policy target
                  value:
                    has_next: false
                    data:
                      - id: 66ab6cf4d4d2e709bafd404c
                        name: Base
                        created_by: 6439606652fc0c0051f1787b
                        created_at: '2024-08-01T11:09:40.719Z'
                        timezone: UTC
                        should_restart: true
                        wake_on_lan: true
                        force_patching_configuration: false
                        is_in_maintenance: false
                        weeks:
                          - 1
                          - 2
                        schedule:
                          MONDAY: {}
                          TUESDAY: {}
                          WEDNESDAY: {}
                          THURSDAY:
                            '9':
                              - 15
                              - 30
                              - 45
                            '10':
                              - 0
                              - 15
                              - 30
                              - 45
                            '11':
                              - 0
                              - 15
                              - 30
                              - 45
                            '12':
                              - 0
                              - 15
                              - 30
                              - 45
                            '13':
                              - 0
                              - 15
                              - 30
                              - 45
                            '14':
                              - 0
                              - 15
                              - 30
                              - 45
                            '15':
                              - 0
                          FRIDAY: {}
                          SATURDAY: {}
                          SUNDAY: {}
                        patch_policy_target_type: windows
                        patch_policy_id: 507f1f77bcf86cd799439011
                multiple-targets:
                  summary: Multiple patch policy targets
                  value:
                    has_next: true
                    data:
                      - id: 66ab6cf4d4d2e709bafd404c
                        name: Base
                        created_by: 6439606652fc0c0051f1787b
                        created_at: '2024-08-01T11:09:40.719Z'
                        timezone: UTC
                        should_restart: true
                        wake_on_lan: true
                        force_patching_configuration: false
                        is_in_maintenance: false
                        weeks:
                          - 1
                          - 2
                        schedule:
                          MONDAY: {}
                          TUESDAY: {}
                          WEDNESDAY: {}
                          THURSDAY:
                            '9':
                              - 15
                              - 30
                              - 45
                            '10':
                              - 0
                              - 15
                              - 30
                              - 45
                          FRIDAY: {}
                          SATURDAY: {}
                          SUNDAY: {}
                        patch_policy_target_type: windows
                        patch_policy_id: 507f1f77bcf86cd799439011
                      - id: 66ab6cf4d4d2e709bafd404d
                        name: Linux Base
                        created_by: 6439606652fc0c0051f1787b
                        created_at: '2024-08-02T10:00:00.000Z'
                        timezone: America/New_York
                        should_restart: false
                        wake_on_lan: false
                        force_patching_configuration: true
                        is_in_maintenance: false
                        weeks:
                          - 1
                        schedule:
                          MONDAY:
                            '8':
                              - 0
                              - 30
                          TUESDAY: {}
                          WEDNESDAY: {}
                          THURSDAY: {}
                          FRIDAY: {}
                          SATURDAY: {}
                          SUNDAY: {}
                        patch_policy_target_type: linux
                        patch_policy_id: 507f1f77bcf86cd799439012
                empty-list:
                  summary: Empty list when no targets exist
                  value:
                    has_next: false
                    data: []
                no-patch-policy:
                  summary: Target with no assigned patch policy
                  value:
                    has_next: false
                    data:
                      - id: 66ab6cf4d4d2e709bafd404c
                        name: Base
                        created_by: 6439606652fc0c0051f1787b
                        created_at: '2024-08-01T11:09:40.719Z'
                        timezone: UTC
                        should_restart: true
                        wake_on_lan: true
                        force_patching_configuration: false
                        is_in_maintenance: false
                        weeks:
                          - 1
                          - 2
                        schedule:
                          MONDAY: {}
                          TUESDAY: {}
                          WEDNESDAY: {}
                          THURSDAY: {}
                          FRIDAY: {}
                          SATURDAY: {}
                          SUNDAY: {}
                        patch_policy_target_type: null
                        patch_policy_id: null
        '400':
          $ref: '#/components/responses/BadRequest'
          description: Bad Request. Invalid pagination, sorting, or filters.
        '401':
          $ref: '#/components/responses/Unauthorized'
          description: >-
            Unauthorized: user does not have access to the organization, or the
            organization does not exist
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    PatchPolicyTargetV1ListResponseV1:
      type: object
      properties:
        has_next:
          type: boolean
          description: Indicates if more results are available on the next page
        data:
          type: array
          items:
            $ref: '#/components/schemas/PatchPolicyTargetV1'
          description: Array of patch policy target objects
      required:
        - has_next
        - data
    PatchPolicyTargetV1:
      type: object
      description: Patch policy target resource
      properties:
        id:
          type: string
          maxLength: 24
          pattern: ^[0-9a-f]{24}$
          description: Unique identifier of the patch policy target
          example: 66ab6cf4d4d2e709bafd404c
        name:
          type: string
          description: Patch policy target name
          example: Base
        created_by:
          type: string
          maxLength: 24
          pattern: ^[0-9a-f]{24}$
          description: User ID who created the patch policy target
          example: 6439606652fc0c0051f1787b
        created_at:
          type: string
          format: date-time
          description: Creation date and time of patch policy target (datetime ISO 8601)
          example: '2024-08-01T11:09:40.719Z'
        timezone:
          type: string
          description: >-
            Timezone for patch policy schedule. IANA timezone identifier or
            Windows timezone name.
          example: UTC
        should_restart:
          type: boolean
          description: Whether Workspaces should be restarted after patching
          example: true
        wake_on_lan:
          type: boolean
          description: If Wake on LAN should be used for patching
          example: true
        force_patching_configuration:
          type: boolean
          description: Whether forced patch configuration should be applied
          example: false
        is_in_maintenance:
          type: boolean
          description: If the patch policy target is currently in maintenance mode
          example: false
        weeks:
          type: array
          items:
            type: integer
            minimum: 1
            maximum: 4
          description: Array of week numbers (1-4) when patching should occur
          example:
            - 1
            - 2
        schedule:
          type: object
          description: >-
            Schedule defining when patching occurs. Keys are names of days
            (MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY).
            Values are empty objects or objects with hour keys (as strings)
            containing arrays of minute numbers.
          additionalProperties:
            type: object
            additionalProperties:
              type: array
              items:
                type: integer
                minimum: 0
                maximum: 59
          example:
            MONDAY: {}
            TUESDAY: {}
            WEDNESDAY: {}
            THURSDAY:
              '9':
                - 15
                - 30
                - 45
              '10':
                - 0
                - 15
                - 30
                - 45
              '11':
                - 0
                - 15
                - 30
                - 45
            FRIDAY: {}
            SATURDAY: {}
            SUNDAY: {}
        patch_policy_target_type:
          type: string
          enum:
            - windows
            - linux
            - null
          nullable: true
          description: Type of patch policy target ('windows', 'linux' or null).
          example: windows
        patch_policy_id:
          type: string
          maxLength: 24
          pattern: ^[0-9a-f]{24}$
          nullable: true
          description: >-
            Unique identifier of the associated patch policy. Null if no patch
            policy assigned.
          example: 507f1f77bcf86cd799439011
      required:
        - id
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            code:
              type: string
            details:
              type: string
          required:
            - message
            - code
      required:
        - error
  responses:
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    TooManyRequests:
      description: Too Many Requests
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InternalServerError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````