Organization admin keys
The audit-log API doesn't accept project API keys. It takes an organization admin key with the audit:read scope:
- In the console, open Organization settings → Audit log export.
- Under admin keys, choose Create admin key. Give it a name and, optionally, an expiration date.
- Copy the key. It starts with
mr_org_and is shown only once. ModelRiver stores only a hash of it.
Owners and admins can create and revoke admin keys. Creating or revoking one is recorded in the audit log. A key belongs to the organization, not to the person who created it: it keeps working when that person leaves, until it is revoked or expires.
List audit events
1GET https://api.modelriver.com/v1/organization/audit-events2Authorization: Bearer <ADMIN_KEY>On a self-hosted install, use your own host, for example https://modelriver.example.com/api/v1/organization/audit-events.
| Parameter | Description |
|---|---|
from, to | Time range, ISO 8601 (for example 2026-11-01T00:00:00Z). from is inclusive, to is exclusive. |
actor | One or more actors, comma-separated: a user ID, system or api_key. |
category | One or more categories, comma-separated, for example security,data. |
action | One or more actions, comma-separated, for example security.admin_key_created. |
result | success or failure. |
order | desc (newest first, the default) or asc (oldest first). |
limit | Events per page, 1 to 1000. Default 100. |
cursor | The next_cursor from the previous page. |
The response:
1{2 "events": [{"id": "0193a4f2-6c1e-7b7a-9d1e-5f2b8c3a4d10", "action": "security.admin_key_created", "...": "..."}],3 "next_cursor": "SFMyNTY.g2gDdAAAAAR...",4 "has_more": true5}Each event has the fields described in What an event looks like. Responses carry Cache-Control: no-store.
Example (untested):
curl -s "https://api.modelriver.com/v1/organization/audit-events?category=security&limit=500" \ -H "Authorization: Bearer $MODELRIVER_ADMIN_KEY"Pagination
Pass next_cursor as cursor to get the next page. A cursor is valid for 30 days, and only with the same key's organization and the same order.
order=desc(newest first) is for browsing.next_cursorisnullon the last page.order=asc(oldest first) is for polling from a SIEM. Pages stop 90 seconds before the current time, so an event recorded slightly late is never skipped.next_cursoris always set: it is where to resume. When a page is empty, it is the cursor you sent. Store it and call again with it on your next poll.has_moretells you whether to fetch the next page right away.
A minimal poller (untested):
cursor=$(cat cursor.txt 2>/dev/null)while :; do page=$(curl -sf -G "https://api.modelriver.com/v1/organization/audit-events" \ -H "Authorization: Bearer $MODELRIVER_ADMIN_KEY" \ --data-urlencode "order=asc" --data-urlencode "limit=1000" \ --data-urlencode "cursor=$cursor") || break echo "$page" | jq -c '.events[]' >> audit-events.ndjson cursor=$(echo "$page" | jq -r '.next_cursor') echo "$cursor" > cursor.txt [ "$(echo "$page" | jq -r '.has_more')" = "true" ] || breakdoneEvents are delivered at least once to your poller if it saves the cursor after storing the events. Remove duplicates on id.
Errors
Errors are JSON with a code:
| Status | code | Meaning |
|---|---|---|
| 400 | invalid_filter | A parameter is invalid. error says which. |
| 400 | invalid_cursor | The cursor is malformed, expired, from another organization, or from the other order. |
| 401 | invalid_admin_key | The key is missing, unknown, revoked or expired, or it is not an admin key. |
| 403 | insufficient_scope | The key doesn't have audit:read. |
| 403 | upgrade_required | The organization's plan doesn't include the audit log. |
| 429 | rate_limited | Over the rate limit. Wait for the number of seconds in Retry-After. |
Rate limits
Each admin key may make 60 requests per minute. Over the limit, the API answers 429 with a Retry-After header. A client address with many failed authentications in a minute is also limited for a short time.