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.
What counts as licensed: An active user is one who belongs to a group granted application access (e.g., jira-software-users, jira-servicedesk-users). The script below lists exactly those users so you can reconcile against your license tier before an audit or renewal.
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
Please ensure to adjust const max = xxxx; to match your license count. For example, if there are 2990 licenses, set it to const max = 3000;
(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=";
const cleanCellText = (t) => {
return (t ?? "")
// normalize whitespace/newlines first
.replace(/\r\n/g, "\n")
// remove "Show more"/"Show less" (optionally with counts like "(3)")
.replace(/show\s+(more|less)\s*(\(\s*\d+\s*\))?/gi, "")
// collapse extra whitespace again
.replace(/[ \t]+/g, " ")
.replace(/\n{2,}/g, "\n")
.trim();
};
// Pick the correct results table (page can contain other tables)
const findResultsTable = (doc) => {
const tables = Array.from(doc.querySelectorAll("table"));
return (
tables.find(
(t) =>
/username/i.test(t.innerText) &&
/full\s*name|email/i.test(t.innerText)
) ||
tables[0] ||
null
);
};
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 doc = new DOMParser().parseFromString(html, "text/html");
const table = findResultsTable(doc);
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) => {
const cells = Array.from(row.cells);
// DROP the last cell (Actions column), if present
const dataCells =
cells.length > 0 ? cells.slice(0, cells.length - 1) : cells;
const csvLine = dataCells
.map((cell) => {
const cleaned = cleanCellText(cell.innerText);
return `"${cleaned.replace(/"/g, '""')}"`;
})
.join(",");
return csvLine;
});
allRows.push(...rows);
// Stop if less than expected results returned (likely last page)
if (table.rows.length < max + 1) {
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 dlUrl = URL.createObjectURL(blob);
const link = document.createElement("a");
link.href = dlUrl;
link.download = "all_users.csv";
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
console.log("Downloaded cleaned CSV from all paginated pages (no Actions column, no Show more/less).");
})();Verification
After downloading the CSV, confirm the export is complete:
Open
all_users.csvand count the data rows (excluding the header row).Navigate to Administration ⚙ > User management and note the active licensed-user count displayed.
The CSV row count should match the licensed-user count in the admin UI.
If the counts do not match, verify that the applicationFilter values in line 5 of the script include all licensed applications configured for your instance, and that const max is set to at least your total license count.
Related articles
Was this helpful?