Forums

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

Using Atlassian User Management REST API

Jackson Kelley
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 10, 2025

Hello, I am using the Atlassian User Management REST API to fetch all active users in my directory, but it is only returning 50 users. 

I am trying to retrieve all users in out Atlassian Cloud org using the Admin API, here is my core logic. I removed tokens and company specific info. 

def fetch_atlassian_users():

    Logging.info("Fetching Atlassian users")

    token = ""

    org_id = ""

 

    headers = {

        "Authorization": f"Bearer {token}",

        "Accept": "application/json",

    }

 

    users = []
    next_cursor = None
    page_number = 1

    while True:
        params = {
            "limit": 100,
        }
        if next_cursor:
            params["cursor"] = next_cursor

        response = requests.get(url, headers=headers, params=params, timeout=10)
        response.raise_for_status()
        data = response.json()

        logging.info("Page %d: %d users fetched", page_number, len(data.get('data', [])))

        for user in data.get("data", []):
            if user.get("account_status") == "active":
                users.append({
                    "account_id": user.get("account_id"),
                    "email": user.get("email"),
                    "name": user.get("name"),
                    "account_status": user.get("account_status"),
            })

        next_cursor = data.get("meta", {}).get("next_cursor")
        if not next_cursor:
            break

        page_number += 1

    logging.info("Fetched %d users from Atlassian", len(users))
    return users

1 answer

0 votes
Prince Nyeche
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 10, 2025

Hey @Jackson Kelley 

You can look in my Python library to see how this is implemented or use it to get the information you want.

Jackson Kelley
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 22, 2025

Is this just getting users from Jira or from the Atlassian directory?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events