---
updatedAt: 2026-05-12T09:59:47.000Z
---

# Retrieve a count of groups and assets associated with a user

This operation returns the counts of groups and assets associated with a user grouped by role.

# OpenAPI definition

```json
{
  "components": {
    "responses": {
      "AssociationsByRoleResponse": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/userRoleAssociationsMessage"
            }
          }
        },
        "description": "AssociationsByRoleResponse provides asset/group association information for the requested user"
      },
      "BadRequestResponse": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/ErrorMessage"
            }
          }
        },
        "description": "BadRequestResponse indicates a request with invalid parameters"
      },
      "ForbiddenResponse": {
        "description": "ForbiddenResponse signals a request for a resource that does not exist or is not authorized"
      },
      "GenericError": {
        "description": "GenericError generic error"
      },
      "UnauthorizedResponse": {
        "description": "UnauthorizedResponse signals an unauthorized API access"
      }
    },
    "schemas": {
      "ErrorMessage": {
        "description": "ErrorMessage describes the error",
        "properties": {
          "code": {
            "format": "int64",
            "type": "integer"
          },
          "reason": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "UserRoleAssociationCount": {
        "description": "UserRoleAssociationCount data is returned by the associationsByRole endpoint",
        "properties": {
          "assetCount": {
            "format": "int64",
            "type": "integer"
          },
          "assetIDs": {
            "items": {
              "format": "int64",
              "type": "integer"
            },
            "type": "array"
          },
          "groupCount": {
            "format": "int64",
            "type": "integer"
          },
          "groupIDs": {
            "items": {
              "format": "int64",
              "type": "integer"
            },
            "type": "array"
          },
          "role": {
            "properties": {
              "id": {
                "format": "int64",
                "type": "integer"
              },
              "name": {
                "type": "string"
              }
            },
            "type": "object"
          }
        },
        "type": "object"
      },
      "acmPageData": {
        "properties": {
          "filteredCount": {
            "format": "int64",
            "type": "integer"
          },
          "totalCount": {
            "format": "int64",
            "type": "integer"
          }
        },
        "type": "object"
      },
      "userRoleAssociationsMessage": {
        "properties": {
          "collection": {
            "description": "Collection of assets/groups a user has access to grouped by role",
            "items": {
              "$ref": "#/components/schemas/UserRoleAssociationCount"
            },
            "type": "array"
          },
          "page": {
            "$ref": "#/components/schemas/acmPageData"
          }
        },
        "type": "object"
      }
    }
  },
  "info": {
    "license": {
      "name": "(c) Copyright 2022 WhiteHat Security"
    },
    "title": "Access Control Management API",
    "version": "2.0.0"
  },
  "openapi": "3.0.1",
  "paths": {
    "/api/users/{id}/associationsByRole": {
      "get": {
        "description": "This operation returns the counts of groups and assets associated with a user grouped by role.",
        "operationId": "associationsByRoleSwagger",
        "parameters": [
          {
            "description": "Offset begin showing results from item number n.",
            "in": "query",
            "name": "offset",
            "schema": {
              "format": "int64",
              "type": "integer"
            },
            "x-go-name": "Offset"
          },
          {
            "description": "Limit results to n number of items.",
            "in": "query",
            "name": "limit",
            "schema": {
              "format": "int64",
              "type": "integer"
            },
            "x-go-name": "Limit"
          },
          {
            "description": "Sort order results by the given field.\nPrefix the field name with '-' to order in descending order.\nE.g., '-name' sorts results in descending order using the  field 'name'",
            "in": "query",
            "name": "sort",
            "schema": {
              "type": "string"
            },
            "x-go-name": "Sort"
          },
          {
            "description": "User ID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "format": "int64",
              "type": "integer"
            },
            "x-go-name": "ID"
          },
          {
            "description": "Fields allows the user to specify optional fields returned in the user response\nSupported values: <b>assetIDs</b> returns asset Ids associated with the user <b>groupIDs</b> returns group Ids associated with the user",
            "in": "query",
            "name": "fields",
            "schema": {
              "type": "string"
            },
            "x-go-name": "Fields"
          }
        ],
        "responses": {
          "200": {
            "$ref": "#/components/responses/AssociationsByRoleResponse"
          },
          "400": {
            "$ref": "#/components/responses/BadRequestResponse"
          },
          "401": {
            "$ref": "#/components/responses/UnauthorizedResponse"
          },
          "403": {
            "$ref": "#/components/responses/ForbiddenResponse"
          },
          "500": {
            "$ref": "#/components/responses/GenericError"
          }
        },
        "summary": "Retrieve a count of groups and assets associated with a user",
        "tags": [
          "Access Control Management API v2.0"
        ]
      }
    }
  },
  "servers": [
    {
      "url": "https://sentinel.whitehatsec.com/"
    }
  ],
  "tags": [
    {
      "name": "Access Control Management API v2.0"
    }
  ],
  "x-explorer-enabled": false,
  "x-readme": {
    "proxy-enabled": true
  }
}
```