Is it possible to get the roles of multiple users at once?

I’m aware that I can get the roles of a given user at /api/v2/users/{id}/roles .

However, I’m wondering if there’s an API or a method in the SDK for getting the roles of a range of users in one request.

On an admin page within our product, I want to be able to show a table of our users with one column containing a summary of the roles to which they belong. I want to do this without maintaining a list of our user’s roles within our own database. I don’t want to iterate over every user on the table each time it is shown, so I’d like to get all of the role data in a single request. Is there an endpoint that provides something like this?

I’m using the .Net Core SDK (Auth0.ManagementApi and Auth0.AuthenticationApi).

I was just able to query the details of multiple users with the following code

    public async Task<List<Role>> GetUserRoles(List<string> auth0UserIds)
        var managementClient = await this.GetManagementApiClientAsync();

        var result = await managementClient.Users.GetAllAsync(
            new GetUsersRequest { Query = $"user_id:({string.Join(" OR ", auth0UserIds)})", }

        // ... 

However this doesn’t seem to return the role information with it.

For now I’m going to use a temporary solution of getting all of my roles Auth0 Management API v2 and then getting all users of each role Auth0 Management API v2 and then further mapping that to our own list of users.

This isn’t ideal though. Doing it this way, we need to get all Auth0 user role data to just query 10 users roles.

Certainly open to other suggestions if anyone has one.

need answer of this same question i faced