Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Audit API

Canonical reference: docs/api-reference.md (generated endpoint directory) — this page is a task-oriented summary.

Query surface for the platform audit trail. Read this first: the five audit endpoints below answer an honest empty page plus a machine-readable notice — the Mnesia sync-event store has no audit.* writer. The real audit trail is the append-only JSONL log written by sol_audit_log (read it on disk, or via the Mango audit archive with its integrity chain). The endpoints exist and are RBAC-gated; they simply refuse to fabricate results from a store that never held audit events.

Overview

Every privileged action (memory mutations, schedule changes, marketplace publishes, workspace writes, channel operations, provider actions, …) is recorded by sol_audit_log as a JSONL row: actor uuid, binary target, event-specific details with content hashed (*_sha256) and never stored verbatim. The audit chain has an integrity verifier (mirroring Mango’s implementation).

Authentication

All endpoints require Authorization: Bearer <token> with the audit:read permission (admins pass via "*"). Audit data is not exposed to ordinary callers.

Endpoints

All five query routes share the same honest response shape — a paginated envelope with zero items plus the notice field:

GET /api/v1/audit/events
GET /api/v1/audit/tool-executions
GET /api/v1/audit/permission-decisions
GET /api/v1/audit/llm-decisions

Response (200):

{
  "items": [],
  "total": 0,
  "limit": 50,
  "offset": 0,
  "page": 1,
  "total_pages": 1,
  "has_more": false,
  "notice": "audit_log_file_only"
}

The historical ?type= filter and the “filtered view” semantics of the typed endpoints are gone: there is nothing to select, so no request parameter can drive a scan.

Anchored integrity verdict

GET /api/v1/audit/verify

Unlike the file-only query family, this route runs the real anchored verifier over the Sol JSONL audit chain (sol_audit_log:verify_integrity_anchored/0) and answers the verdict map. It is admin-only (an exact {admin, require} middleware rule — the /api/v1/audit prefix grant of audit:read does not apply).

Response (200) — every produced verdict, pass or fail:

{
  "ok": true,
  "anchored": true,
  "anchored_to_seq": 3,
  "observed_head_seq": 3,
  "rows_checked": 3,
  "truncated": false,
  "reasons": [],
  "violations": [],
  "files": [{"file": "audit-20260917.jsonl", "path": "...", "result": "ok"}],
  "key_source": "configured"
}

ok=false + reasons values: truncated_tail (log head below the signed checkpoint — a full wipe is the same class with observed_head_seq: null), checkpoint_invalid (the checkpoint file fails its HMAC), integrity_violation (a per-file chain break), unanchored (no checkpoint — loud, never silent-ok), secret_refused (the HMAC secret posture refuses). key_source: configured | ephemeral | unknown. Under an ephemeral key the checkpoint written by a previous run reads as checkpoint_invalid after restart — rotate in the real SOL_AUDIT_HMAC_SECRET (see docs/production-runbook.md). 503 is reserved for a verifier that could not run at all (subsystem absent); a produced failed verdict is always a 200 body so the operator sees WHY.

Summary

GET /api/v1/audit/summary
{
  "audit_summary": {},
  "notice": "audit_log_file_only"
}

Where the Real Audit Data Lives

ConsumerAccess
Sol JSONL audit logAppend-only file managed by sol_audit_log on the Sol host
Mango audit archiveMango identity service (its own audit table + /auth-surface archive), with the integrity chain and verify_integrity operator surface
Limon ops consoleRenders audit views from the Mango archive

Error Codes:

CodeDescription
401Authentication required
403audit:read permission required (Zerg envelope, insufficient_permissions)

Examples:

curl http://127.0.0.1:21434/api/v1/audit/events \
  -H "Authorization: Bearer $TOKEN"

curl http://127.0.0.1:21434/api/v1/audit/summary \
  -H "Authorization: Bearer $TOKEN"