Get list of active users counting towards Jira Data Center license
Platform Notice: Data Center Only - This article only applies to Atlassian apps on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
In this article, we will use a custom script to obtain a list of active users who count toward the Jira license.
Environment
Jira Data Center on any version.
Solution
In the example below, we have used Jira Software and Jira Service Desk as a licensed group. You can update the licensed group by updating the userSearchUrl in line 5 of the code.
Run a script in browser development console
You can use the script below in your browser to download the list of users directly. This script also works for nested groups.
How to use the script:
Open the Webpage: User management -> Users -> Users screen
Open the browser's Developer Tools (usually F12 or right-click → "Inspect")
Go to the Console tab
Paste the code below
Replace your
BASEURLin line 2 of the codePress Enter
A CSV file named all_users.csv will be downloaded to your downloads folder
(async function fetchPaginatedTablesCleaned() {
const baseUrl = "<<BASEURL>>"
const max = 1000;
const userSearchUrl = baseUrl + "/admin/users/UserBrowser.jspa?userSearchFilter=&group=&applicationFilter=jira-software&group=&applicationFilter=jira-servicedesk&activeFilter=true&max=" + max + "&startIndex=";
let startIndex = 0;
let allRows = [];
let hasMoreData = true;
while (hasMoreData) {
const url = userSearchUrl + startIndex;
console.log("Fetching:", url);
const response = await fetch(url, { credentials: 'include' });
const html = await response.text();
const parser = new DOMParser();
const doc = parser.parseFromString(html, "text/html");
const table = doc.querySelector("table");
if (!table || table.rows.length === 0) {
console.log("No table or empty table found at index", startIndex);
break;
}
const rows = Array.from(table.rows).map(row =>
Array.from(row.cells).map(cell =>
`"${cell.innerText.replace(/\s+/g, ' ').trim().replace(/"/g, '""')}"`
).join(",")
);
allRows.push(...rows);
// Stop if less than expected results returned (likely last page)
if (table.rows.length < max + 1) { // +1 for header
hasMoreData = false;
} else {
startIndex += max;
}
}
// Remove duplicate headers
const headers = allRows[0];
const bodyRows = allRows.slice(1).filter(row => row !== headers);
const finalCsv = [headers, ...bodyRows].join("\r\n");
const blob = new Blob([finalCsv], { type: "text/csv;charset=utf-8;" });
const url = URL.createObjectURL(blob);
const link = document.createElement("a");
link.href = url;
link.download = "all_users.csv";
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
console.log(":white_check_mark: Done! Downloaded cleaned CSV from all paginated pages.");
})();Was this helpful?