Get last activity date of the users

I need to get the last activity time of the users through API in order to identify users who have not been actively using the application. even if i can get the last login time of each user, that will be good enough.