Audit
Read, check and export the audit trail.
GET /v1/audit/check
Section titled “GET /v1/audit/check”The last self-check of the chain and the last failed one. sefra_viewer and above.
The worker recomputes the whole chain every every_s seconds. This is the service’s check of its own record; the independent check is sefra audit verify against the database.
Responses
| Status | Description | Body |
|---|---|---|
200 |
The results, null before the first. | object |
400 |
A problem. | Problem (application/problem+json) |
401 |
No valid token (with WWW-Authenticate). |
Problem (application/problem+json) |
403 |
The principal is not human or lacks the role. | Problem (application/problem+json) |
Body of 200
| Field | Type | Required | Description |
|---|---|---|---|
every_s |
integer | Yes | |
last |
SelfCheck or null | Yes | |
last_failure |
SelfCheck or null | Yes | |
stale |
boolean | Yes | The last result is older than three intervals: the self-check has stopped running and the result is not current. |
GET /v1/audit/events
Section titled “GET /v1/audit/events”The trail, filtered, in sequence order or newest first, a page at a time. sefra_viewer and above; without read_payloads, policy-authored text and computed rule names are withheld from body.
after_seq alone pages in ascending order, 100 events, next_after_seq on a full page. Each parameter is given once; any other parameter is refused. to needs from. Ascending pages with after_seq, descending (order=desc) with before_seq; a cursor of the other order is refused.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
type |
query | string | No | An event type, or up to 20 comma-separated. |
actor |
query | string | No | A principal id or system. |
execution |
query | string | No | |
from |
query | string | No | On at, inclusive. Format: date-time. |
to |
query | string | No | On at, exclusive. Format: date-time. |
from_seq |
query | integer | No | Inclusive. Minimum: 1. |
to_seq |
query | integer | No | Inclusive. Minimum: 1. |
order |
query | string | No | One of asc, desc. Default: asc. |
after_seq |
query | integer | No | Default: 0. Minimum: 0. |
before_seq |
query | integer | No | The next_before_seq of the previous page. Minimum: 1. |
limit |
query | integer | No | Default: 100. Minimum: 1. Maximum: 500. |
Responses
| Status | Description | Body |
|---|---|---|
200 |
A page. | object |
400 |
A problem. | Problem (application/problem+json) |
401 |
No valid token (with WWW-Authenticate). |
Problem (application/problem+json) |
403 |
The principal is not human or lacks the role. | Problem (application/problem+json) |
Body of 200
| Field | Type | Required | Description |
|---|---|---|---|
events |
array of AuditEvent | Yes | |
next_after_seq |
integer | No | Ascending; present when the page is full. |
next_before_seq |
integer | No | Descending; present when the page is full. |
GET /v1/audit/export
Section titled “GET /v1/audit/export”Events from to to as the JSON Lines file of sefra audit export. sefra_auditor and above.
Sequence numbers; from defaults to 1, to to the head, and a to past the head is the head. At most 100,000 events per request. The range is fixed in one snapshot, then an audit.exported event (range, reader, channel) is written, then the file is streamed; if the event cannot be written nothing is sent. An error while streaming aborts the response, and each write must be accepted within 30 s. At most two exports run at once per process (503 with Retry-After beyond). Check the file with sefra audit verify --file; its last hash is Sefra-Last-Hash, and equals Sefra-Head-Hash when to is the head.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
from |
query | integer | No | Default: 1. Minimum: 1. |
to |
query | integer | No | Minimum: 1. |
Responses
| Status | Description | Body |
|---|---|---|
200 |
The file. | string (application/x-ndjson) |
400 |
A problem. | Problem (application/problem+json) |
401 |
No valid token (with WWW-Authenticate). |
Problem (application/problem+json) |
403 |
The principal is not human or lacks the role. | Problem (application/problem+json) |
500 |
A problem. | Problem (application/problem+json) |
503 |
A problem. | Problem (application/problem+json) |
GET /v1/audit/head
Section titled “GET /v1/audit/head”The chain head, the document sefra audit head prints. sefra_viewer and above.
Responses
| Status | Description | Body |
|---|---|---|
200 |
The head; at is null for an empty chain. |
AuditHead |
400 |
A problem. | Problem (application/problem+json) |
401 |
No valid token (with WWW-Authenticate). |
Problem (application/problem+json) |
403 |
The principal is not human or lacks the role. | Problem (application/problem+json) |
GET /v1/audit/payloads/{hash}
Section titled “GET /v1/audit/payloads/{hash}”A payload body by hash, redacted as stored. sefra_auditor and above, any hash.
Sensitive values appear as {"$redacted": "<keyed hash>"}. A body deleted or past its retention is erased, its hash still in the chain; no stored row is 404 with problem type urn:sefra:problem:payload-not-stored (any other 404 is not about the hash). Every read is written to the structured log with the reader’s principal.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
hash |
path | string | Yes | Pattern: ^(sha256:)?[0-9a-f]{64}$. |
Responses
| Status | Description | Body |
|---|---|---|
200 |
The body, or erased. | Payload |
400 |
A problem. | Problem (application/problem+json) |
401 |
No valid token (with WWW-Authenticate). |
Problem (application/problem+json) |
403 |
The principal is not human or lacks the role. | Problem (application/problem+json) |
404 |
A problem. | Problem (application/problem+json) |
GET /v1/executions/{id}/audit
Section titled “GET /v1/executions/{id}/audit”Every audit event of one execution, in order. sefra_viewer and above; without read_payloads, policy-authored text and computed rule names are withheld from body.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id |
path | string | Yes |
Responses
| Status | Description | Body |
|---|---|---|
200 |
The events. | object |
401 |
No valid token (with WWW-Authenticate). |
Problem (application/problem+json) |
403 |
The principal is not human or lacks the role. | Problem (application/problem+json) |
404 |
A problem. | Problem (application/problem+json) |
Body of 200
| Field | Type | Required | Description |
|---|---|---|---|
events |
array of AuditEvent | Yes |