Poll users' attributes without running into rate limits

When an admin user logs into our front end, I want our master list of users to show which users are blocked and their last login time. To accomplish this I was setting up a function in our custom API that would fetch every user’s information from Auth0 through /api/v2/users-by-email. Things were going fine when I was doing a few at a time, but then when I processed 10 or so users in one batch I got a statusCode = 429 Too many requests, Global limit has been reached.

How are we supposed to get user data like “blocked” and “last_login” integrated into our custom API? The rate of 2 per second for free tier, or 15 per second for paid seem really stiff.

Thanks in advance for your advice on this topic.

Hi @hasatkaynaklari,

Welcome to the Community! Have you considered using a search like:

https://[your tenant].auth0.com/api/v2/users?q=blocked%3Dtrue

If I remember correctly this will only return the first 1000 hits, but you can sort by most or least recent as well:

Sort by oldest first:

https://[your tenant].auth0.com/api/v2/users?sort=last_login%3A1&q=blocked%3Dtrue

Sort by newest first:

https://[your tenant].auth0.com/api/v2/users?sort=last_login%3A-1&q=blocked%3Dtrue

Thanks, @markd. Your proposed method works. It does mean I have to change the way I’m loading the “blocked” attribute into my front end users list, but it works with pagination if needed because of crossing the threshold. I appreciate your response.

2 Likes

Glad you have it working @hasatkaynaklari!

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