Org Enumerator
A lightweight Node.js script that collects organization-level data from Atlassian's admin APIs and produces an encrypted file you upload into A9 Sightglass — unlocking a deeper tier of analysis and reporting.
Why It Exists
Atlassian Forge apps run inside a strict, server-side sandbox. Forge
grants each app credentials scoped to a single site (e.g.,
yourcompany.atlassian.net). That is intentional — it
limits what a compromised or malicious Marketplace app can access.
However, Atlassian also exposes a separate set of
Organization APIs at
api.atlassian.com/admin/v1/orgs/…. These endpoints
sit above the site layer. They describe the parent organization that
can own multiple sites, manage enterprise policies, verify domains, and
maintain a directory of all managed accounts across every product.
Forge cannot call these endpoints. The sandbox does not expose the bearer token or OAuth scope needed to authenticate against the Organization API. This is not a bug or an oversight — it is an architectural boundary Atlassian has drawn deliberately to separate site-scoped apps from organization-level administration.
Atlassian Cloud Organization ┌──────────────────────────────────────────────────────────────┐ │ │ │ Organization APIs api.atlassian.com/admin/v1/orgs/… │ │ ─ /users ─ /policies ─ /domains │ │ ─ /directories ─ /events ─ /workspaces │ │ │ │ │ NOT accessible from Forge sandbox │ │ │ │ │ ┌─────────┬──────────┴──────────┬─────────┐ │ │ │ Site A │ Site B │ Site C │ │ │ │ (Jira) │ (Confluence) │ (Jira) │ │ │ │ │ │ │ │ │ │ ┌─────┐ │ │ │ │ │ │ │Forge│ │ │ │ │ │ │ │ App │ │ Forge is scoped │ │ │ │ │ │ │ │ to Site A only │ │ │ │ │ └─────┘ │ │ │ │ │ └─────────┴─────────────────────┴─────────┘ │ └──────────────────────────────────────────────────────────────┘ Org Enumerator runs OUTSIDE Forge, authenticates with your Atlassian API token, then produces an encrypted file you upload into the app.
What You Get
The table below shows which data products are available with the Forge app alone versus with Org Enumerator data loaded.
How It Works
The Org Enumerator is a single-file Node.js script you run from your own machine or CI pipeline. It never phones home to A9 servers. Data flows like this:
Set three environment variables — your admin email, an Atlassian API token, and your Organization ID. These never leave your machine.
It enumerates orgs, directories, groups, users, domains,
policies, events, and workspaces via paginated requests directly
from your machine to api.atlassian.com.
Before writing to disk the script encrypts the entire payload with a passphrase you choose. Key derivation uses PBKDF2 (100 000 iterations, SHA-256) with a random salt. No PII is logged to stdout at any point.
In the app: Settings → Organization Data → Upload. Provide the same passphrase and the app decrypts and ingests the data client-side inside the Forge sandbox.
A9 Sightglass merges the org-level directory with Jira site data to produce the full set of reports, including the Permission Matrix, cross-site access inventory, and org hierarchy Sankey.
The API Boundary in Detail
Understanding which APIs are accessible from Forge and which require external authentication helps explain both the architecture and the security model.
| API endpoint | Access tier | From Forge? |
|---|---|---|
/rest/api/3/users/search |
Site | Yes |
/rest/api/3/group/bulk |
Site | Yes |
/rest/api/3/permissionscheme |
Site | Yes |
/rest/api/3/project/{id}/role |
Site | Yes |
/admin/v1/orgs |
Org | No — requires Org Admin bearer token |
/admin/v1/orgs/{id}/users |
Org | No — requires Org Admin bearer token |
/admin/v1/orgs/{id}/policies |
Org | No — requires Org Admin bearer token |
/admin/v1/orgs/{id}/domains |
Org | No — requires Org Admin bearer token |
/admin/v1/orgs/{id}/directories |
Org | No — requires Org Admin bearer token |
/admin/v1/orgs/{id}/events |
Org | No — requires Org Admin bearer token |
Forge's OAuth 2.0 scopes cover the site-tier endpoints on
the left. The org-tier endpoints on the right require a separate
Atlassian admin API token authenticated against
api.atlassian.com with organization admin permissions.
There is no mechanism for a Forge app to request or hold those
credentials.
Privacy & Security
The Org Enumerator script is designed to be auditable and transparent.
Your API token is read from environment variables and is only used to
make direct HTTPS requests to api.atlassian.com. It is
never written to disk or included in the output file.
The encrypted output file contains user account metadata (email addresses, display names, account IDs, managed status) along with policy and domain configuration. Handle this file according to your organization's data-retention policies and delete it once the upload to Sightglass is complete.
Setup Steps
1. Prerequisites
- Node.js 18 or later (
node --versionto check) - Organization Admin access in admin.atlassian.com
- An Atlassian API token scoped to organization admin
2. Create an API Token
- Visit id.atlassian.com → API tokens
- Click Create API token, name it
A9 Org Enumerator - Copy the token immediately — it will not be shown again
3. Find Your Organization ID
- Go to admin.atlassian.com
- Select your organization from the dropdown
- Look at the URL:
https://admin.atlassian.com/o/<org-id>/ - The UUID after
/o/is your Organization ID
4. Configure Environment Variables
export ATLASSIAN_EMAIL=admin@yourcompany.com
export ATLASSIAN_API_TOKEN=your-api-token-here
export ATLASSIAN_ORG_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
.env file in the same
directory as the script. Never commit that file to version control.
5. Run the Script
node org-enumerator.js
The script will print progress counters (no PII) and write an
encrypted .json file to the current directory when
complete.
6. Upload to A9 Sightglass
- Open A9 Sightglass inside Jira
- Go to Settings → Organization Data
- Click Upload Organization Data
- Select the encrypted
.jsonfile - Enter the passphrase you chose during encryption
- Click Process
7. Schedule Regular Updates (optional)
For ongoing monitoring, schedule the script to run periodically so Sightglass always reflects the current state of your organization:
# Run daily at 2 AM (cron)
0 2 * * * cd /path/to/org-enumerator && node org-enumerator.js
Download
The Org Enumerator is a single self-contained JavaScript file. No package installation is required.
org-enumerator.js
Single-file Node.js 18+ script — no npm install required
Or fetch it directly from the terminal:
curl -O https://a9sightglass.io/org-enumerator.js
The script is intentionally kept as a single auditable file with no
external dependencies beyond Node.js built-ins (fs,
crypto, process). Review it before running
it — that is by design.
Troubleshooting
401 Unauthorized
Your API token is invalid or expired. Verify the token at
id.atlassian.com
and ensure ATLASSIAN_EMAIL matches the account that created
the token.
403 Forbidden
The account does not have Organization Admin permissions. Verify at admin.atlassian.com that your account shows as an organization admin.
Empty results / zero users
Check that your Organization ID is correct (the UUID from the
/o/ segment of the admin URL, not a site ID). Also confirm
that your organization has
verified at least one domain
— managed accounts only appear after domain verification.
Rate limiting
The script includes automatic back-off. For very large organizations you can increase the delay between requests:
RATE_LIMIT_DELAY=1000 node org-enumerator.js
Open a ticket at the
JSM Support Portal
or email
support@a9sightglass.io
with your Node.js version, the error message, and whether you can
reach admin.atlassian.com manually.