How to get a list of users with f.i. "last seen" information?

We would like to track our user’s activity and licensing. Therefore we would like to query the atlassian system for all known users of our organization incl. information like “last seen” for each product.

Is there an SDK or REST API endpoint that gets a list of all users like I have in “admin.atlassian.com” → my organization → Directory → Managed Accounts? Something like the “CSV List” that I get when I click “export accounts”, but without waiting for the email, using the link in the email and open the webpage and wait for the csv download to happen…

br,
Alex