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

# Resolve contacts segment

> Resolves the paginated contact audience matching the given filter rules
and channel — the real backend for the segment builder in the campaign
wizard's recipients step (replaces the client-side-only resolution the
frontend uses as a documented stopgap today). Returns HTTP 206 instead
of 200 when more pages are available.



## OpenAPI

````yaml /api/services-api.yaml post /v1/tenants/{tenantID}/contacts/segment
openapi: 3.0.3
info:
  description: >-
    Talqui is an omnichannel customer service platform that unifies
    conversations from WhatsApp, Instagram, Telegram, and many other channels
    into a single attendant panel, alongside a broader ecosystem of plugins and
    integrations. This API gives developers programmatic access to Talqui's
    services layer, exposing the operations needed to read and manage tenants,
    conversations, plugins, and related resources that power that platform.


    Authentication is available on behalf of an Operator (the default for this
    API), a Plugin Connection, or a Plugin — see the [Talqui authentication
    guide](https://docs.talqui.chat/guides/introduction/authentication/) for how
    each token is obtained and when to use it.


    Need help or have questions not covered here? Reach out to
    support@talqui.com.
  license:
    name: ISC
    url: https://opensource.org/license/isc-license-txt
  title: Talqui - Services API
  version: 0.65.0
servers:
  - description: Production
    url: https://services-api.talqui.chat
security: []
tags:
  - name: Tenants
  - name: Settings
  - name: Analytics
  - name: Campaigns
  - name: Campaigns models
  - name: Contacts
  - name: Handoff links
  - name: Inboxes
  - name: Messages
  - name: Notifications
  - name: Sessions
  - name: Operators
  - name: Plugins
  - name: Setup
  - name: Uploads
paths:
  /v1/tenants/{tenantID}/contacts/segment:
    post:
      tags:
        - Contacts
      summary: Resolve contacts segment
      description: |-
        Resolves the paginated contact audience matching the given filter rules
        and channel — the real backend for the segment builder in the campaign
        wizard's recipients step (replaces the client-side-only resolution the
        frontend uses as a documented stopgap today). Returns HTTP 206 instead
        of 200 when more pages are available.
      operationId: ResolveContactsSegmentController
      parameters:
        - in: path
          name: tenantID
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              properties:
                channel:
                  description: The campaign channel URN to check reachability against.
                  type: string
                filters:
                  default: []
                  description: >-
                    AND-combined filter rules — see ContactSegmentFilter for the
                    wire format.
                  items:
                    properties:
                      criterion:
                        description: >-
                          The field/criterion name — see the engine for the
                          recognized set.
                        type: string
                      id:
                        description: >-
                          Client-generated identifier for this rule; echoed
                          back, never used for logic.
                        type: string
                      operator:
                        description: One of the CONTACT_SEGMENT_CONDITIONALS values.
                        enum:
                          - eq
                          - ne
                          - ex
                          - nex
                          - ha
                          - nh
                          - gt
                          - lt
                          - gte
                          - lte
                          - sw
                          - ew
                        type: string
                      query:
                        default: []
                        description: >-
                          Operand values for this rule — usually a
                          single-element array.
                        items: {}
                        type: array
                      schema:
                        description: >-
                          Whether this criterion is native to Contact
                          ("contact") or requires a join ("interaction").
                        enum:
                          - contact
                          - interaction
                        type: string
                    required:
                      - id
                      - schema
                      - criterion
                      - operator
                    type: object
                  type: array
                page:
                  default: 1
                  description: 1-indexed page number to fetch.
                  maximum: 9007199254740991
                  minimum: 1
                  type: integer
                perPage:
                  default: 50
                  description: Number of contacts per page (max 200).
                  maximum: 200
                  minimum: 1
                  type: integer
              required:
                - channel
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                additionalProperties: false
                properties:
                  contacts:
                    description: >-
                      Contacts matching the given filters and channel, for the
                      requested page.
                    items:
                      additionalProperties: false
                      properties:
                        contactBlock:
                          description: >-
                            Whether this contact is blocked from starting new
                            sessions.
                          type: boolean
                        contactChannels:
                          description: Channels this contact has interacted through.
                          items:
                            type: string
                          type: array
                        contactEmail:
                          description: Email address of the contact.
                          type: string
                        contactEmailVerified:
                          description: Whether the contact email address has been verified.
                          type: boolean
                        contactExternal:
                          additionalProperties:
                            type: string
                          description: >-
                            External identifiers for this contact, keyed by
                            channel.
                          type: object
                        contactFirstname:
                          description: First name of the contact.
                          type: string
                        contactID:
                          description: Unique identifier for this contact.
                          type: string
                        contactLastSessionID:
                          description: >-
                            Identifier of the contact most recent session, if
                            any.
                          nullable: true
                          type: string
                        contactLastname:
                          description: Last name of the contact.
                          type: string
                        contactMeta:
                          additionalProperties: {}
                          description: Arbitrary metadata attached to the contact.
                          type: object
                        contactNameVerified:
                          description: Whether the contact name has been verified.
                          type: boolean
                        contactPhone:
                          description: Phone number of the contact.
                          type: string
                        contactPhoneVerified:
                          description: Whether the contact phone number has been verified.
                          type: boolean
                        contactPhoto:
                          description: URL of the contact profile photo, if available.
                          nullable: true
                          type: string
                        contactSummary:
                          description: >-
                            AI-generated summary of the relationship/history
                            with this contact, if available.
                          nullable: true
                          type: string
                        contactTags:
                          description: Tags used for organizing/filtering contacts.
                          items:
                            type: string
                          type: array
                        createdAt:
                          description: When this contact was created.
                          format: date-time
                          type: string
                        organizationID:
                          description: The Talqui organization this contact belongs to.
                          type: string
                        tenantID:
                          description: The tenant this contact belongs to.
                          type: string
                        updatedAt:
                          description: When this contact was last updated.
                          format: date-time
                          type: string
                      required:
                        - organizationID
                        - tenantID
                        - contactID
                        - contactExternal
                        - contactFirstname
                        - contactLastname
                        - contactNameVerified
                        - contactPhone
                        - contactPhoneVerified
                        - contactEmail
                        - contactEmailVerified
                        - contactSummary
                        - contactChannels
                        - contactPhoto
                        - contactTags
                        - contactMeta
                        - contactLastSessionID
                        - contactBlock
                        - createdAt
                        - updatedAt
                      type: object
                    type: array
                  meta:
                    additionalProperties: false
                    description: Pagination metadata.
                    properties:
                      count:
                        description: Number of items in this page.
                        type: number
                      currentPage:
                        description: The page number returned.
                        type: number
                      hasMore:
                        description: Whether more pages are available.
                        type: boolean
                      perPage:
                        description: Number of items per page.
                        type: number
                      totalCount:
                        description: Total number of contacts matching the query.
                        type: number
                      totalPages:
                        description: Total number of pages available.
                        type: number
                    required:
                      - hasMore
                      - count
                      - totalCount
                      - totalPages
                      - currentPage
                      - perPage
                    type: object
                required:
                  - contacts
                  - meta
                type: object
          description: Response for status 200.
        '206':
          content:
            application/json:
              schema:
                additionalProperties: false
                properties:
                  contacts:
                    description: >-
                      Contacts matching the given filters and channel, for the
                      requested page.
                    items:
                      additionalProperties: false
                      properties:
                        contactBlock:
                          description: >-
                            Whether this contact is blocked from starting new
                            sessions.
                          type: boolean
                        contactChannels:
                          description: Channels this contact has interacted through.
                          items:
                            type: string
                          type: array
                        contactEmail:
                          description: Email address of the contact.
                          type: string
                        contactEmailVerified:
                          description: Whether the contact email address has been verified.
                          type: boolean
                        contactExternal:
                          additionalProperties:
                            type: string
                          description: >-
                            External identifiers for this contact, keyed by
                            channel.
                          type: object
                        contactFirstname:
                          description: First name of the contact.
                          type: string
                        contactID:
                          description: Unique identifier for this contact.
                          type: string
                        contactLastSessionID:
                          description: >-
                            Identifier of the contact most recent session, if
                            any.
                          nullable: true
                          type: string
                        contactLastname:
                          description: Last name of the contact.
                          type: string
                        contactMeta:
                          additionalProperties: {}
                          description: Arbitrary metadata attached to the contact.
                          type: object
                        contactNameVerified:
                          description: Whether the contact name has been verified.
                          type: boolean
                        contactPhone:
                          description: Phone number of the contact.
                          type: string
                        contactPhoneVerified:
                          description: Whether the contact phone number has been verified.
                          type: boolean
                        contactPhoto:
                          description: URL of the contact profile photo, if available.
                          nullable: true
                          type: string
                        contactSummary:
                          description: >-
                            AI-generated summary of the relationship/history
                            with this contact, if available.
                          nullable: true
                          type: string
                        contactTags:
                          description: Tags used for organizing/filtering contacts.
                          items:
                            type: string
                          type: array
                        createdAt:
                          description: When this contact was created.
                          format: date-time
                          type: string
                        organizationID:
                          description: The Talqui organization this contact belongs to.
                          type: string
                        tenantID:
                          description: The tenant this contact belongs to.
                          type: string
                        updatedAt:
                          description: When this contact was last updated.
                          format: date-time
                          type: string
                      required:
                        - organizationID
                        - tenantID
                        - contactID
                        - contactExternal
                        - contactFirstname
                        - contactLastname
                        - contactNameVerified
                        - contactPhone
                        - contactPhoneVerified
                        - contactEmail
                        - contactEmailVerified
                        - contactSummary
                        - contactChannels
                        - contactPhoto
                        - contactTags
                        - contactMeta
                        - contactLastSessionID
                        - contactBlock
                        - createdAt
                        - updatedAt
                      type: object
                    type: array
                  meta:
                    additionalProperties: false
                    description: Pagination metadata.
                    properties:
                      count:
                        description: Number of items in this page.
                        type: number
                      currentPage:
                        description: The page number returned.
                        type: number
                      hasMore:
                        description: Whether more pages are available.
                        type: boolean
                      perPage:
                        description: Number of items per page.
                        type: number
                      totalCount:
                        description: Total number of contacts matching the query.
                        type: number
                      totalPages:
                        description: Total number of pages available.
                        type: number
                    required:
                      - hasMore
                      - count
                      - totalCount
                      - totalPages
                      - currentPage
                      - perPage
                    type: object
                required:
                  - contacts
                  - meta
                type: object
          description: Response for status 206.
        '400':
          content:
            application/json:
              schema:
                properties:
                  errors:
                    items:
                      oneOf:
                        - $ref: '#/components/schemas/MissingTenantIDError'
                        - $ref: '#/components/schemas/InvalidChannelError'
                        - $ref: '#/components/schemas/RequestValidationError'
                    maxItems: 1
                    minItems: 1
                    type: array
                required:
                  - errors
                type: object
          description: >-
            MissingTenantIDError (error_code 1001): tenantID absent from the
            URL. | InvalidChannelError (error_code 1700): channel missing or not
            a valid campaign channel. | RequestValidationError (error_code
            1002): request body fails schema validation.
        '401':
          content:
            application/json:
              schema:
                properties:
                  errors:
                    items:
                      $ref: '#/components/schemas/UnauthorizedError'
                    maxItems: 1
                    minItems: 1
                    type: array
                required:
                  - errors
                type: object
          description: 'UnauthorizedError (error_code 1003): missing/invalid operator token.'
        '403':
          content:
            application/json:
              schema:
                properties:
                  errors:
                    items:
                      $ref: '#/components/schemas/ForbiddenError'
                    maxItems: 1
                    minItems: 1
                    type: array
                required:
                  - errors
                type: object
          description: 'ForbiddenError (error_code 1004): operator token rejected upstream.'
        '500':
          content:
            application/json:
              schema:
                properties:
                  errors:
                    items:
                      $ref: '#/components/schemas/UnknownError'
                    maxItems: 1
                    minItems: 1
                    type: array
                required:
                  - errors
                type: object
          description: >-
            UnknownError (error_code 5999): Unexpected internal error not
            otherwise documented for this endpoint.
      security:
        - operatorAuth: []
