Find Users not logged in since certain date Skip to main content
How satisfied are you with the Okta Help Center?
Thank you for your feedback!
How satisfied are you with the Okta Help Center?
Very Dissatisfied
Very satisfied
Enter content less than 200 characters.
Ask Search:
Kay GemmertKay Gemmert 

Find Users not logged in since certain date

Is there a way for me to search for user that have not logged in since timestamp xxx


https://{my-okta-domain}.com/api/v1/users?search=lastLogin gt "2018-01-01T00:00:00.000Z"

I am getting an "errorSummary": "Invalid search attribute." error back when trying find use the above search criteria and the documentation suggests that the only top level attributes I can search for are

id, status, created, activated, statusChanged and lastUpdated

What is the best way to find these users, if I have a very large user base and dont want to retrieve ALL users from okta?
Kay GemmertKay Gemmert
The support team got back to me with the below. So it is NOT possible, to search based on lastLogin.

"As an alternative that would provide you the same result would be to do in Reports> Okta Password Health report and that will give you the last login as well. 
If you want to go with API call instead you can use "List Active Users". The call in the result will also provide you with the lastLogin field, but there is no API that will give you that specific result directly as a search."

I really hope though that this will become a searchable attribute some day, why would lastUpdated by searchable and lastLogin not?
Dylann FezeuDylann Fezeu (Customer First Programs)

Thanks for posting your inquiry in Okta Community Portal.

​If you receive a great answer to your question(s), please help readers find it by marking it the best answer. Hover over the answer and click "Best Answer." 

Thank you,

​Dylann Fezeu
OHC Team