How to clean up stale accounts?

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.

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. Instead, you will need to delete each user individually while being mindful of the Rate Limits in place.

Now, to find users that have been inactive for some time, I recommend using the Management API’s List or Search users endpoint to filter for users whose last login was at least 6 months ago using Lucene Search Syntax in the q parameter. For example:

last_login: [* TO 2022-01-01]

Here is a screenshot for clarity as well:

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.