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

# Search contacts

> Search contacts matching a query.



## OpenAPI

````yaml /src/autogen/incoming-search-openapi3.0.yaml post /search
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:
  /search:
    post:
      tags:
        - Search
      summary: Search contacts
      description: Search contacts matching a query.
      operationId: search-contacts
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DataEnvelopeSearch'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatusEnvelopeSearchContactsData'
          description: OK
        default:
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Error
components:
  schemas:
    DataEnvelopeSearch:
      additionalProperties: true
      properties:
        data:
          $ref: '#/components/schemas/Search'
      required:
        - data
      type: object
    StatusEnvelopeSearchContactsData:
      additionalProperties: true
      properties:
        data:
          $ref: '#/components/schemas/SearchContactsData'
        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
    Search:
      additionalProperties: true
      properties:
        advanced_search:
          $ref: '#/components/schemas/AdvancedSearchOptions'
          description: >-
            Search parameters with filter query tree (see AdvancedSearchQuery
            for mutually exclusive options).
        include_interactions:
          description: Include interaction in results.
          examples:
            - true
          type: boolean
      required:
        - advanced_search
      type: object
    SearchContactsData:
      additionalProperties: true
      properties:
        contacts:
          description: Matched contacts.
          items:
            $ref: '#/components/schemas/SearchOutputContact'
          type:
            - array
            - 'null'
      required:
        - contacts
      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
    AdvancedSearchOptions:
      additionalProperties: true
      properties:
        page:
          description: Page index (0-based).
          examples:
            - 0
          format: int64
          minimum: 0
          type: integer
        per_page:
          description: Results per page.
          examples:
            - 50
          format: int64
          maximum: 1000
          minimum: 1
          type: integer
        query:
          $ref: '#/components/schemas/AdvancedSearchQuery'
          description: Filter query tree.
        sort_asc:
          description: Sort ascending.
          examples:
            - true
          type: boolean
        sort_attr:
          description: Field to sort by.
          enum:
            - surname
            - firstname
            - birthdate
            - gender
            - lastchange
            - mail
            - married_name
            - city
          examples:
            - surname
          type: string
      required:
        - per_page
      type: object
    SearchOutputContact:
      additionalProperties: true
      properties:
        CreatedAt:
          description: Timestamp when the contact was created.
          format: date-time
          readOnly: true
          type: string
        UpdatedAt:
          description: Timestamp when the contact was last updated.
          format: date-time
          readOnly: true
          type: string
        action_ids:
          description: IDs of actions of which the contact is targeted.
          items:
            format: int64
            minimum: 0
            type: integer
          type:
            - array
            - 'null'
        address:
          $ref: '#/components/schemas/Address'
          description: Postal address.
        age_category:
          description: Age category.
          format: int64
          minimum: 0
          type: integer
        birth_city:
          description: City of birth.
          type: string
        birth_country:
          description: Country code of birth.
          type: string
        birth_dept:
          description: Department of birth.
          type: string
        birthdate:
          description: Date of birth.
          format: date-time
          type: string
        black_list:
          description: Whether the contact has opted out of communications.
          type: boolean
        custom_fields:
          description: Organisation-defined custom fields.
          items:
            $ref: '#/components/schemas/CustomField'
          type:
            - array
            - 'null'
        firstname:
          description: First name.
          examples:
            - Jane
          type: string
        formdatas:
          description: Organisation-defined form data.
          items:
            $ref: '#/components/schemas/FormData'
          type:
            - array
            - 'null'
        gender:
          description: 'Gender. One of: M (Male), F (Female), O (Other). Empty if unknown.'
          enum:
            - M
            - F
            - O
          examples:
            - female
          type: string
        group_id:
          description: ID of the group the contact belongs to.
          format: int64
          minimum: 0
          readOnly: true
          type: integer
        id:
          description: Unique identifier of the contact.
          format: int64
          minimum: 0
          readOnly: true
          type: integer
        interactions:
          description: >-
            Interactions with this contact, included if the request's
            include_interactions flag is true.
          items:
            $ref: '#/components/schemas/Interaction'
          type:
            - array
            - 'null'
        lastchange:
          format: date-time
          readOnly: true
          type:
            - string
            - 'null'
        lastchangeuserid:
          format: int64
          minimum: 0
          readOnly: true
          type: integer
        mail:
          description: Primary email address.
          examples:
            - jane@example.com
          format: email
          type: string
        married_name:
          type: string
        membership_code:
          description: Membership code (prefix + serial).
          type: string
        membership_number:
          description: >-
            Membership serial number assigned when the contact's first
            membership is created.
          format: int64
          minimum: 0
          type: integer
        mobile:
          description: Mobile phone number.
          type: string
        mobile_invalid:
          description: Whether the mobile phone number is invalid.
          type: boolean
        nationality:
          description: Nationality.
          type: string
        notes:
          description: Notes associated with the contact.
          items:
            $ref: '#/components/schemas/Note'
          type:
            - array
            - 'null'
        phone:
          description: Landline phone number.
          type: string
        phone_invalid:
          description: Whether the landline phone number is invalid.
          type: boolean
        surname:
          description: Last (family) name.
          examples:
            - Doe
          type: string
        tags:
          description: Tags attached to the contact.
          items:
            $ref: '#/components/schemas/Tag'
          type:
            - array
            - 'null'
        user_contact_id:
          description: ID of the user associated with the contact, if any.
          format: int64
          type: integer
      required:
        - id
      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
    Address:
      additionalProperties: true
      properties:
        addition:
          description: Additional address info.
          type: string
        building:
          description: Building name or identifier.
          type: string
        building_type:
          description: Type of building.
          enum:
            - house
            - apartment
            - office
            - other
          type: string
        city:
          description: City name.
          examples:
            - Paris
          type: string
        country:
          description: Country.
          examples:
            - France
          type: string
        county:
          description: County or department.
          type: string
        door:
          description: Door or apartment identifier.
          type: string
        floor:
          description: Floor number.
          type: string
        housenumber:
          description: Street number.
          examples:
            - '12'
          type: string
        id:
          description: Unique identifier of the address.
          examples:
            - 7
          format: int64
          minimum: 0
          readOnly: true
          type: integer
        infos:
          description: Additional address information.
          type: string
        latitude:
          description: WGS-84 latitude.
          examples:
            - '48.8606'
          readOnly: true
          type: string
        location:
          description: Geocoded location string.
          examples:
            - 48.8606,2.3376
          readOnly: true
          type: string
        longitude:
          description: WGS-84 longitude.
          examples:
            - '2.3376'
          readOnly: true
          type: string
        pollingstation:
          type: string
        postalcode:
          description: Postal / ZIP code.
          examples:
            - '75001'
          type: string
        score:
          description: Address geocoding accuracy score 0-1
          format: int64
          readOnly: true
          type: integer
        state:
          description: State or region.
          type: string
        street:
          description: Street name.
          examples:
            - Rue de Rivoli
          type: string
      type: object
    CustomField:
      additionalProperties: true
      properties:
        data:
          description: Custom field value.
          examples:
            - XL
          type: string
        form_id:
          description: Form ID.
          format: int64
          minimum: 0
          type: integer
        form_ref_id:
          description: Form reference ID.
          format: int64
          minimum: 0
          type: integer
        id:
          description: Custom field definition ID.
          format: int64
          minimum: 0
          readOnly: true
          type: integer
      required:
        - id
        - form_id
        - form_ref_id
        - data
      type: object
    FormData:
      additionalProperties: true
      properties:
        contact_id:
          description: ID of the contact the form data belongs to.
          format: int64
          minimum: 0
          readOnly: true
          type: integer
        data:
          description: Form data value.
          examples:
            - Some answer
          type: string
        date:
          description: Date of the form data.
          format: date-time
          type: string
        form_id:
          description: Form ID.
          format: int64
          minimum: 0
          type: integer
        form_ref_id:
          description: Form reference ID.
          format: int64
          minimum: 0
          type: integer
        group_id:
          description: ID of the group the form data belongs to.
          format: int64
          minimum: 0
          readOnly: true
          type: integer
        id:
          description: Form data ID.
          format: int64
          minimum: 0
          readOnly: true
          type: integer
        survey_id:
          description: Survey ID if the form data is from a survey.
          format: int64
          minimum: 0
          type: integer
      required:
        - id
        - form_id
        - form_ref_id
        - data
      type: object
    Interaction:
      additionalProperties: true
      properties:
        address:
          description: >-
            Physical address related to the interaction, if applicable. (e.g.,
            meeting location)
          type: string
        comments:
          type: string
        contact_id:
          description: ID of the contact associated with this interaction.
          format: int64
          minimum: 0
          type: integer
        created_at:
          format: date-time
          type: string
        date_end:
          format: date-time
          type: string
        date_of_event:
          format: date-time
          type:
            - string
            - 'null'
        files:
          description: List of files attached to the interaction.
          items:
            $ref: '#/components/schemas/InteractionFile'
          type:
            - array
            - 'null'
        group_id:
          format: int64
          minimum: 0
          type: integer
        id:
          format: int64
          minimum: 0
          type: integer
        only_super_admin:
          description: >-
            If true, only user with specific permissions can see this
            interaction.
          type: boolean
        sub_type:
          enum:
            - incoming
            - ' outgoing'
          type: string
        tags:
          description: Tags attached to the interaction.
          items:
            $ref: '#/components/schemas/InteractionTag'
          type:
            - array
            - 'null'
        title:
          type: string
        type:
          enum:
            - email
            - letter
            - call
            - meeting
            - sms
            - donation
          type: string
        updated_at:
          format: date-time
          type: string
        user:
          $ref: '#/components/schemas/UserInfo'
          description: User who logged the interaction.
        user_id:
          description: ID of the user who logged the interaction.
          format: int64
          minimum: 0
          type: integer
      type: object
    Note:
      additionalProperties: true
      properties:
        contact_id:
          format: int64
          minimum: 0
          type: integer
        created_at:
          format: date-time
          type: string
        data:
          description: Content of the note.
          type: string
        group_id:
          format: int64
          minimum: 0
          type: integer
        id:
          format: int64
          minimum: 0
          type: integer
        only_super_admin:
          description: If true, only user with specific permissions can see this note.
          type: boolean
        pinned:
          description: Whether the note is pinned to the top of the contact's page.
          type: boolean
        updated_at:
          format: date-time
          type: string
        user:
          $ref: '#/components/schemas/User'
          description: User who created the note.
      required:
        - id
      type: object
    Tag:
      additionalProperties: true
      properties:
        name:
          description: Tag label.
          examples:
            - volunteer
          type: string
      required:
        - name
      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
    InteractionFile:
      additionalProperties: true
      properties:
        created_at:
          format: date-time
          type: string
        folder:
          type: string
        group_id:
          format: int64
          minimum: 0
          type: integer
        id:
          format: int64
          minimum: 0
          type: integer
        mime:
          type: string
        name:
          type: string
        owner_id:
          format: int64
          type: integer
        type:
          type: string
        updated_at:
          format: date-time
          type: string
        url:
          type: string
      type: object
    InteractionTag:
      additionalProperties: true
      properties:
        DeletedAt:
          $ref: '#/components/schemas/DeletedAt'
        color:
          type: string
        created_at:
          format: date-time
          type: string
        created_by:
          format: int64
          minimum: 0
          type: integer
        group_id:
          format: int64
          minimum: 0
          type: integer
        id:
          format: int64
          minimum: 0
          type: integer
        name:
          type: string
        updated_at:
          format: date-time
          type: string
      required:
        - DeletedAt
      type: object
    UserInfo:
      additionalProperties: true
      properties:
        CreatedAt:
          description: Timestamp when the user was created.
          format: date-time
          readOnly: true
          type: string
        UpdatedAt:
          description: Timestamp when the user was last updated.
          format: date-time
          readOnly: true
          type: string
        address:
          description: Street address.
          examples:
            - 1 rue de la paix
          type: string
        avatar:
          description: Avatar URL.
          examples:
            - https://example.com/avatar.png
          format: uri
          type: string
        birthdate:
          description: Birthdate.
          format: date-time
          type: string
        city:
          description: City.
          examples:
            - Paris
          type: string
        created:
          description: Legacy creation timestamp returned by the upstream service.
          format: date-time
          readOnly: true
          type: string
        firstname:
          description: First name.
          examples:
            - John
          type: string
        group_id:
          description: IDs of groups the user belongs to.
          items:
            format: int64
            type: integer
          type:
            - array
            - 'null'
        id:
          description: Unique identifier of the user.
          examples:
            - 101
          format: int64
          readOnly: true
          type: integer
        locale:
          description: Locale language.
          examples:
            - en
          type: string
        location:
          description: Geographic position as lat,lon string.
          examples:
            - 1.826483,-1.549486
          type: string
        mail:
          description: Email address.
          examples:
            - john.doe@example.com
          format: email
          type: string
        phone:
          description: Phone number.
          examples:
            - '0123456789'
          type: string
        postal:
          description: Postal code.
          examples:
            - '75000'
          type: string
        status:
          description: >-
            User status. Comma-separated list of strings. Values:
            'available_week_morning,available_week_night,available_holidays,available_weekend,not_set'.
          examples:
            - available_week_morning,available_weekend
          type: string
        surname:
          description: Last name.
          examples:
            - Doe
          type: string
        two_factor_enable:
          description: Indicates if two-factor authentication is enabled.
          type: boolean
        two_factor_method:
          description: Two-factor authentication method.
          enum:
            - email
            - totp
          type: string
      type: object
    User:
      additionalProperties: true
      properties:
        CreatedAt:
          description: Timestamp when the user was created.
          format: date-time
          readOnly: true
          type: string
        UpdatedAt:
          description: Timestamp when the user was last updated.
          format: date-time
          readOnly: true
          type: string
        address:
          description: Street address.
          examples:
            - 1 rue de la paix
          type: string
        avatar:
          description: Avatar URL.
          examples:
            - https://example.com/avatar.png
          format: uri
          type: string
        birthdate:
          description: Birthdate.
          format: date-time
          type: string
        city:
          description: City.
          examples:
            - Paris
          type: string
        contacts:
          description: Contacts (fiches) linked to this user account.
          items:
            $ref: '#/components/schemas/ContactRef'
          type:
            - array
            - 'null'
        created:
          description: Legacy creation timestamp returned by the upstream service.
          format: date-time
          readOnly: true
          type: string
        firstname:
          description: First name.
          examples:
            - John
          type: string
        group_id:
          description: IDs of groups the user belongs to.
          items:
            format: int64
            type: integer
          type:
            - array
            - 'null'
        id:
          description: Unique identifier of the user.
          examples:
            - 101
          format: int64
          readOnly: true
          type: integer
        locale:
          description: Locale language.
          examples:
            - en
          type: string
        location:
          description: Geographic position as lat,lon string.
          examples:
            - 1.826483,-1.549486
          type: string
        mail:
          description: Email address.
          examples:
            - john.doe@example.com
          format: email
          type: string
        phone:
          description: Phone number.
          examples:
            - '0123456789'
          type: string
        postal:
          description: Postal code.
          examples:
            - '75000'
          type: string
        role_data:
          $ref: '#/components/schemas/Role'
          description: User role.
        status:
          description: >-
            User status. Comma-separated list of strings. Values:
            'available_week_morning,available_week_night,available_holidays,available_weekend,not_set'.
          examples:
            - available_week_morning,available_weekend
          type: string
        surname:
          description: Last name.
          examples:
            - Doe
          type: string
        two_factor_enable:
          description: Indicates if two-factor authentication is enabled.
          type: boolean
        two_factor_method:
          description: Two-factor authentication method.
          enum:
            - email
            - totp
          type: string
      type: object
    AdvancedSearchCondition:
      additionalProperties: true
      properties:
        $condition:
          $ref: '#/components/schemas/AdvancedSearchConditionConditionStruct'
          description: List of conditions.
      required:
        - $condition
      type: object
    DeletedAt:
      additionalProperties: true
      properties:
        Time:
          format: date-time
          type: string
        Valid:
          type: boolean
      required:
        - Time
        - Valid
      type: object
    ContactRef:
      additionalProperties: true
      properties:
        id:
          description: Unique identifier of the contact.
          examples:
            - 42
          format: int64
          minimum: 0
          type: integer
      required:
        - id
      type: object
    Role:
      additionalProperties: true
      properties:
        color:
          description: Role colour as a hex string.
          examples:
            - '#DF0D73'
          type: string
        id:
          description: Role ID.
          format: int64
          minimum: 0
          type: integer
        mobile:
          description: Whether the role has mobile access.
          type: boolean
        name:
          description: Role name.
          type: string
        order:
          description: Display order for roles in role management view.
          format: int64
          minimum: 0
          type: integer
        type:
          description: Role type.
          enum:
            - superadmin
            - admin
            - manager
            - user
            - custom
          type: string
        web:
          description: Whether the role has web access.
          type: boolean
      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

````