API Reference
Audit Logs
/api/v1/console/audit/logs JWT API KeySearch and filter, newest first
The reference implementation's screen was 250 rows with no filters and no pagination ( limitation L8) — on a busy branch, anything older was reachable only from the database. Filterable here by verb, entity, actor, Baghdad business-day window and chain sequence. `from_seq`/`to_seq` is the link an integrity alert needs: a broken-chain alert names a sequence and nothing else.
- Capability
view_audit- API key scope
cap:view_audit(the key's owner must also hold the capability)
Query parameters
| Action string | An exact verb from `AuditVerbs`, e.g. `CREATE_SALE`. Matched exactly (uppercased), not by prefix: the verb catalogue is closed and the value comes back from this same API, so a fuzzy match here would only ever hide a typo. |
| EntityType string | The audited entity's type name, e.g. `Branch`. Matched <b>exactly</b> so the `(EntityType, EntityId)` index serves the query; a `lower()` comparison would not. The value is echoed by every response, so an exact match costs the caller nothing. |
| EntityId string (uuid) | One entity's id. Combine with Panoptes.Application.DTOs.Requests.Audit.ListAuditLogsRequest.EntityType for the indexed path. |
| UserId string (uuid) | The acting principal. "What did this cashier touch on Tuesday" is one query. |
| From string (date) | Inclusive first <b>Baghdad business day</b> of the window. Windowed as `CreatedAt >= start AND CreatedAt < endExclusive` (INV-024) — never a naive UTC-midnight range, which silently drops every row written between 00:00 and 03:00 Baghdad. That is the late-night closing window, which is exactly where the disputed rows are. |
| To string (date) | Inclusive last Baghdad business day of the window. |
| FromSeq integer (int64) | First chain sequence to return, inclusive. <br>This is the link an integrity alert needs. A `CHAIN_BROKEN` alert names `refSeq` and nothing else; without a sequence window the owner is told the chain broke at row 4,812 and given no way to look at row 4,812. |
| ToSeq integer (int64) | Last chain sequence to return, inclusive. |
| Page integer (int32) | — |
| PerPage integer (int32) | — |
| Search string | Free-text filter. Its meaning is per-resource and documented on the endpoint. |
| Skip integer (int32) | Rows to skip, derived — never sent by the caller on this surface. |
| Sort string | A snake_case column key from the endpoint's allow-list (`created_at`, `gross_total`, `status` …). Absent or blank → the endpoint's default order. |
| Dir string | `asc` (the default when Panoptes.Application.Common.SortableRequest.Sort is present) or `desc`. Ignored without a sort. |
Responses
curl -X GET "https://staging-api.panoptesos.com/api/v1/console/audit/logs" \
-H "X-Api-Key: <YOUR_API_KEY>"Query parameters
Headers
/api/v1/console/audit/logs/{id} JWT API KeyOne entry, hashes included
Another branch's id reads as `NOT_FOUND`.
- Capability
view_audit- API key scope
cap:view_audit(the key's owner must also hold the capability)
Path parameters
| idrequired string (uuid) | — |
Responses
curl -X GET "https://staging-api.panoptesos.com/api/v1/console/audit/logs/{id}" \
-H "X-Api-Key: <YOUR_API_KEY>"Path parameters
Headers
/api/v1/console/audit/logs/entities/{entityType}/{entityId} JWT API KeyEverything that ever happened to one entity, in chain order
The entity type and id are the route because this is the access path the `(EntityType, EntityId)` index exists for — and it is the only place a payload (`?field=`) search is offered, since no GIN index covers those columns and the branch-wide equivalent would be a sequential scan of the largest table in the database.
- Capability
view_audit- API key scope
cap:view_audit(the key's owner must also hold the capability)
Path parameters
| entityTyperequired string | — |
| entityIdrequired string (uuid) | — |
Query parameters
| Field string | Narrows to rows whose stored payload mentions this field name. <br>A <b>text containment</b> over the canonical JSON, not a `jsonb` path predicate: the path operators are Npgsql extensions and the application layer must not reference the provider (SRS §3.6). Narrowed by the entity index first, so the scan is over one row's history rather than the branch's. It answers "every change that touched `UnitPriceIqd`" and it is honest about being a substring test — a field whose name is a substring of another field's name matches both. |
| Page integer (int32) | — |
| PerPage integer (int32) | — |
| Search string | Free-text filter. Its meaning is per-resource and documented on the endpoint. |
| Skip integer (int32) | Rows to skip, derived — never sent by the caller on this surface. |
| Sort string | A snake_case column key from the endpoint's allow-list (`created_at`, `gross_total`, `status` …). Absent or blank → the endpoint's default order. |
| Dir string | `asc` (the default when Panoptes.Application.Common.SortableRequest.Sort is present) or `desc`. Ignored without a sort. |
Responses
curl -X GET "https://staging-api.panoptesos.com/api/v1/console/audit/logs/entities/{entityType}/{entityId}" \
-H "X-Api-Key: <YOUR_API_KEY>"Path parameters
Query parameters
Headers
/api/v1/console/audit/logs/export JWT API KeyGet export
The filtered log as an auditor's archive (benchmark AUD C7): the rows as CSV or XLSX with each canonical row's preimage, a manifest (row count, first/last sequence, link anchors, the chain head) and its signature, and the offline verification procedure — one ZIP.
Same filters as the search, no paging: the whole set or a refusal, never a truncated file. The export appends its own `EXPORT_AUDIT_LOG` row carrying the manifest's digest. A failure returns the envelope rather than a zero-byte download.
- Capability
view_audit- API key scope
cap:view_audit(the key's owner must also hold the capability)
Query parameters
| Action string | Exact verb, uppercased (FR-AUD-005's closed catalogue). |
| EntityType string | — |
| EntityId string (uuid) | — |
| UserId string (uuid) | The acting user. |
| From string (date) | First Baghdad business day, inclusive. |
| To string (date) | Last Baghdad business day, inclusive. |
| Format string | `csv | xlsx`. Absent = `csv`, the format an offline verifier reads byte for byte. |
Responses
curl -X GET "https://staging-api.panoptesos.com/api/v1/console/audit/logs/export" \
-H "X-Api-Key: <YOUR_API_KEY>"Query parameters
Headers