# How to clean up stale accounts?

**URL:** <https://community.auth0.com/t/how-to-clean-up-stale-accounts/86420>\
**Category:** Get Help\
**Tags:** auth0\
**Created:** [July 5, 2022, 10:43am UTC](https://community.auth0.com/t/how-to-clean-up-stale-accounts/86420 "2022-07-05T10:43:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vidyarani.nethi](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/vidyarani.nethi/32/37887_2.png) [@vidyarani.nethi](https://community.auth0.com/u/vidyarani.nethi)\
**Post date:** [July 5, 2022, 10:43am UTC](https://community.auth0.com/t/how-to-clean-up-stale-accounts/86420/1 "2022-07-05T10:43:48Z")

</div>

Hi,  
Is there a way to configure and cleanup non active users based on certain conditions like non-active for 6 months or emails accounts which were not verified ?

Thanks,  
Vidya.

---

<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:** [July 5, 2022, 5:13pm UTC](https://community.auth0.com/t/how-to-clean-up-stale-accounts/86420/3 "2022-07-05T17:13:56Z")

</div>

Hi @vidyarani.nethi,

Thanks for reaching out to the Auth0 Community!

I understand that you would like to know how to groom your database from stale user accounts.

Before we continue, let me preface that there currently [isn’t any way to bulk delete users](https://community.auth0.com/t/is-there-a-way-to-bulk-delete-users/10832). Instead, you will need to delete each user individually while being mindful of the [Rate Limits](https://community.auth0.com/t/how-to-tell-if-you-are-approaching-the-rate-limit/82103) in place.

> [@vidyarani.nethi](#):
>
> Is there a way to configure and cleanup non active users based on certain conditions like non-active for 6 months or emails accounts which were not verified ?

Now, to find users that have been inactive for some time, I recommend using the Management API’s [List or Search users endpoint](https://auth0.com/docs/api/management/v2#!/Users/get_users) to filter for users whose last login was at least 6 months ago using Lucene Search Syntax in the `q` parameter. For example:

```auto
last_login: [* TO 2022-01-01]

```

Here is a screenshot for clarity as well:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/6/9/69da52a3795234c29cddf16f877270820a26b075.png)

From this result, you will get a list of `user_id's` that you can use in your script to delete each user.

I hope this helps!

Please let me know how this goes for you.

Thank you.

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [December 22, 2022, 11:36am UTC](https://community.auth0.com/t/how-to-clean-up-stale-accounts/86420/4 "2022-12-22T11:36:56Z")

</div>


