Audit API
DELETE /api/v1/audit
Section titled “DELETE /api/v1/audit”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
| Field | Type | Required | Description |
|---|---|---|---|
before | string | null | no | |
confirm | string | null | no |
Responses
| Status | Description | Schema |
|---|---|---|
| 200 | Successful Response | any |
| 422 | Validation Error | HTTPValidationError |
GET /api/v1/audit
Section titled “GET /api/v1/audit”List Audit
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
action | query | string | null | no | |
actor | query | integer | null | no | |
actor_type | query | string | null | no | |
search | query | string | null | no | |
from_ | query | string | null | no | |
to | query | string | null | no | |
page | query | integer | no | |
per_page | query | integer | no |
Responses
| Status | Description | Schema |
|---|---|---|
| 200 | Successful Response | any |
| 422 | Validation Error | HTTPValidationError |
GET /api/v1/audit/export
Section titled “GET /api/v1/audit/export”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
| Name | In | Type | Required | Description |
|---|---|---|---|---|
format | query | string | no | |
action | query | string | null | no | |
actor | query | integer | null | no | |
actor_type | query | string | null | no | |
search | query | string | null | no | |
from_ | query | string | null | no | |
to | query | string | null | no |
Responses
| Status | Description | Schema |
|---|---|---|
| 200 | Successful Response | any |
| 422 | Validation Error | HTTPValidationError |
| 422 | format is neither csv nor jsonl |