Read the audit of an organization
For: an app developer who shows the owner of an organization the changes to that organization, or an operator who gives a customer a copy.
What it does: this page reads the audit of one organization as the owner, then exports it with the operator secret. It tells which acts make a row, and which do not.
Before you start
Section titled “Before you start”- A working config with
organizations. - A database at schema version 18 or later. Schema and migrations lists the migrations.
- For the export: the user tools on, and a secret with the
auditscope. authtempo audit export gives the setup.
- Apply the migrations of schema version 18 with
authtempo migrate. The audit of an organization starts at version 18. It holds no row from before the upgrade. - Let the owner read. The owner rank holds
audit:read. A stored role never holdsaudit:read. In therolesform, a role holdsaudit:readonly when itspermissionslist it. Roles and permissions gives the forms. - Read one page in the session of the owner. Call
client.organizations.audit.list({ organizationId }), or the route below. Passnextasafterto read the next page.nextis null on the last page. - Read every row with
client.organizations.audit.export({ organizationId }). It reads pages of 100 rows, one page at a time, and stops when you stop the loop. - Narrow the read with
action,from, andto.fromcounts,todoes not, andfrommust be beforeto. - Give a copy to the customer with the operator secret:
authtempo audit export <base url> --organization <id> --format csv.
GET /auth/organizations/audit?organizationId=01J8Z3Q4R5S6T7V8W9X0Y1Z2A3&limit=50 HTTP/1.1Cookie: __Host-tempo_session=…{ "rows": [ { "id": "01J9A0B1C2D3E4F5G6H7J8K9M0", "at": "2026-11-24T09:12:03.000Z", "actor": { "kind": "member", "id": "01J8Z3Q4R5S6T7V8W9X0Y1Z2B4", "email": "ada@example.com" }, "action": "organization_member_role_change", "targetUserId": "01J8Z3Q4R5S6T7V8W9X0Y1Z2C5", "data": { "from": "member", "to": "admin" }, "ip": "203.0.113.7", "userAgent": "Mozilla/5.0" } ], "next": null}What a row shows to the owner
Section titled “What a row shows to the owner”actor.kind |
Who did the act | actor.id |
email |
ip and userAgent |
|---|---|---|---|---|
member |
A member of the organization | The user id | The current address. Null when the user is gone. | Yes |
platform |
A platform operator, an operator secret, or an operator who impersonates a member | Null | Null | Null |
scim |
The directory of the customer, by a SCIM token | The name of the token | Null | Null |
app |
The server code of the app | The name of the app | Null | Null |
The owner sees no detail of the platform. The operator act sso_enforce_off shows as platform.
What the audit holds
Section titled “What the audit holds”- The 12 acts on the members, the invitations, the organization tokens, and the roles. They write 11 actions:
- Members:
organization_member_add,organization_member_remove, andorganization_member_role_change. A remove and a leave both writeorganization_member_remove. - Invitations:
organization_invitation_create,organization_invitation_accept, andorganization_invitation_revoke. - Tokens:
organization_token_createandorganization_token_revoke. - Roles:
organization_role_create,organization_role_update, andorganization_role_delete.
- Members:
- A user who deletes the account leaves each organization that stays. The delete writes one
organization_member_removerow in each of them, in the same transaction. The row holds the role,self: true, andaccountDelete: trueindata. It holds no IP and no user agent. Its actor is thememberwith the user id, and the email is null because the user is gone. An organization that goes with the account gets no row. The platform organization gets no row. - An operator delete of a user writes no organization row. Its row stays in the operator audit only.
- No row for these acts: a token update narrows a token, or an invitee declines an invitation. An account delete also removes the invitations that the user sent, with no row.
- The SSO acts: the connections, the domains, the SCIM tokens, the SCIM writes, the setup links, and the test runs.
- No member row for a member that SCIM or a JIT sign-in adds. A SCIM write has its own
scim_user_createrow. A JIT sign-in has no audit row. - No operator act on a user, such as a ban or an impersonation. Those rows stay in the operator audit only.
- No sign-in. A sign-in is the event
sign_inof the observe stream. The SSO sign-in eventssso.failed,sso.denied, andsso.refusedholdorganizationIdwhen core knows the organization. - No row from before schema version 18. Such a row has no organization, so no filter can find it.
The rows stay after the delete of the organization. The owner route cannot read them then. The operator export reads them by the organization id.
The export of the operator holds more than the owner view. It holds the actor and the reason of each row, and the IP and user agent of each act. Give the file only to a person who may see that data.
The expiry notices
Section titled “The expiry notices”The audit does not hold the expiry notices. The sweep sends them: a SAML certificate, a SCIM token, or a setup link ends in 30, 7, or 1 days. The expiry notices gives the rules.
Warning: a mail goes through your mail supplier, which can drop it. Do not use the mail as the only signal. Use hooks.sso.expiring or the event sso.expiring as the signal that you own.
A disabled connection gets no notice, and keeps its notice date. After an enable, the next sweep sends the nearest due stage.
If it fails
Section titled “If it fails”forbidden_rank: the user is no member, or the role does not holdaudit:read. Read as the owner, or addaudit:readto thepermissionsof the role.unauthorized: the request has no session. An organization token cannot read the audit. Read in the session of the owner, or export with the operator secret.invalid_body: an id is malformed, orlimitis not 1 to 100. Oractionis not an action of the organization audit, orfromis not beforeto. A deployment before schema version 18 refusesorganizationIdon the operator route too.- An empty audit after an upgrade is correct. The audit starts at schema version 18.