> ## 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 in a Space

> Returns the number of Agents in the specified Space as a single total, so callers that only
need a count do not have to fetch the full Agent list and count it themselves.

The total always matches the number of Agents returned by
`GET /api/v1/spaces/{spaceId}/agents` for the same Space and the same `includeArchived`
value, when that endpoint's `status` filter is not set: archived Agents are excluded from
both unless `includeArchived` is set, and Space contents that are not Agents are not counted.



## OpenAPI

````yaml GET /api/v1/spaces/{spaceId}/agents/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/spaces/{spaceId}/agents/count:
    get:
      tags:
        - ApiSpace
      summary: Get the number of Agents in a Space
      description: >-
        Returns the number of Agents in the specified Space as a single total,
        so callers that only

        need a count do not have to fetch the full Agent list and count it
        themselves.


        The total always matches the number of Agents returned by

        `GET /api/v1/spaces/{spaceId}/agents` for the same Space and the same
        `includeArchived`

        value, when that endpoint's `status` filter is not set: archived Agents
        are excluded from

        both unless `includeArchived` is set, and Space contents that are not
        Agents are not counted.
      parameters:
        - name: spaceId
          in: path
          description: The ID of the Space
          required: true
          schema:
            type: integer
            format: int32
        - name: includeArchived
          in: query
          description: Include archived Agents in the count
          schema:
            type: boolean
            default: false
      responses:
        '200':
          description: Returns the number of Agents in the Space
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentCountApiModel'
        '401':
          description: If the API key is missing or invalid
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: If the Space is not found or is not accessible
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '500':
          description: If an unexpected server error occurs
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerError'
      x-codeSamples:
        - lang: curl
          label: cURL
          source: |-
            curl https://dashboard.sequentum.com/api/v1/spaces/42/agents/count \
              -H "Authorization: ApiKey $SEQUENTUM_API_KEY"

            # => { "totalCount": 73 }
        - lang: node
          label: Node.js
          source: >-
            const res = await
            fetch("https://dashboard.sequentum.com/api/v1/spaces/42/agents/count",
            {
              headers: {
                "Authorization": `ApiKey ${process.env.SEQUENTUM_API_KEY}`,
              },
            });


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

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

            response = requests.get(
                "https://dashboard.sequentum.com/api/v1/spaces/42/agents/count",
                headers={"Authorization": f"ApiKey {os.environ['SEQUENTUM_API_KEY']}"},
            )
            response.raise_for_status()
            print(response.json()["totalCount"])  # e.g. 73
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
    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: {}
    InternalServerError:
      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
    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.