Sorting users by lastLogin returns “Invalid search criteria” error

I am using Users endpoint to search and sort users. I am able to sort by profile fields and created/activated, but it returns an error when I want to sort by lastLogin or lastUpdated.
I see the same problem on both API and SDK.

Error message: {"Invalid search criteria. (400, E0000031): Invalid search attribute."}
Successful request: {{oktaDomain}}/api/v1/users?search=profile.firstName sw "duygu"&sortBy=created
Failed request: {{oktaDomain}}/api/v1/users?search=profile.firstName sw "duygu"&sortBy=lastLogin

Documentation states that sortBy can be any property.
So, isn’t all of the fields supported for sorting?

Thank you in advance.

lastLogin is not a top level property. These are the only properties that are NOT user profile attributes or user type that you can use:

The top-level properties id , status , created , activated , statusChanged and lastUpdated

1 Like

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