Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Bulk Fetch Managed Account Attributes via public APIs

Overview :mag_right:

Many times, we need to fetch Atlassian Account Attributes for reporting and data analysis. This article explains how to fetch Atlassian account attributes in bulk using the Atlassian REST API. While the official API endpoint returns information for a single account at a time, the provided Python script allows you to automate the process for multiple accounts efficiently.

This endpoint is extremely helpful for fetching the Organisation attribute value for users, as it is not available in the UI.

The public API used: The User management REST API

Prerequisites ✅

Before you begin, ensure you have the following:

  • Python 3 is installed on your system(for macOS)

  • Google Chrome browser with an active Atlassian admin session (required for cookie extraction).

  • The following Python packages:

    • browser-cookie3

    • requests

Install the required packages using pip:

pip3 install browser-cookie3
pip3 install requests

Step-by-Step Instructions 💡

  • Log in to your Atlassian admin Account using Chrome to ensure your session is active.

  • Gather the Atlassian Account IDs (aaid1, aaid2, etc.) for the users whose attributes you want to fetch. To get it faster, you can  Export managed accounts

  • Obtain a valid Atlassian API access token with the necessary permissions to read user profiles.

  • Copy and paste the following script into a text file and save it as bulk_fetch_accounts.py

import requests
import json

# List of user account IDs
account_ids = ['aaid1', 'aaid2']

# Your access token
access_token = "<access_token>"

# Function to get user profile information
def get_user_profile(account_id):
url = f"https://api.atlassian.com/users/{account_id}/manage/profile"
headers = {
"Accept": "application/json",
"Authorization": f"Bearer {access_token}"
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
return json.loads(response.text)
else:
print(f"Failed to retrieve data for account ID {account_id}: {response.status_code}")
return None

# Iterate over each account ID and fetch profile information
for account_id in account_ids:
user_profile = get_user_profile(account_id)
if user_profile:
print(json.dumps(user_profile, sort_keys=True, indent=4, separators=(",", ": ")))

Note ⚠️

  • Replace 'aaid1', 'aaid2' with the actual Atlassian Account IDs.
  • Replace <access_token> with your real access token.

To Run the Script ⌛️

Open your terminal in macOS and execute:

python3 bulk_fetch_accounts.py

To save the output to a text file:

python3 bulk_fetch_accounts.py >> output.txt

1 comment

Philipp Sendek
Contributor
August 26, 2025

Hi @Sanjay Verma ,

amazing write up, thank you very much!
I know there are endpoints that only accept Cookie auth and don't work with the Bearer Token. However, it looks you aren't actually using the token, so you also wouldn't need to install the dependencies. 

Greetings
Philipp

Like Sanjay Verma likes this

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events