reports
The access report gathers a tenant's access-lifecycle state in one document: what is about to end, who is elevated right now, and which API keys nobody uses.
The access report gathers a tenant's access-lifecycle state in one document: what is about to end, who is elevated right now, and which API keys nobody uses. Temporary access only stays safe if someone notices what is expiring, what is pending, and what was forgotten, and checking each list by hand does not scale. Run the report nightly and route it to a channel or ticketing system. See the access report.
| Method | What it does | Access |
|---|---|---|
access | Returns the tenant's access report: identities and grants ending soon, live elevations, pending requests, and unused or expiring API keys. | Credential |
access
Returns the tenant's access report: identities and grants ending soon, live elevations, pending requests, and unused or expiring API keys.
Used inAccess report
- Permission:
iam:identities:readon the tenant. The bindings section also needsiam:bindings:readand the credentials sectioniam:credentials:readon the tenant; without them the section is left out, not refused. - Audited as:
iam:identities:read. - Errors:
INVALID_INPUTwhenwithinMsorunusedForMsis negative or longer than ten years.
withinMs (default 30 days) is the look-ahead window for things that end or start, and unusedForMs (default 30
days) is how long an API key must go unused to be listed. The report has three sections:
identities: how many identities the tenant has (deleted ones excluded) and how many are disabled, plus people and service accounts whoseexpiresAtfalls within the window. An identity already past its deadline stays listed withexpired: trueuntil the retention worker disables it.bindings: how many unexpired bindings there are, and how many of them are eligible or limited to an access window; bindings that expire within the window; future-dated bindings that start within it; temporary group memberships that end within it; live just-in-time activations with their justification; and the number of activation requests awaiting a decision.credentials: the number of unexpired API keys, keys not used forunusedForMs(never-used keys count from their creation), and keys that expire within the window.
omitted names the sections the caller could not read, so a directory administrator without
iam:credentials:read still gets the rest. For email delivery to tenant owners, schedule
iam.sendAccessDigest() instead; the report
CLI command prints the same report.
const report = await iam.api.reports.access(credential, { tenantId, withinMs: 14 * 24 * 60 * 60 * 1000 });
for (const binding of report.bindings?.expiring ?? [])
console.log(`${binding.subjectName ?? binding.subjectId} loses ${binding.roleName ?? binding.roleId}`);Prop
Type
A AccessReport object:
Prop
Type
Example HTTP request
Only the required fields are shown; replace each <placeholder>. The response is { "data": … } on success or { "error": { "code", "message" } }.
curl -X POST "$IAM_URL/api/iam/reports/access" \
-H "Authorization: Bearer $BETTER_IAM_TOKEN" \
-H "Content-Type: application/json" \
-H "X-Better-IAM: 1" \
-d '{
"tenantId": "<tenantId>"
}'iam.api.reports.access(
credential: CredentialInput,
input: { tenantId: string; withinMs?: number; unusedForMs?: number },
): Promise<AccessReport>Better IAM is created by Sean Filimon
Last updated