---
title: "POST /api/v2/identities/search/count"
method: POST
path: "/api/v2/identities/search/count"
tags: ["Identities"]
---

# POST /api/v2/identities/search/count

`POST /api/v2/identities/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).

## Request body

- object
  - `scope` string[] — Array of scopes to count. Returns a count for each requested scope. Accepts 'organization' and/or 'project'.
  - `search` object — The filters to apply when counting.
    - `name` union — The name of the identity to filter by.
      - string
      - object
        - `$eq` string
        - `$contains` string
        - `$in` string[]
    - `role` union — The role to filter by. Matches against the role name or slug for custom roles and the role type for predefined roles.
      - string
      - object
        - `$eq` string
        - `$contains` string
        - `$in` string[]
    - `$or` object[]
      - `name` union — The name of the identity to filter by.
        - string
        - object
          - `$eq` string
          - `$contains` string
          - `$in` string[]
      - `role` union — The role to filter by. Matches against the role name or slug for custom roles and the role type for predefined roles.
        - string
        - object
          - `$eq` string
          - `$contains` string
          - `$in` string[]

## Response `200`

Default Response

- object
  - `counts` object, required
    - `organization` number
    - `project` number

## Other responses

- `400` — Default Response
- `401` — Default Response
- `403` — Default Response
- `404` — Default Response
- `422` — Default Response
- `500` — Default Response

---

[API](https://skmtc.net/infisical/apis/infisical-api.md) · [All operations](https://skmtc.net/infisical/apis/infisical-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/infisical/infisical-api/revisions/885aef3e6c11/schema)
