Users that are in specific organization Java SDK


I’m trying to fetch all users that have specific org id.

        String query = "organization_id:\"" + organizationId + "\"";
        Request<UsersPage> usersPageRequest = managementAPI.users().list(new UserFilter().withQuery(query));

But I get that can’t filter by ‘organization_id’ error:

! com.auth0.exception.APIException: Request failed with status code 400: Invalid query: filter can not be used with unknown field 'organization_id'

How can I get that info with Java’s SDK ?




Welcome to the Auth0 Community!

You’re looking for the Retrieve Organization Members endpoint.

Here is the reference for the Java SDK: OrganizationsEntity (auth0 1.44.1 API)

1 Like

Great! I wasn’t aware about the semantic difference between users and members and now it’s clear.


1 Like

Perfect! Let us know if you have any other questions.

Hi @dan.woda ,
Actually now when talking to my staff, I need User fields such as lastLogin, etc. that are entities of the User class and not Member class. Is there any way to fetch Users by organization or that I need to write an algorithm to covert member to user by the user_id fields they both share?

You can get a list of members from the /api/v2/organizations/{id}/members endpoint, then get individual user details from the /api/v2/users/{id} endpoint.

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