Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

How to get all users within an organization and their last activity date via API

Have you ever wondered how to get all the users within your organization and their last activity date from your cloud environment? Think no further because these APIs already exist. However, most administrators still find it difficult to locate such resources.


Today, I’m going to show you how to get a list of every user within your organization whose profile properties include the last active date of that user. i.e. The last active date denotes when the user last login into an Atlassian application and when they last logged into an Atlassian suite.

We’ll be using a python library called jiraone, which is installed via a python virtual environment by calling the command pip install jiraone or from your terminal python3 -m pip install jiraone

Firstly, you have to get an admin API token. One is generated by following this article which shows a step-by-step guide.

Once that is done, all you need to do is write a python script as shown.

from jiraone import manage, echo

token = "2PjAxxxxxxxxQp"
org = manage.org_id
users = manage.get_organization(org_id=org, filter_by="users")
output = manage.get_all_users(users.json(), detail=True)


With the above code, you add your admin API as a string declared to the token variable. The output expression calls a method that exacts all the users within an organization. The argument of detail=True allows the extraction of the entire user properties. If the detail=False - then only minimal information is returned. For more information about jiraone API please go to the documentation page.

The resulting output is a deque list of the user properties for every user within your organization, which is accessed just like any other list data structure in python.

deque([{'access_billable': True,
'account_id': '5c6dxxxxxxxx278',
'account_status': 'active',
'account_type': 'atlassian',
'email': '',
'last_active': '2019-07-22T00:00:00Z',
'link': {'self': ''},
'name': 'John Doe',
'picture': '',
'product_access': [{'key': 'jira-software',
'last_active': '2019-07-22T00:00:00Z',
'name': 'Jira Software',
'realm': 'global',
'regions': [],
'siteId': 'd4cbxxxxxxxxxxxx165cxx',
'url': ''},
{'key': 'jira-software',
'name': 'Jira Software',
'realm': 'global',
'regions': [],
'siteId': '799exxxxxxxc4fx',
'url': ''},
{'key': 'confluence',
'name': 'Confluence',
'realm': 'global',
'regions': [],
'siteId': '799exxxxxxxc4fx',
'url': ''},
{'key': 'jira-service-desk',
'last_active': '2019-07-22T00:00:00Z',
'name': 'Jira Service Management',
'realm': 'global',
'regions': [],
'siteId': 'd4cbxxxxxxxxxxxx165cxx',
'url': ''},
{'key': 'confluence',
'name': 'Confluence',
'realm': 'global',
'regions': [],
'siteId': 'd4cbxxxxxxxxxxxx165cxx',
'url': ''}]}

If the last active exists per application, then the key value will be added to the response payload. This is minimalistic code to get all users within an organization and to retrieve the last active date of a user. With the above information, you can create a report of all users within your organization and which application they last accessed or when was their last activity date.

1 comment


Log in or Sign up to comment
AUG Leaders

Atlassian Community Events