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

# Get the number of Agents matching a search

> Returns how many Agents match a search term, as a single total.

Use this instead of counting the response of `GET /api/v1/agent/search`. That endpoint
returns at most `maxRecords` results — 50 by default — so counting it reports the limit
rather than the number of matches whenever a search matches more Agents than the limit.

The term is matched the same way as `GET /api/v1/agent/search`: against Agent names and
descriptions, case-insensitive, and archived Agents are excluded unless `includeArchived`
is set. So this total always equals the number of Agents that search would return if its
limit were high enough.



## OpenAPI

````yaml GET /api/v1/agent/search/count
openapi: 3.0.4
info:
  title: Sequentum Cloud API
  description: API endpoints for Sequentum Cloud
  version: v1
servers: []
security:
  - ApiKey: []
    Bearer: []
paths:
  /api/v1/agent/search/count:
    get:
      tags:
        - ApiAgent
      summary: Get the number of Agents matching a search
      description: >-
        Returns how many Agents match a search term, as a single total.


        Use this instead of counting the response of `GET /api/v1/agent/search`.
        That endpoint

        returns at most `maxRecords` results — 50 by default — so counting it
        reports the limit

        rather than the number of matches whenever a search matches more Agents
        than the limit.


        The term is matched the same way as `GET /api/v1/agent/search`: against
        Agent names and

        descriptions, case-insensitive, and archived Agents are excluded unless
        `includeArchived`

        is set. So this total always equals the number of Agents that search
        would return if its

        limit were high enough.
      parameters:
        - name: query
          in: query
          description: The search term to match against agent names and descriptions
          schema:
            type: string
        - name: includeArchived
          in: query
          description: Include archived Agents in the count
          schema:
            type: boolean
            default: false
      responses:
        '200':
          description: Returns the number of matching Agents
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentCountApiModel'
        '400':
          description: If the query is empty or too short
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestError'
        '401':
          description: If the API key is missing or invalid
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
      x-codeSamples:
        - lang: curl
          label: cURL
          source: >-
            curl
            "https://dashboard.sequentum.com/api/v1/agent/search/count?query=checkout"
            \
              -H "Authorization: ApiKey $SEQUENTUM_API_KEY"

            # => { "totalCount": 214 }


            # Include archived agents in the count:

            # curl
            "https://dashboard.sequentum.com/api/v1/agent/search/count?query=checkout&includeArchived=true"
            \

            #   -H "Authorization: ApiKey $SEQUENTUM_API_KEY"
        - lang: node
          label: Node.js
          source: >-
            const params = new URLSearchParams({ query: "checkout" });


            const res = await
            fetch(`https://dashboard.sequentum.com/api/v1/agent/search/count?${params}`,
            {
              headers: {
                "Authorization": `ApiKey ${process.env.SEQUENTUM_API_KEY}`,
              },
            });


            const { totalCount } = await res.json();

            console.log(`${totalCount} agents match`);
        - lang: python
          label: Python
          source: |-
            import os
            import requests

            response = requests.get(
                "https://dashboard.sequentum.com/api/v1/agent/search/count",
                params={"query": "checkout"},
                headers={"Authorization": f"ApiKey {os.environ['SEQUENTUM_API_KEY']}"},
            )
            response.raise_for_status()
            print(response.json()["totalCount"])  # e.g. 214
components:
  schemas:
    AgentCountApiModel:
      type: object
      properties:
        totalCount:
          type: integer
          description: Number of agents matching the request
          format: int32
      additionalProperties: false
      description: Agent count for a space or for the personal space
    BadRequestError:
      type: object
      properties:
        statusCode:
          type: integer
          format: int32
        statusDescription:
          type: string
          nullable: true
        message:
          type: string
          nullable: true
          readOnly: true
        severity:
          $ref: '#/components/schemas/ErrorSeverity'
        errorCode:
          type: string
          description: >-
            Optional machine-readable error code. When present, clients should
            switch on this

            value rather than parsing
            Sequentum.Enterprise.Core.ControllerError.Message. The controller
            pipeline serialises

            with System.Text.Json, which ignores the Newtonsoft attribute below,
            so an unset code

            reaches the client as `"errorCode": null` rather than being omitted
            - clients

            must treat null and absent alike.
          nullable: true
      additionalProperties: false
    ProblemDetails:
      type: object
      properties:
        type:
          type: string
          nullable: true
        title:
          type: string
          nullable: true
        status:
          type: integer
          format: int32
          nullable: true
        detail:
          type: string
          nullable: true
        instance:
          type: string
          nullable: true
      additionalProperties: {}
    ErrorSeverity:
      enum:
        - 0
        - 1
        - 2
        - 3
        - 4
      type: integer
      description: >-
        `0` = `Error`; `1` = `Unexpected`; `2` = `Fatal`; `3` = `Warning`; `4` =
        `Info`
      format: int32
  securitySchemes:
    ApiKey:
      type: apiKey
      description: >-
        API Key authorization header. Example: "Authorization: ApiKey
        {your-api-key}"
      name: Authorization
      in: header
    Bearer:
      type: http
      description: 'OAuth 2.0 Bearer token. Example: "Authorization: Bearer {access-token}"'
      scheme: bearer
      bearerFormat: JWT

````

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