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

# Query integrations with filtering, sorting and pagination

> Query integrations with filtering, sorting and pagination



## OpenAPI

````yaml https://api.draftt.io/swagger post /integration/query
openapi: 3.1.0
info:
  title: Draftt API
  version: 0.2.1
servers:
  - url: https://api.draftt.io/v1
security:
  - BearerAuth: []
paths:
  /integration/query:
    post:
      tags:
        - Integration
      summary: Query integrations with filtering, sorting and pagination
      description: Query integrations with filtering, sorting and pagination
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IntegrationQuery'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IntegrationResponse'
        '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:
    IntegrationQuery:
      type: object
      examples:
        - pageSize: 20
          filter:
            type:
              $eq: aws
          sort:
            createdAt: desc
        - filter:
            status:
              $eq: healthy
            type:
              $in:
                - aws
                - gcp
          sort:
            name: asc
      properties:
        filter:
          $ref: '#/components/schemas/IntegrationFilter'
        select:
          type: array
          description: >-
            If empty - will return all fields, if passed will only return
            selected fields
          items:
            type: string
            enum:
              - id
              - name
              - type
              - status
              - details
              - createdAt
              - updatedAt
        sort:
          type: object
          description: >-
            Optional sorting options, if not passed will sort by creation date
            in ascending order
          properties:
            id:
              type: string
              enum:
                - asc
                - desc
            name:
              type: string
              enum:
                - asc
                - desc
            type:
              type: string
              enum:
                - asc
                - desc
            status:
              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
    IntegrationResponse:
      type: object
      required:
        - items
      example:
        nextPageToken: >-
          eyJ1bmlxdWVGaWVsZE5hbWUiOiJpZCIsInNvcnQiOnsibmFtZSI6eyJkaXJlY3Rpb24iOiJhc2MifX19
        items:
          - id: '1'
            name: My AWS Integration
            type: aws
            status: healthy
            details:
              accountId: '123456789012'
            createdAt: '2024-12-01T12:00:00.000Z'
            updatedAt: '2024-12-23T12:00:00.000Z'
          - ...
      properties:
        items:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                format: int64
                description: Integration ID
              name:
                type: string
              type:
                type: string
              status:
                type: string
              details:
                type: object
                additionalProperties: true
              createdAt:
                oneOf:
                  - type: string
                    format: date-time
                  - type: 'null'
              updatedAt:
                oneOf:
                  - type: string
                    format: date-time
                  - type: 'null'
        nextPageToken:
          oneOf:
            - type: string
              description: Token for fetching the next page of results
            - type: 'null'
    IntegrationFilter:
      type: object
      properties:
        $and:
          type: array
          items:
            $ref: '#/components/schemas/IntegrationFilter'
        $or:
          type: array
          items:
            $ref: '#/components/schemas/IntegrationFilter'
        id:
          $ref: '#/components/schemas/NumberOperatorBlock'
        name:
          $ref: '#/components/schemas/StringOperatorBlock'
        type:
          $ref: '#/components/schemas/StringOperatorBlock'
        status:
          $ref: '#/components/schemas/StringOperatorBlock'
        createdAt:
          $ref: '#/components/schemas/StringOperatorBlock'
        updatedAt:
          $ref: '#/components/schemas/StringOperatorBlock'
    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
  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

````