Searching by username - documentation is inconsistent

Hi Team,

I have a question that arises from your online documentation for the Management API. Our particular use case will require the user to create a unique username. The Create function specifies the “username” element.

Likewise the return value from the Get API will return the “username” attribute, as shown below.

However, on the following page that describes the Search User API:

User Search Query Syntax (auth0.com)

One can either search for values in the Normalized User Profile Schema (Normalized User Profile Schema (auth0.com)) or the listed additional searchable fields. The “username” field isn’t included in either list.

But within the User Search Query Syntax v2 page (at User Search Query Syntax v2 (auth0.com)), there is reference to that value in the “raw” where “username” is specified. However, further down that same page it is referred to in some examples as both “user_name” and “username” – but I am not sure if these are the same as the actual username field, given that they seem to refer to a value one might expect to find in the “name” attribute as part of the Create User function.

Can you help clarify this for us? We will need to be able to search for an existing user by way of the chosen username field (given that we will configure the Connection to require it). We could try to determine it through trial and error but I don’t want to build to something that isn’t officially documented or supported, in case that might change in the future. I appreciate your help with this.

(NOTE: attachment contains screen prints that are referenced in the above text)


Hi @robin.bayer,

Yes, that’s correct. The Normalized User Profile Schema and these additional searchable fields are the only fields you can filter using the fields parameter. It does not include the username field.

With the User Search v2, it filters using the query or (q) parameter. In that case, you can query the username to filter your search for an exact match.

For example:
q: username: user123

This will return the user whose username matches “user123”.

Let me know if you have any questions.

Thanks,
Rueben

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