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

# Contact count KPI

> Return KPI totals for contacts matching a query.



## OpenAPI

````yaml /src/autogen/incoming-search-openapi3.0.yaml post /kpi
openapi: 3.1.0
info:
  description: >-
    This OpenAPI 3.1 specification describes the public API of the Qomon
    platform. It is generated from the code and serves both as documentation for
    API consumers and as a contract for future development.
  title: Qomon API Reference
  version: 0.0.1
servers:
  - description: Production
    url: https://incoming.qomon.app
security:
  - bearerAuth: []
tags:
  - description: >-
      Search contacts and retrieve aggregate KPI totals based on advanced
      filters.
    name: Search
paths:
  /kpi:
    post:
      tags:
        - Search
      summary: Contact count KPI
      description: Return KPI totals for contacts matching a query.
      operationId: get-contacts-kpi
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DataEnvelopeSearchKpi'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatusEnvelopeKpiContactsData'
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Error
components:
  schemas:
    DataEnvelopeSearchKpi:
      additionalProperties: true
      properties:
        data:
          $ref: '#/components/schemas/SearchKpi'
      required:
        - data
      type: object
    StatusEnvelopeKpiContactsData:
      additionalProperties: true
      properties:
        data:
          $ref: '#/components/schemas/KpiContactsData'
        status:
          description: Operation result.
          examples:
            - success
          type: string
      required:
        - status
        - data
      type: object
    ErrorModel:
      additionalProperties: true
      properties:
        detail:
          description: >-
            A human-readable explanation specific to this occurrence of the
            problem.
          examples:
            - Property foo is required but is missing.
          type: string
        errors:
          description: Optional list of individual error details
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type:
            - array
            - 'null'
        instance:
          description: >-
            A URI reference that identifies the specific occurrence of the
            problem.
          examples:
            - https://example.com/error-log/abc123
          format: uri
          type: string
        status:
          description: HTTP status code
          examples:
            - 400
          format: int64
          type: integer
        title:
          description: >-
            A short, human-readable summary of the problem type. This value
            should not change between occurrences of the error.
          examples:
            - Bad Request
          type: string
        type:
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
          examples:
            - https://example.com/errors/example
          format: uri
          type: string
      type: object
    SearchKpi:
      additionalProperties: true
      properties:
        advanced_search:
          $ref: '#/components/schemas/AdvancedSearch'
          description: >-
            Search parameters with filter query tree (see AdvancedSearchQuery
            for mutually exclusive options).
      required:
        - advanced_search
      type: object
    KpiContactsData:
      additionalProperties: true
      properties:
        total:
          description: Total number of contacts matching the query.
          examples:
            - 1597
          format: int64
          type: integer
      required:
        - total
      type: object
    ErrorDetail:
      additionalProperties: true
      properties:
        location:
          description: >-
            Where the error occurred, e.g. 'body.items[3].tags' or
            'path.thing-id'
          type: string
        message:
          description: Error message text
          type: string
        value:
          description: The value at the given location
      type: object
    AdvancedSearch:
      additionalProperties: true
      properties:
        query:
          $ref: '#/components/schemas/AdvancedSearchQuery'
          description: Filter query tree.
      type: object
    AdvancedSearchQuery:
      oneOf:
        - additionalProperties: false
          description: Every group/condition must be satisfied.
          properties:
            $all:
              description: >-
                Condition groups (each group is a set of filters combined with
                AND or OR).
              items:
                $ref: '#/components/schemas/SearchConditionGroup'
              type: array
          required:
            - $all
          title: Match all (AND)
          type: object
        - additionalProperties: false
          description: At least one group/condition must be satisfied.
          properties:
            $at_least_one:
              description: >-
                Condition groups (each group is a set of filters combined with
                AND or OR).
              items:
                $ref: '#/components/schemas/SearchConditionGroup'
              type: array
          required:
            - $at_least_one
          title: Match at least one (OR)
          type: object
    SearchConditionGroup:
      oneOf:
        - additionalProperties: false
          description: Every group/condition must be satisfied.
          properties:
            $all:
              description: Individual filter conditions.
              items:
                $ref: '#/components/schemas/AdvancedSearchCondition'
              type: array
          required:
            - $all
          title: Match all (AND)
          type: object
        - additionalProperties: false
          description: At least one group/condition must be satisfied.
          properties:
            $at_least_one:
              description: Individual filter conditions.
              items:
                $ref: '#/components/schemas/AdvancedSearchCondition'
              type: array
          required:
            - $at_least_one
          title: Match at least one (OR)
          type: object
        - additionalProperties: false
          description: None of these conditions may be satisfied.
          properties:
            $not_all:
              description: Individual filter conditions.
              items:
                $ref: '#/components/schemas/AdvancedSearchCondition'
              type: array
          required:
            - $not_all
          title: Match none (NOT)
          type: object
    AdvancedSearchCondition:
      additionalProperties: true
      properties:
        $condition:
          $ref: '#/components/schemas/AdvancedSearchConditionConditionStruct'
          description: List of conditions.
      required:
        - $condition
      type: object
    AdvancedSearchConditionConditionStruct:
      additionalProperties: true
      properties:
        attr:
          description: Attribute to filter on.
          examples:
            - city
          type: string
        form_id:
          description: Form ID when filtering on contacts' formdata.
          examples:
            - 123
          format: int64
          type: integer
        form_ref_ids:
          description: Refvalue IDs when filtering on contacts' formdata.
          examples:
            - - 1
              - 2
              - 3
          items:
            format: int64
            type: integer
          type:
            - array
            - 'null'
        from:
          description: Lower bound of a range filter (inclusive).
        ope:
          description: Operator to apply on the attribute.
          enum:
            - ext
            - not_ext
            - eql
            - not_eql
            - contains
            - not_contains
            - range
            - lte
            - gte
            - start_with
            - not_start_with
            - end_with
            - eql:strictdata
            - not_eql:strictdata
          examples:
            - eql
          type: string
        to:
          description: Upper bound of a range filter (inclusive).
        value:
          description: Value to compare the attribute against.
      required:
        - attr
        - ope
      type: object
  securitySchemes:
    bearerAuth:
      bearerFormat: opaque
      description: >-
        OAuth2 access token. Pass the token in the Authorization header as
        `Bearer <token>`. The token is looked up in Redis to resolve the caller
        identity.
      scheme: bearer
      type: http

````