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

# Search and filter Policy Components



## OpenAPI

````yaml https://api.draftt.io/swagger post /policy/{policyId}/component/query
openapi: 3.1.0
info:
  title: Draftt API
  version: 0.2.1
servers:
  - url: https://api.draftt.io/v1
security:
  - BearerAuth: []
paths:
  /policy/{policyId}/component/query:
    post:
      tags:
        - Policy Component
      summary: Search and filter Policy Components
      parameters:
        - name: policyId
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PolicyComponentQuery'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PolicyComponentResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    PolicyComponentQuery:
      type: object
      required:
        - orgId
        - policyId
      examples:
        - pageSize: 20
          filter:
            activeExtendedSupport: true
            extendedSupportAnnualCost:
              $gte: 1000
          componentData:
            select:
              - tags
          sort:
            urgency: desc
          pageToken: >-
            eyJ1bmlxdWVGaWVsZE5hbWUiOiJpZCIsInNvcnQiOnsidXJnZW5jeSI6eyJvcmRlciI6MCwiZGlyZWN0aW9uIjoiZGVzYyJ9LCJpZCI6eyJvcmRlciI6MSwiZGlyZWN0aW9uIjoiYXNjIn19LCJzb3J0VmFsdWVzIjp7InVyZ2VuY3kiOjUuNDM0NzgyNjA4Njk1NjUyLCJpZCI6IjUwMDg1In19
          calculateDisplayNames: true
        - filter:
            dueDate:
              $lte: '2026-01-01T00:00:00+00:00'
            urgency:
              $gte: 20
            technology:
              $like: rds*
          sort:
            dueDate: asc
        - filter:
            technology:
              $eq: k8s
            isCompliant: false
          componentData:
            filter:
              region:
                $eq: us-east-1
            select:
              - tags
              - customTags
          sort:
            urgency: desc
      properties:
        filter:
          $ref: '#/components/schemas/PolicyComponentFilter'
        componentData:
          type: object
          properties:
            filter:
              $ref: '#/components/schemas/ComponentFilter'
            select:
              type: array
              items:
                type: string
                enum:
                  - tags
                  - customTags
        calculateDisplayNames:
          type: boolean
          description: >-
            If true - will return a 'displayType' field containing a prettified
            technology field
        select:
          type: array
          description: >-
            If empty - will return all fields (except for tags), if passed will
            only return selected field
          items:
            type: string
            enum:
              - id
              - policyId
              - technology
              - name
              - componentId
              - urgency
              - effort
              - orgComplexity
              - priority
              - isCompliant
              - currentVersion
              - desiredVersion
              - recommendedVersion
              - status
              - extendedSupportAnnualCost
              - dueDate
              - createdAt
              - updatedAt
        sort:
          type: object
          description: >-
            Optional sorting options, if not passed will sort by creation date
            in ascending order, sorting by a non-unique value will sub-sort by a
            creation date in ascending order
          properties:
            id:
              type: string
              enum:
                - asc
                - desc
            policyId:
              type: string
              enum:
                - asc
                - desc
            technology:
              type: string
              enum:
                - asc
                - desc
            name:
              type: string
              enum:
                - asc
                - desc
            componentId:
              type: string
              enum:
                - asc
                - desc
            urgency:
              type: string
              enum:
                - asc
                - desc
            effort:
              type: string
              enum:
                - asc
                - desc
            orgComplexity:
              type: string
              enum:
                - asc
                - desc
            priority:
              type: string
              enum:
                - asc
                - desc
            isCompliant:
              type: string
              enum:
                - asc
                - desc
            currentVersion:
              type: string
              enum:
                - asc
                - desc
            desiredVersion:
              type: string
              enum:
                - asc
                - desc
            recommendedVersion:
              type: string
              enum:
                - asc
                - desc
            status:
              type: string
              enum:
                - asc
                - desc
            extendedSupportAnnualCost:
              type: string
              enum:
                - asc
                - desc
            activeExtendedSupport:
              type: string
              enum:
                - asc
                - desc
            dueDate:
              type: string
              enum:
                - asc
                - desc
            createdAt:
              type: string
              enum:
                - asc
                - desc
            updatedAt:
              type: string
              enum:
                - asc
                - desc
          maxProperties: 2
        pageToken:
          type: string
          description: Base64 token for pagination
        pageSize:
          type: integer
          minimum: 1
          maximum: 1000
          default: 100
          description: Number of items to return per page
    PolicyComponentResponse:
      type: object
      required:
        - items
      example:
        nextPageToken: >-
          eyJ1bmlxdWVGaWVsZE5hbWUiOiJpZCIsInNvcnQiOnsidXJnZW5jeSI6eyJvcmRlciI6MCwiZGlyZWN0aW9uIjoiZGVzYyJ9LCJpZCI6eyJvcmRlciI6MSwiZGlyZWN0aW9uIjoiYXNjIn19LCJzb3J0VmFsdWVzIjp7InVyZ2VuY3kiOjUuNDM0NzgyNjA4Njk1NjUyLCJpZCI6IjUwMDg1In19
        items:
          - id: '456654'
            technology: eks
            name: staging-cluster-us-east-1
            urgency: 62
            effort: 0
            priority: 0
            status: Outdated
            policyId: '1'
            componentId: '12321'
            orgComplexity: 0
            isCompliant: false
            currentVersion: '1.29'
            desiredVersion: '1.30'
            dueDate: '2025-03-23T00:00:00.000Z'
            createdAt: '2025-03-26T17:02:41.237Z'
            updatedAt: '2025-04-07T02:47:31.606Z'
            deletedAt: null
            recommendedVersion: '1.32'
            extendedSupportAnnualCost: 4380
            impendingDate: '2025-03-23T00:00:00.000Z'
            outdatedDate: '2026-03-23T00:00:00.000Z'
            activeExtendedSupport: true
            tags:
              environment: staging
              Terraform: 'true'
            displayName: Amazon EKS
          - ...
      properties:
        items:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                format: int64
                description: Policy component ID
              policyId:
                type: string
                format: int64
              technology:
                type: string
              displayType:
                type: string
              name:
                type: string
              componentId:
                type: string
                format: int64
              urgency:
                type: number
              effort:
                type: number
              orgComplexity:
                type: number
              priority:
                type: number
              isCompliant:
                type: boolean
              currentVersion:
                type: string
              desiredVersion:
                oneOf:
                  - type: string
                  - type: 'null'
              recommendedVersion:
                oneOf:
                  - type: string
                  - type: 'null'
              status:
                type: string
                enum:
                  - Impending
                  - Supported
                  - Outdated
              extendedSupportAnnualCost:
                oneOf:
                  - type: number
                  - type: 'null'
              dueDate:
                oneOf:
                  - type: string
                    format: date-time
                  - type: 'null'
              createdAt:
                oneOf:
                  - type: string
                    format: date-time
                  - type: 'null'
              updatedAt:
                oneOf:
                  - type: string
                    format: date-time
                  - type: 'null'
              deletedAt:
                oneOf:
                  - type: string
                    format: date-time
                  - type: 'null'
              tags:
                type: object
                additionalProperties: true
              customTags:
                type: object
                additionalProperties: true
        nextPageToken:
          oneOf:
            - type: string
              description: Token for fetching the next page of results
            - type: 'null'
    PolicyComponentFilter:
      type: object
      properties:
        $and:
          type: array
          items:
            $ref: '#/components/schemas/PolicyComponentFilter'
        $or:
          type: array
          items:
            $ref: '#/components/schemas/PolicyComponentFilter'
        id:
          $ref: '#/components/schemas/NumberOperatorBlock'
        policyId:
          $ref: '#/components/schemas/NumberOperatorBlock'
        technology:
          $ref: '#/components/schemas/StringOperatorBlock'
        name:
          $ref: '#/components/schemas/StringOperatorBlock'
        componentId:
          $ref: '#/components/schemas/NumberOperatorBlock'
        urgency:
          $ref: '#/components/schemas/NumberOperatorBlock'
        effort:
          $ref: '#/components/schemas/NumberOperatorBlock'
        orgComplexity:
          $ref: '#/components/schemas/NumberOperatorBlock'
        priority:
          $ref: '#/components/schemas/NumberOperatorBlock'
        isCompliant:
          $ref: '#/components/schemas/BooleanOperatorBlock'
        currentVersion:
          $ref: '#/components/schemas/StringOperatorBlock'
        desiredVersion:
          $ref: '#/components/schemas/StringOperatorBlock'
        recommendedVersion:
          $ref: '#/components/schemas/StringOperatorBlock'
        status:
          $ref: '#/components/schemas/StringOperatorBlock'
        extendedSupportAnnualCost:
          $ref: '#/components/schemas/NumberOperatorBlock'
        activeExtendedSupport:
          $ref: '#/components/schemas/BooleanOperatorBlock'
        dueDate:
          $ref: '#/components/schemas/StringOperatorBlock'
        createdAt:
          $ref: '#/components/schemas/StringOperatorBlock'
        updatedAt:
          $ref: '#/components/schemas/StringOperatorBlock'
    ComponentFilter:
      type: object
      properties:
        $and:
          type: array
          items:
            $ref: '#/components/schemas/ComponentFilter'
        $or:
          type: array
          items:
            $ref: '#/components/schemas/ComponentFilter'
        id:
          $ref: '#/components/schemas/NumberOperatorBlock'
        integrationId:
          $ref: '#/components/schemas/NumberOperatorBlock'
        uniqueIdentifier:
          $ref: '#/components/schemas/StringOperatorBlock'
        region:
          $ref: '#/components/schemas/StringOperatorBlock'
        vendor:
          $ref: '#/components/schemas/StringOperatorBlock'
        technology:
          $ref: '#/components/schemas/StringOperatorBlock'
        type:
          $ref: '#/components/schemas/StringOperatorBlock'
        version:
          $ref: '#/components/schemas/StringOperatorBlock'
        hasAvailableDraftts:
          $ref: '#/components/schemas/BooleanOperatorBlock'
        createdAt:
          $ref: '#/components/schemas/StringOperatorBlock'
        updatedAt:
          $ref: '#/components/schemas/StringOperatorBlock'
        tags$.*:
          $ref: '#/components/schemas/StringOperatorBlock'
        customTags$.*:
          $ref: '#/components/schemas/StringOperatorBlock'
      additionalProperties:
        oneOf:
          - $ref: '#/components/schemas/StringOperatorBlock'
          - not:
              type: object
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
          required:
            - message
      required:
        - error
    NumberOperatorBlock:
      type: object
      properties:
        $eq:
          type: number
          description: Equals operator
        $ne:
          type: number
          description: Not equals operator
        $gt:
          type: number
          description: Greater than operator
        $gte:
          type: number
          description: Greater than or equal operator
        $lt:
          type: number
          description: Less than operator
        $lte:
          type: number
          description: Less than or equal operator
        $in:
          type: array
          items:
            type: number
          description: In operator
        $nin:
          type: array
          items:
            type: number
          description: Not in operator
        $exists:
          type: boolean
          description: Exists operator
      minProperties: 1
      maxProperties: 1
    StringOperatorBlock:
      type: object
      properties:
        $eq:
          type: string
          description: Equals operator
        $ne:
          type: string
          description: Not equals operator
        $gt:
          type: string
          description: Greater than operator
        $gte:
          type: string
          description: Greater than or equal operator
        $lt:
          type: string
          description: Less than operator
        $lte:
          type: string
          description: Less than or equal operator
        $like:
          type: string
          description: >-
            Like operator, wildrards are defind as `*`, for example - `{$like:
            'abc*'}` - starts with abc
        $in:
          type: array
          items:
            type: string
          description: In operator
        $nin:
          type: array
          items:
            type: string
          description: Not in operator
        $exists:
          type: boolean
          description: Exists operator
      minProperties: 1
      maxProperties: 1
    BooleanOperatorBlock:
      type: object
      properties:
        $eq:
          type: boolean
          description: Equals operator
        $ne:
          type: boolean
          description: Not equals operator
        $exists:
          type: boolean
          description: Exists operator
      minProperties: 1
      maxProperties: 1
  responses:
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Not Found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    TooManyRequests:
      description: Too Many Requests
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalServerError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````