---
title: "Count Grants For User By App"
method: POST
path: "/api/v1/search/graph/counts"
tags: ["App Entitlement"]
---

# Count Grants For User By App

`POST /api/v1/search/graph/counts`

CountGrantsForUserByApp returns, for a user, the number of grants held per
 application. Use it to size or filter an access graph before calling
 SearchGraph: counts are computed directly from grant bindings and are an
 upper bound on what SearchGraph will render for the same user and app
 filter (SearchGraph applies additional filters that this count does not).

## Request body

- C1ApiAppV1AppEntitlementSearchServiceCountGrantsForUserByAppRequest — CountGrantsForUserByApp request.
  - `appIds` string[], nullable — Restrict the count to these applications. Empty counts grants across all applications the user has access to.
  - `userId` string — The user whose grants to count.

## Response `200`

CountGrantsForUserByApp response. Grant counts are computed directly from
 grant bindings and are an upper bound on what SearchGraph renders for the
 same user and app filter — SearchGraph applies additional filters that
 these counts do not.

- C1ApiAppV1AppEntitlementSearchServiceCountGrantsForUserByAppResponse — CountGrantsForUserByApp response. Grant counts are computed directly from grant bindings and are an upper bound on what SearchGraph renders for the same user and app filter — SearchGraph applies additional filters that these counts do not.
  - `appCount` integer — The number of applications represented in app_grant_counts.
  - `appGrantCounts` C1ApiAppV1GraphAppGrantCount[], nullable — Grant counts, one entry per application the user has at least one grant in (or per requested app_id, if narrower).
    - `appId` string — The ID of the application.
    - `grantCount` string, int64 — The number of grants the user holds in this application.
  - `appUsers` C1ApiAppV1AppUserRef[], nullable — The user's accounts, scoped by the app_ids filter when provided. Includes accounts with zero counted grants. Lets callers filter a subsequent access graph by account without a second lookup.
    - `appId` string — The ID of the application.
    - `id` string — The ID of the app user.
  - `band` 'GRAPH_SIZE_BAND_UNSPECIFIED' | 'GRAPH_SIZE_BAND_NORMAL' | 'GRAPH_SIZE_BAND_SUMMARIZED' | 'GRAPH_SIZE_BAND_TOO_LARGE' — Advisory size classification for the user's access graph. See GraphSizeBand.
  - `totalGrants` string, int64 — The sum of grant_count across all app_grant_counts.

---

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