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

# Search Count

> Returns the total number of products matching the given search criteria—without returning the full item list. Useful for pagination controls and analytics dashboards that only need the count of results.

Before calling this endpoint, make sure you’ve generated an API token and picked the correct domain. See [Authentication & Base URLs](/api-reference/authbaseurl).


## OpenAPI

````yaml POST /apis/ecommerce-service/public/discovery/v2/search/count
openapi: 3.1.0
info:
  title: OpenAPI Plant Store
  description: >-
    A sample API that uses a plant store as an example to demonstrate features
    in the OpenAPI specification
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://apis.experro.app
    description: Admin Server
  - url: https://{base-address}
    description: Custom Server
    variables:
      base-address:
        default: ''
        description: Enter your custom domain or server address.
security:
  - bearerAuth: []
paths:
  /apis/ecommerce-service/public/discovery/v2/search/count:
    post:
      summary: Get Total Product Hit Count
      description: >-
        Returns the total number of products matching the given search
        criteria—without returning the full item list. Useful for pagination
        controls and analytics dashboards that only need the count of results.
      parameters:
        - $ref: '#/components/parameters/CustomerGroupIdHeader'
        - $ref: '#/components/parameters/EcommProviderHeader'
        - $ref: '#/components/parameters/FieldsQryPrm'
        - $ref: '#/components/parameters/LocaleQryPrm'
        - $ref: '#/components/parameters/StoreIdQryPrm'
        - $ref: '#/components/parameters/ChannelIdQryPrm'
        - name: location_id
          in: query
          description: >-
            Identifier for the regional location from the BigCommerce admin
            panel.
          schema:
            type: string
        - $ref: '#/components/parameters/CurrencyQryPrm'
        - name: include_fields_meta
          in: query
          description: >-
            Whether to include metadata about the fields in the response. If
            true, returns metadata for each filterable field.
          schema:
            type: boolean
        - $ref: '#/components/parameters/SkipQryPrm'
        - $ref: '#/components/parameters/LimitQryPrm'
        - name: sort_order
          in: query
          schema:
            type: string
          description: >-
            Sort direction for counting logic (rarely used for pure counts).
            `asc` for ascending, `desc` for descending.
        - name: sort_by
          in: query
          schema:
            type: string
          description: Field name by which the results should be sorted.
        - name: by_pass_merchandising
          in: query
          schema:
            type: boolean
          description: Whether to bypass merchandising rules for count calculations
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                search_term:
                  type: string
                  description: The keyword or phrase used to search products
                category_id:
                  type: string
                  description: Identifier for the product category to filter results
                category_name:
                  type: string
                  description: Name of the product category to filter results
                collection_id:
                  type: string
                  description: >-
                    Identifier for a specific collection or campaign to filter
                    results.
                facets:
                  type: array
                  description: >-
                    Facet fields with values to filter product by color, size or
                    other facets
                  items:
                    type: object
                    properties:
                      field_internal_name:
                        type: string
                      value:
                        type: string
                    required:
                      - field_internal_name
                      - value
                filter:
                  type: array
                  description: Query filter expression to narrow results
                  items:
                    type: object
                    properties:
                      group:
                        type: object
                        properties:
                          operator:
                            type: string
                            description: Combine rules with AND or OR.
                          rules:
                            type: array
                            items:
                              type: object
                              properties:
                                action:
                                  type: string
                                  description: Comparison type (equals, contains).
                                field_name:
                                  type: string
                                  description: Field to apply comparison.
                                value:
                                  type: string
                                  description: Comparison value.
                              required:
                                - action
                                - field_name
                                - value
                        required:
                          - operator
                          - rules
                    required:
                      - group
      responses:
        '200':
          description: Total count of matching products.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchCount200Response'
        '400':
          description: Bad Request – invalid parameters or malformed body.
          content:
            application/json:
              schema:
                type: object
                properties:
                  Status:
                    type: string
                    example: failure
                  Data:
                    $ref: '#/components/schemas/Error404'
        '401':
          description: Unauthorized – Missing or invalid API key.
          content:
            application/json:
              schema:
                type: object
                properties:
                  Status:
                    type: string
                    example: failure
                  Data:
                    $ref: '#/components/schemas/Error401'
        '500':
          description: Internal Server Error – an unexpected error on the server.
          content:
            application/json:
              schema:
                type: object
                properties:
                  Status:
                    type: string
                    example: failure
                  Data:
                    $ref: '#/components/schemas/Error500'
      security: []
      servers:
        - url: https://{base-address}
          description: Custom Server
          variables:
            base-address:
              default: ''
              description: Enter your custom domain or server address.
components:
  parameters:
    CustomerGroupIdHeader:
      name: x-customer-group-id
      in: header
      required: false
      schema:
        type: string
      description: Optional customer group identifier for segment-specific responses.
    EcommProviderHeader:
      name: x-ecomm-provider
      in: header
      required: false
      schema:
        type: string
      description: >-
        eCommerce provider for contextualizing the API call (e.g., shopify,
        magento, etc.).
    FieldsQryPrm:
      name: fields
      in: query
      description: Comma-separated list of fields to include in the response
      schema:
        type: string
      required: true
    LocaleQryPrm:
      name: locale
      in: query
      description: Specifies the language or region for the response data
      required: true
      schema:
        type: string
    StoreIdQryPrm:
      name: store_id
      in: query
      description: Identifier of the store within the eCommerce platform.
      required: false
      schema:
        type: string
    ChannelIdQryPrm:
      name: channel_id
      in: query
      description: Sales or distribution channel identifier.
      required: false
      schema:
        type: string
    CurrencyQryPrm:
      name: currency
      in: query
      description: Currency code for price displays.
      required: false
      schema:
        type: string
    SkipQryPrm:
      name: skip
      in: query
      schema:
        type: integer
      description: Number of items to skip for pagination offset.
    LimitQryPrm:
      name: limit
      in: query
      schema:
        type: integer
      description: Maximum number of items to return.
  schemas:
    SearchCount200Response:
      type: object
      properties:
        Status:
          type: string
          example: success
        Data:
          type: object
          properties:
            result:
              properties:
                total_count:
                  type: number
            _meta_:
              $ref: '#/components/schemas/MetaResponse'
    Error404:
      type: object
      properties:
        Status:
          type: string
          example: failure
        Error:
          type: object
          properties:
            message:
              type: string
            name:
              type: string
            code:
              type: string
          required:
            - message
            - name
      required:
        - Status
        - Error
    Error401:
      type: object
      properties:
        Status:
          type: string
          example: failure
        Error:
          type: object
          properties:
            message:
              type: string
            name:
              type: string
            code:
              type: string
          required:
            - message
            - name
      required:
        - Status
        - Error
    Error500:
      type: object
      properties:
        Status:
          type: string
          example: failure
        Error:
          type: object
          properties:
            message:
              type: string
            name:
              type: string
            code:
              type: string
          required:
            - message
            - name
      required:
        - Status
        - Error
    MetaResponse:
      type: object
      properties:
        tenant_id:
          type: string
        workspace_id:
          type: string
        env_type:
          type: string
        store_hash:
          type: string
        content_model_id:
          type: string
        _fields_:
          type: object
          additionalProperties:
            type: object
            properties:
              type:
                type: string
              sub_type:
                type: string
              is_array:
                type: boolean
              is_searchable:
                type: boolean
            required:
              - type
              - sub_type
              - is_array
              - is_searchable
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````