# Audit API

## GET /api/v1/admin/audit

`GET /api/v1/admin/audit` · operation `listAdministrativeAudit`

Paginated committed administrative mutations from identity and control audit tables. Requires audit_explorer, UI and PostgreSQL. Global admin and viewer sessions only; team scoped roles are denied. With organization_admins (T168) an organization admin sees the identity events whose target is now a team, user or key of its organization, and no control events. Filters are exact and the range is at most 90 days. No payload, token, secret or request body is returned.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `from` | query | string (date-time) | Start of the time window, an RFC 3339 timestamp. |
| `to` | query | string (date-time) | Exclusive upper bound. Omitted, the window stays open at the top, so rows the database stamped a moment ago are included (T168). |
| `request_id` | query | string, max length 128 | Only the changes made by this request ID. |
| `actor` | query | string, max length 128 | Only the changes made by this actor (console user ID, bootstrap_admin or a workload). |
| `action` | query | string, max length 128 | Only this audit action, such as key.create or feature.set. |
| `target_id` | query | string, max length 128 | Only the changes to this target ID. |
| `limit` | query | integer, default `50`, min 1, max 100 | Most rows on this page, 1-100 (50 by default). |
| `offset` | query | integer, default `0`, min 0, max 10000 | Rows to skip before this page, for pagination (0-10000). |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | A page of committed administrative events | `application/json`: [AuditPage](/docs/api/schemas/a/#auditpage) |
| `400` | Invalid input | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | Feature disabled | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `503` | Audit storage unavailable | — |


## GET /api/v1/admin/audit/export

`GET /api/v1/admin/audit/export` · operation `exportAdministrativeAudit`

Export at most 10000 committed administrative mutations as CSV. Requires audit_export and audit_explorer. Global admin and viewer sessions only. Uses the same exact filters and 90-day boundary as GET /api/v1/admin/audit. Text is protected against spreadsheet formula interpretation. X-Export-Truncated indicates more matches.

**Authentication:** `adminSession`

**Parameters**

| Name | In | Type | Description |
|---|---|---|---|
| `from` | query | string (date-time) | Start of the time window, an RFC 3339 timestamp. |
| `to` | query | string (date-time) | End of the time window, an RFC 3339 timestamp. |
| `request_id` | query | string, max length 128 | Only the changes made by this request ID. |
| `actor` | query | string, max length 128 | Only the changes made by this actor (console user ID, bootstrap_admin or a workload). |
| `action` | query | string, max length 128 | Only this audit action, such as key.create or feature.set. |
| `target_id` | query | string, max length 128 | Only the changes to this target ID. |

**Responses**

| Status | Description | Body |
|---|---|---|
| `200` | Filtered administrative audit CSV with no-store | `text/csv`: string |
| `400` | Invalid input | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `401` | Missing or invalid bearer key | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `403` | Model not allowed | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `404` | Feature disabled | `application/json`: [Error](/docs/api/schemas/e/#error) |
| `503` | Audit storage unavailable | — |

