-
We have ~8,000 usernames/emails and want to look up each user’s last login date. The UI seems to allow searching only one email at a time. Is there a way to upload a CSV of usernames and get all of their lastLoginInstant values?
-
FusionAuth doesn’t support uploading a CSV to retrieve last-login timestamps. However, you can do this efficiently with the Search for Users API and return lastLoginInstant for many users at once.
How to do it (batch via API)
-
Use the User Search endpoint
POST /api/user/search (set your X-FusionAuth-TenantId and Authorization headers). -
Send an Elasticsearch query using terms to match a batch of emails/usernames, and read lastLoginInstant from each returned user:
{ "search": { "query": "{\"terms\":{\"email\":[\"a@example.com\",\"b@example.com\",\"c@example.com\"]}}", "numberOfResults": 500, "startRow": 0 } }- Swap email for username if that’s what you have.
- If your list is large, chunk it (e.g., 200–500 logins per request) and paginate with startRow / numberOfResults.
- (Optional) Filter by last-login date with a range query on lastLoginInstant:
{ "search": { "query": "{\"range\":{\"lastLoginInstant\":{\"gte\":\"2025-10-01T00:00:00Z\"}}}" } }You can also query by epoch millis if you prefer.
- Map results
Each user object includes lastLoginInstant (epoch millis). Convert to your desired timezone/format in your script and write out a CSV.
Tips
- If you need all users in a tenant (not just your list), you can search with a wildcard or a match-all query and page through results, then filter locally.
- For ongoing metrics, consider subscribing to user.login.success webhooks and recording last logins as they happen.
Docs:
- Search for Users API (Elasticsearch): https://fusionauth.io/docs/apis/users#elasticsearch-search-engine
-
-
W wesley has marked this topic as solved on
-
D dan moved this topic from Frequently Asked Questions (FAQ) on
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login