I need to find out if users have been inactive for 90 days. can i do this through the API.
Try using the users call. There is a response parameter of lastLogin which will be in UNIX time as outlined in this documentation. This indicates the last time the user logged into the organization. You will be able to determine it if this more than 90 days old.
I'm not sure about how to do it thru the API, but there are a bunch of tools that are available for looking at activity/usage and other admin items of interest. If you haven't already check these out...
blog: ArcGIS Online admin tools available on GitHub | ArcGIS Blog
github links (these and more are in the same github repository):
There might be something you can use there without writing your own.
Rebecca, these are great tools. But, is there a way to use them for locally hosted services, meaning they are not hosted on AGOL?
Tim, the original question was about users....are you wanting activity for local users? Or are you wanting local services (maybe for different thread).
And there is some very useful stuff in portalpy.
Scripting administrative tasks with PortalPy—Portal for ArcGIS (10.4.1) | ArcGIS for Server
PortalPy module—Portal for ArcGIS (10.4.1) | ArcGIS for Server
Retrieving data ...