Okta API call (LastLogIn)

I’d like to know which Okta API to call to get list of users who last logged in 6 months ago?
I tried search but it doesnt seem to work as I get the “Invalid search criteria” error in Postman when I try this:
api/v1/users?search=lastLogin gt “2022-10-28T23:59:59.000Z”
Can someone help?

That is likely due to their data retention policy.

Log data older than 90 days isn’t returned, in accordance with Okta’s Data Retention Policy (opens new window). Queries that exceed the retention period succeed, but only those results that have a published timestamp within the window are returned.

1 Like

Thanks @warren !
I just need to get a list of users that havent logged-in in a while so I can process them accordingly.

If you’re an Okta admin, you might find the Okta Usage Report to be helpful as well.

The Okta Usage report contains data about who has signed in to Okta during a specified time period.
The report contains the following fields:

  • User
  • Login
  • Number of Logins
  • User Status
  • Last Login_ISO8601

Yes. Thanks for your response.
I can also get that from the Password Health report as well. But I need a way to automatically deactivate (on a daily basis) those users that haven’t logged in the past 6 months. That’s the reason why I need a API call to get that information.