Retrieve all users who never log in or whose logins_count is 0

Hey Fam,

Here I am again, I am becoming a regular. Thank you for all the support.

:smile: /
<))
_|\

I am looking to retrieve all users who never log in or whose logins_count is 0. So that I can run an array of user ids, to update a new role we have created.

https://domain.us.auth0.com/api/v2/users?page=0&per_page=100&sort=logins_count%3A1&fields=user_id%2Cemail

On this URL I have 100 records per page, and I am retrieving the logins_count, email, user_id

How can I add a query to return only the users who never log in or whose logins_count is 0?

I am open to sugestions.

Thanks in advance!

Hi @Bruni-WanKenobi,

You can call the Management API’s List or search users endpoint and use the q parameter to query for logins_count equal to 0. See below for the command:

curl -L 'https://{{auth0_domain}}/api/v2/users?q=logins_count%3A%5B0%20TO%200%5D' \
-H 'Accept: application/json'

Let me know if you have any questions.

Thanks,
Rueben

1 Like

Thank you so much, Ruben. I appreciate your answer.

A follow-up question, I hit the page limit of 10 pages 100 users per page and I still have users that never log in that need a new role.

  • A background:
    • I am getting users who never log in, and assigned a new role to them to allow them to log in to one of our internal applications.

Is there a query that I can add to only display users who never logged in without roles assigned to them?

1 Like

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