components:
  schemas:
    MissingTenantIDError:
      additionalProperties: false
      properties:
        error:
          enum:
            - MissingTenantIDError
          type: string
        error_code:
          enum:
            - 1001
          type: number
        message:
          example: tenantID is required.
          type: string
        statusCode:
          enum:
            - 400
          type: number
      required:
        - statusCode
        - error
        - error_code
        - message
      type: object
    InvalidChannelError:
      additionalProperties: false
      properties:
        error:
          enum:
            - InvalidChannelError
          type: string
        error_code:
          enum:
            - 1700
          type: number
        message:
          example: channel is required and must be a valid campaign channel URN.
          type: string
        statusCode:
          enum:
            - 400
          type: number
      required:
        - statusCode
        - error
        - error_code
        - message
      type: object
    RequestValidationError:
      additionalProperties: false
      properties:
        error:
          enum:
            - RequestValidationError
          type: string
        error_code:
          enum:
            - 1002
          type: number
        fields:
          items:
            additionalProperties: false
            properties:
              allowed:
                type: string
              field:
                type: string
              received:
                type: string
            required:
              - field
              - received
              - allowed
            type: object
          type: array
        message:
          example: Invalid request data.
          type: string
        statusCode:
          enum:
            - 400
          type: number
      required:
        - statusCode
        - error
        - error_code
        - message
        - fields
      type: object
    UnauthorizedError:
      additionalProperties: false
      properties:
        error:
          enum:
            - UnauthorizedError
          type: string
        error_code:
          enum:
            - 1003
          type: number
        message:
          example: You are not authorized to perform this request.
          type: string
        statusCode:
          enum:
            - 401
          type: number
      required:
        - statusCode
        - error
        - error_code
        - message
      type: object
    ForbiddenError:
      additionalProperties: false
      properties:
        error:
          enum:
            - ForbiddenError
          type: string
        error_code:
          enum:
            - 1004
          type: number
        message:
          example: You do not have access to this resource.
          type: string
        statusCode:
          enum:
            - 403
          type: number
      required:
        - statusCode
        - error
        - error_code
        - message
      type: object
    UnknownError:
      additionalProperties: false
      properties:
        error:
          enum:
            - UnknownError
          type: string
        error_code:
          enum:
            - 5999
          type: number
        message:
          example: For some unknown reason your request has not succeeded.
          type: string
        statusCode:
          enum:
            - 500
          type: number
      required:
        - statusCode
        - error
        - error_code
        - message
      type: object
  securitySchemes:
    operatorAuth:
      bearerFormat: JWT
      description: >-
        Behalf of an Operator (default). A JWT issued by Talqui Core when an
        operator signs in, scoped to every tenant that operator belongs to. Send
        as `Authorization: Bearer <jwt-token>`.
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.