# Retrieve all users who never log in or whose logins\_count is 0

**URL:** <https://community.auth0.com/t/retrieve-all-users-who-never-log-in-or-whose-logins-count-is-0/126954>\
**Category:** Get Help\
**Tags:** users, management-api\
**Created:** [February 9, 2024, 2:47pm UTC](https://community.auth0.com/t/retrieve-all-users-who-never-log-in-or-whose-logins-count-is-0/126954 "2024-02-09T14:47:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bruni-WanKenobi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bruni-wankenobi/32/50643_2.png) [@Bruni-WanKenobi](https://community.auth0.com/u/Bruni-WanKenobi)\
**Post date:** [February 9, 2024, 2:47pm UTC](https://community.auth0.com/t/retrieve-all-users-who-never-log-in-or-whose-logins-count-is-0/126954/1 "2024-02-09T14:47:54Z")

</div>

Hey Fam,

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

😄 /  
\<))  
\_|\

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.

```auto
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!

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [February 9, 2024, 8:33pm UTC](https://community.auth0.com/t/retrieve-all-users-who-never-log-in-or-whose-logins-count-is-0/126954/3 "2024-02-09T20:33:09Z")

</div>

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:

```auto
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

---

<div class="post-metadata">

**Author:** ![Bruni-WanKenobi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bruni-wankenobi/32/50643_2.png) [@Bruni-WanKenobi](https://community.auth0.com/u/Bruni-WanKenobi)\
**Post date:** [February 12, 2024, 3:51pm UTC](https://community.auth0.com/t/retrieve-all-users-who-never-log-in-or-whose-logins-count-is-0/126954/4 "2024-02-12T15:51:27Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 1, 2024, 9:49am UTC](https://community.auth0.com/t/retrieve-all-users-who-never-log-in-or-whose-logins-count-is-0/126954/6 "2024-03-01T09:49:01Z")

</div>

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