Skip to content

Audit API

Clear Audit

Clear the trail, and record who cleared it (doc 08 §7, doc 11).

This is the one place in the product that deletes audit rows, which is why it is owner-only, typed-confirmed, and audited. The audit.clear row is written AFTER the delete on purpose: written first it would sit inside the range being cleared and go with it, leaving an empty table and no author.

An operator who wants retention rather than erasure passes before, and the row says which of the two was used, because “the log was emptied” and “eight month old rows were pruned” are not the same event to read later.

Request body, application/json, ClearIn

FieldTypeRequiredDescription
beforestring | nullno
confirmstring | nullno

Responses

StatusDescriptionSchema
200Successful Responseany
422Validation ErrorHTTPValidationError

List Audit

Parameters

NameInTypeRequiredDescription
actionquerystring | nullno
actorqueryinteger | nullno
actor_typequerystring | nullno
searchquerystring | nullno
from_querystring | nullno
toquerystring | nullno
pagequeryintegerno
per_pagequeryintegerno

Responses

StatusDescriptionSchema
200Successful Responseany
422Validation ErrorHTTPValidationError

Export Audit

RBAC: admin. Entitlement: audit.log.

The export half of doc 01’s audit row and docs 04/05’s audit export.

Streams and is deliberately NOT paginated: an audit export that stops at page one is a trap; someone hands the file over believing it is complete. yield_per keeps a multi-year table off the heap while doing it.

Registered before the /{...}-free list route is irrelevant, but it MUST stay a literal segment: there is no /audit/{id} route today and adding one later would shadow this unless it is declared after.

The query key is the literal from_, trailing underscore, no from alias: passing from silently drops that filter. services/authz.py also carries an unused ("audit", "export"): "owner" permission row that this route does not reference; the enforced gate is admin, the same check GET /audit uses.

Parameters

NameInTypeRequiredDescription
formatquerystringno
actionquerystring | nullno
actorqueryinteger | nullno
actor_typequerystring | nullno
searchquerystring | nullno
from_querystring | nullno
toquerystring | nullno

Responses

StatusDescriptionSchema
200Successful Responseany
422Validation ErrorHTTPValidationError
422format is neither csv nor jsonl