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

# Get customers count

> Available for Text App only. Returns a count of customers matching the specified search criteria. The request body follows the same structure as `list_customers`, but sorting and pagination parameters are ignored.

**Required scopes:** `customers:ro`


## OpenAPI

````yaml /api/customer-data-platform/openapi.json post /v1/get_customers_count
openapi: 3.0.0
info:
  title: Customer Data Platform API
  description: A service for collecting, storing, and managing end-user data.
  version: 0.0.1
servers:
  - url: https://api.text.com/cdp
    description: Main production server URL
security:
  - PersonalAccessToken: []
  - OAuth2BearerToken:
      - customers:ro
paths:
  /v1/get_customers_count:
    post:
      tags:
        - Customers
      summary: Get customers count
      description: >-
        Available for Text App only. Returns a count of customers matching the
        specified search criteria. The request body follows the same structure
        as `list_customers`, but sorting and pagination parameters are ignored.
      operationId: get-customers-count
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetCustomersCountRequest'
            example:
              query: john
              filters:
                - operator: AND
                  clauses:
                    - field: country
                      operator: is
                      values:
                        - Poland
      responses:
        '200':
          description: The count of customers matching the search criteria.
          content:
            application/json:
              schema:
                type: object
                properties:
                  count:
                    type: integer
                    format: int64
                    example: 1523
              example:
                count: 1523
        '400':
          description: Invalid request (validation error).
        '401':
          description: Invalid access token
        '403':
          description: Insufficient scopes
        '422':
          description: Invalid request body
        '500':
          description: Internal error
      security:
        - PersonalAccessToken: []
        - OAuth2BearerToken:
            - customers:ro
components:
  schemas:
    GetCustomersCountRequest:
      allOf:
        - $ref: '#/components/schemas/CustomerSearchBase'
    CustomerSearchBase:
      type: object
      properties:
        query:
          type: string
          minLength: 3
          description: >-
            A free-text search query across `name`, `email`, and `phone_number`
            fields. Automatically excludes fields that are explicitly filtered.
          example: john smith
        filters:
          type: array
          description: An array of filter groups combined with `AND` logic.
          items:
            $ref: '#/components/schemas/FilterGroup'
    FilterGroup:
      type: object
      required:
        - operator
        - clauses
      properties:
        operator:
          type: string
          enum:
            - AND
            - OR
          description: The logical operator to combine clauses within this group.
        clauses:
          type: array
          minItems: 1
          description: The filter clauses to be combined with the specified operator.
          items:
            $ref: '#/components/schemas/Clause'
      example:
        operator: AND
        clauses:
          - field: name
            operator: contains
            values:
              - john
          - field: email
            operator: exists
    Clause:
      type: object
      required:
        - operator
      properties:
        field:
          type: string
          enum:
            - name
            - email
            - phone_number
            - phone_number_country_code
            - country
            - country_code
            - last_activity
            - last_visit_started
            - visits_count
            - page_views_count
            - chats_count
            - threads_count
            - greetings_accepted_count
            - greetings_converted_count
            - tickets_count
            - tickets_inbox_count
            - tickets_archive_count
            - tickets_spam_count
            - tickets_trash_count
            - orders_count
            - cart_last_updated_at
            - cart_total_usd
            - address_street
            - address_city
            - address_country
            - address_state
            - address_postal_code
          description: The field name to filter on (required for all operators).
        operator:
          type: string
          enum:
            - contains
            - is
            - range
            - exists
            - starts_with
          description: >-
            The filter operator:

            - `exists` — Check if field exists/is populated (name, email,
            phone_number, address_street, address_city, address_country,
            address_state, address_postal_code)

            - `contains` — Partial string matching (name, email, phone_number,
            address_street, address_city, address_country, address_state,
            address_postal_code)

            - `is` — Exact match for single or multiple values (all fields)

            - `range` — Range filter for dates, numbers, or cart values
            (statistics fields, cart fields)

            - `starts_with` — Prefix match (phone_number, address_postal_code).
        values:
          type: array
          maxItems: 200
          items:
            type: string
          description: >-
            An array of values for operators: `contains`, `is`, `starts_with`.
            Multiple values are combined with OR logic. For the `starts_with`
            operator: minimum 3 characters per value.
          example:
            - john
            - jane
        range:
          type: object
          properties:
            from:
              oneOf:
                - type: string
                  format: date-time
                - type: integer
                - type: number
                  format: double
              description: >-
                The start of the range (inclusive, gte). For date fields
                (last_activity, last_visit_started, cart_last_updated_at): use
                RFC3339 date-time strings (e.g., `2026-06-01T00:00:00Z`). For
                numeric fields (visits_count, threads_count, etc.): use
                integers. For cart value fields (cart_total_usd): use numbers
                (e.g., 50.00).
            to:
              oneOf:
                - type: string
                  format: date-time
                - type: integer
                - type: number
                  format: double
              description: >-
                The end of the range (inclusive, lte). For date fields
                (last_activity, last_visit_started, cart_last_updated_at): use
                RFC3339 date-time strings (e.g., `2026-06-01T00:00:00Z`). For
                numeric fields (visits_count, threads_count, etc.): use
                integers. For cart value fields (cart_total_usd): use numbers
                (e.g., 200.00).
          description: >-
            The range values for the `range` operator. For date fields
            (last_activity, last_visit_started, cart_last_updated_at): use
            RFC3339 format date-time strings. For numeric fields (visits_count,
            threads_count, etc.): use integers. For cart value fields
            (cart_total_usd): use numbers.
          example:
            from: '2026-06-01T00:00:00Z'
            to: '2026-06-01T00:00:00Z'
        negate:
          type: boolean
          default: false
          description: >-
            If set to `true`: the filter result is negated (NOT logic is
            applied).
      example:
        field: name
        operator: contains
        values:
          - john
          - jane
  securitySchemes:
    PersonalAccessToken:
      description: >-
        Use your `account ID` as the username and your personal access token
        (PAT) as the password, or pass a Base64-encoded value directly in the
        Authorization header. For more information, see the <a
        href="/authentication/personal-access-tokens">personal access tokens
        guide</a>.
      type: http
      scheme: basic
    OAuth2BearerToken:
      description: >-
        This API uses OAuth2 with the implicit grant flow. <a
        href="/authentication/oauth-authorization#implicit-grant">Learn about
        the implicit grant flow.</a>
      type: oauth2
      flows:
        implicit:
          authorizationUrl: https://accounts.livechat.com
          scopes: {}
        authorizationCode:
          authorizationUrl: https://accounts.livechat.com
          tokenUrl: https://accounts.livechat.com/token
          scopes: {}

````