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

# Search Count

> Return per-scope counts of machine identities matching the given search filter. The response contains a count for every scope passed in the request body (zero when the caller has no access to that scope).



## OpenAPI

````yaml POST /api/v2/identities/search/count
openapi: 3.0.3
info:
  title: Infisical API
  description: List of all available APIs that can be consumed
  version: 0.0.1
servers:
  - url: https://us.infisical.com
    description: Production server (US)
  - url: https://eu.infisical.com
    description: Production server (EU)
  - url: http://localhost:8080
    description: Local server
security: []
paths:
  /api/v2/identities/search/count:
    post:
      tags:
        - Identities
      description: >-
        Return per-scope counts of machine identities matching the given search
        filter. The response contains a count for every scope passed in the
        request body (zero when the caller has no access to that scope).
      operationId: countMachineIdentitiesV2
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                scope:
                  type: array
                  items:
                    type: string
                    enum:
                      - organization
                      - project
                  minItems: 1
                  default:
                    - organization
                    - project
                  description: >-
                    Array of scopes to count. Returns a count for each requested
                    scope. Accepts 'organization' and/or 'project'.
                search:
                  type: object
                  properties:
                    name:
                      anyOf:
                        - type: string
                          maxLength: 255
                        - type: object
                          properties:
                            $eq:
                              type: string
                              maxLength: 255
                            $contains:
                              type: string
                              maxLength: 255
                            $in:
                              type: array
                              items:
                                type: string
                                maxLength: 255
                          additionalProperties: false
                      description: The name of the identity to filter by.
                    role:
                      anyOf:
                        - type: string
                          maxLength: 255
                        - type: object
                          properties:
                            $eq:
                              type: string
                              maxLength: 255
                            $contains:
                              type: string
                              maxLength: 255
                            $in:
                              type: array
                              items:
                                type: string
                                maxLength: 255
                          additionalProperties: false
                      description: >-
                        The role to filter by. Matches against the role name or
                        slug for custom roles and the role type for predefined
                        roles.
                    $or:
                      type: array
                      items:
                        type: object
                        properties:
                          name:
                            anyOf:
                              - type: string
                                maxLength: 255
                              - type: object
                                properties:
                                  $eq:
                                    type: string
                                    maxLength: 255
                                  $contains:
                                    type: string
                                    maxLength: 255
                                  $in:
                                    type: array
                                    items:
                                      type: string
                                      maxLength: 255
                                additionalProperties: false
                            description: The name of the identity to filter by.
                          role:
                            anyOf:
                              - type: string
                                maxLength: 255
                              - type: object
                                properties:
                                  $eq:
                                    type: string
                                    maxLength: 255
                                  $contains:
                                    type: string
                                    maxLength: 255
                                  $in:
                                    type: array
                                    items:
                                      type: string
                                      maxLength: 255
                                additionalProperties: false
                            description: >-
                              The role to filter by. Matches against the role
                              name or slug for custom roles and the role type
                              for predefined roles.
                        additionalProperties: false
                        description: The filters to apply when counting.
                      maxItems: 5
                  additionalProperties: false
                  description: The filters to apply when counting.
              additionalProperties: false
      responses:
        '200':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  counts:
                    type: object
                    properties:
                      organization:
                        type: number
                      project:
                        type: number
                    additionalProperties: false
                required:
                  - counts
                additionalProperties: false
        '400':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  reqId:
                    type: string
                  statusCode:
                    type: number
                    enum:
                      - 400
                  message:
                    type: string
                  error:
                    type: string
                  details: {}
                required:
                  - reqId
                  - statusCode
                  - message
                  - error
                additionalProperties: false
        '401':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  reqId:
                    type: string
                  statusCode:
                    type: number
                    enum:
                      - 401
                  message:
                    type: string
                  error:
                    type: string
                required:
                  - reqId
                  - statusCode
                  - message
                  - error
                additionalProperties: false
        '403':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  reqId:
                    type: string
                  statusCode:
                    type: number
                    enum:
                      - 403
                  message:
                    type: string
                  details: {}
                  error:
                    type: string
                required:
                  - reqId
                  - statusCode
                  - message
                  - error
                additionalProperties: false
        '404':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  reqId:
                    type: string
                  statusCode:
                    type: number
                    enum:
                      - 404
                  message:
                    type: string
                  error:
                    type: string
                required:
                  - reqId
                  - statusCode
                  - message
                  - error
                additionalProperties: false
        '422':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  reqId:
                    type: string
                  statusCode:
                    type: number
                    enum:
                      - 422
                  message: {}
                  error:
                    type: string
                required:
                  - reqId
                  - statusCode
                  - error
                additionalProperties: false
        '500':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  reqId:
                    type: string
                  statusCode:
                    type: number
                    enum:
                      - 500
                  message:
                    type: string
                  error:
                    type: string
                required:
                  - reqId
                  - statusCode
                  - message
                  - error
                additionalProperties: false
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: An access token in Infisical

````