Get users and roles by Management API V2

I couldn’t find how to perform the following queries, maybe someone will have ideas:

  1. get all the users by role (like https://${AUTH0_DOMAIN}/api/v2/roles/${roleID}/users), but I want that the users will have all the fields, including metadata, like in the get user by ID.
  2. In continue to #1, is it possible to query for list of role IDs and not only a single roleID?
  3. query for roles by role name


Hi @asaf1,

Thanks for reaching out to the Auth0 Community!

To accomplish this, you will need to use the Management API v2 Get a role’s users endpoint in conjunction with the Get users by ID endpoint.

After querying the list of user_id’s associated with a role, you can pass user_id to get the user profile.

Unfortunately, it’s not possible to use the Get a role’s users endpoint for more than one role.

However, you could get the use the Get roles endpoint and iteratively pass the Role ID to the Get a role’s users endpoint.

Unfortunately, this is not possible. You must query by Role ID.

I hope this answers your questions.

Please let me know if you have any other questions or concerns. I’d be happy to help.

Thank you.

Thanks a lot.
So apparently I use that API as expected, and no shortcuts there…

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.