Could not sort users by email_verified

I’m trying to search users and sort them by email_confirmed property, using sort query parameter.

curl --request GET \
  --url 'https://{yourDomain}/api/v2/users?sort=email_verified%3A-1&search_engine=v3' \
  --header 'authorization: Bearer {yourMgmtApiAccessToken}'

But unfortunately, results are not sorted.

Inside page Sort Search Results it’s mentioned only about following fields:

Sorting by app_metadata or user_metadata is not supported.

Is this a bug? Is there any other way to perform the sorting by this field?

Thank you

Hi @nicu,

Welcome to the Auth0 Community!

After my investigation, I managed to reproduce the same issues. I was not able to sort based on the email_verified property.

Given that, I am going to reach out to our Engineers regarding this bug and have them address this issue.

I will follow up on this thread once it has been resolved.

Thanks,
Rueben

Hi @nicu.

Thank you for your patience.

I have collaborated with our Engineers and learned that the Management API’s List of Search users endpoint details the sort functionality applying only to strings:
image

To filter for the email_verified: true property, there is the option to use the q (query) field. For example:

curl -H "Authorization: Bearer <token>" https://{yourDomain}/api/v2/users?q=email_verified%3A%20false

Please let me know if you have any additional questions. I’d be happy to help!

Thanks,
Rueben