Documentation

Audit-log API

One endpoint, one admin key: page through your organization's audit events, or poll for new ones from your SIEM.

Organization admin keys

The audit-log API doesn't accept project API keys. It takes an organization admin key with the audit:read scope:

  1. In the console, open Organization settings → Audit log export.
  2. Under admin keys, choose Create admin key. Give it a name and, optionally, an expiration date.
  3. 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

HTTP
1GET https://api.modelriver.com/v1/organization/audit-events
2Authorization: Bearer <ADMIN_KEY>

On a self-hosted install, use your own host, for example https://modelriver.example.com/api/v1/organization/audit-events.

ParameterDescription
from, toTime range, ISO 8601 (for example 2026-11-01T00:00:00Z). from is inclusive, to is exclusive.
actorOne or more actors, comma-separated: a user ID, system or api_key.
categoryOne or more categories, comma-separated, for example security,data.
actionOne or more actions, comma-separated, for example security.admin_key_created.
resultsuccess or failure.
orderdesc (newest first, the default) or asc (oldest first).
limitEvents per page, 1 to 1000. Default 100.
cursorThe next_cursor from the previous page.

The response:

JSON
1{
2 "events": [{"id": "0193a4f2-6c1e-7b7a-9d1e-5f2b8c3a4d10", "action": "security.admin_key_created", "...": "..."}],
3 "next_cursor": "SFMyNTY.g2gDdAAAAAR...",
4 "has_more": true
5}

Each event has the fields described in What an event looks like. Responses carry Cache-Control: no-store.

Example (untested):

Bash
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_cursor is null on 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_cursor is 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_more tells you whether to fetch the next page right away.

A minimal poller (untested):

Bash
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" ] || break
done

Events 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:

StatuscodeMeaning
400invalid_filterA parameter is invalid. error says which.
400invalid_cursorThe cursor is malformed, expired, from another organization, or from the other order.
401invalid_admin_keyThe key is missing, unknown, revoked or expired, or it is not an admin key.
403insufficient_scopeThe key doesn't have audit:read.
403upgrade_requiredThe organization's plan doesn't include the audit log.
429rate_limitedOver 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.