Audit trail API
The routes that read the audit trail, the Operations audit of Security (audit.duckdb, Starter, Pro and Enterprise). The trail itself: Security and 21 CFR Part 11.
Who may call them
Section titled “Who may call them”- A signed-in user, in a session;
401without one. Records about a tag (a write with its old and new value, a refused write, an AI setpoint, a recipe setpoint) are left out for a caller who may not read that tag; every other record is returned as it is (tag read rights). In the Studio, the Security workspace’s Operations audit tab is shown to Administrator, Compliance_Auditor, Lead_Engineer and Process_Supervisor. - Never over remote access (eaxCloud remote sessions).
- Starter, Pro and Enterprise. A server without an audit trail (the Free edition, a build without DuckDB) answers
403(below). A Free server that holds a trail from a paid period answers both routes from it, read-only. X-Audit-Trail-Mode, on the answers of both routes once the caller is signed in (the403included): the trail’s mode,recording,down,read_onlyornone(The trail’s state). The Operations audit shows its note above the grid from it.
| Method | Path | What it does |
|---|---|---|
| GET | /api/audit |
A page of records, newest first. |
| GET | /api/audit/verify |
Checks the whole chain. |
GET /api/audit
Section titled “GET /api/audit”| Parameter | Value | Default |
|---|---|---|
limit |
Records per page, a whole number; 0 for every record |
100 |
before |
The cursor: the X-Audit-Next-Before header of the previous page. Only records before that place in the trail. |
the newest record |
category |
Exact category, for example ALARM, DEPLOY, SYSTEM, SECURITY |
every category |
action |
Exact action, for example MANUAL_OVERRIDE |
every action |
user |
Exact user id of the record (user_id) |
every user |
resource |
Exact resource, or a prefix ending in * (Plant/Line1/*) |
every resource |
origin |
Exact origin: the server run that wrote the record (How verification works) | every origin |
from, to |
A time, inclusive: RFC 3339 (2026-11-11T08:00:00Z) or Unix milliseconds |
open |
Filters combine (all must match). Every value is passed to the database as a parameter, never as query text.
The answer is a JSON array of records, newest first, the same as before this release. When there are more records, the header X-Audit-Next-Before carries the cursor of the next page; on the last page it is absent.
GET /api/audit?action=MANUAL_OVERRIDE&limit=50200 OKX-Audit-Next-Before: 4812X-Audit-Trail-Mode: recordingContent-Type: application/json
GET /api/audit?action=MANUAL_OVERRIDE&limit=50&before=4812Pages do not overlap and leave no gap, also while new records arrive: a new record goes on top and does not move the cursor. A caller limited by tag read rights is served page by page until limit records it may read are found or the trail ends; it never receives a record it may not read, and the cursor points after the last record it was given.
One record:
{ "sequence": 4812, "timestamp": 1794384000123456789, "timestamp_iso": "2026-11-11T08:00:00.123456789Z", "user_id": "operator1", "user_role": "Shift_Operator", "action": "MANUAL_OVERRIDE", "resource": "Plant/Line1/Pump1/Speed_SP", "old_value": "40.000000", "new_value": "45.000000", "reason": "raise flow for batch 2026-118", "context": { "...": "..." }, "previous_hash": "9c1f…", "record_hash": "e9b4…", "origin": "5f0c…", "origin_seq": 311, "node": "scada-a"}sequence is the record’s place in this server’s trail (1, 2, 3 …); timestamp is Unix nanoseconds. category, resource_name, diff, version_ref, signature, origin, origin_seq and node are left out when empty.
GET /api/audit/verify
Section titled “GET /api/audit/verify”Checks every record of the trail, read from the database, in order: each record’s hash, its link to the record before it, that no place in the trail is empty, and that the trail does not end before its tip anchor.
{ "valid": true, "total_records": 5834, "verified_records": 5834, "chains": 3 }On a break, valid is false, and broken_seq, reason, expected_hash, actual_hash and error describe the first record that does not follow:
reason |
Meaning |
|---|---|
previous_hash |
The record does not point at the record before it in its chain, or its origin sequence is not the next one: a record was inserted or reordered. |
record_hash |
Its content no longer gives its hash, or the context stored with it is not the one the hash covers: it was changed. |
missing_record |
A place in the trail is empty: a record was removed. |
tip_anchor |
The trail ends before the last record the server knew of, or holds another record there: its last records were cut off, or the file was replaced by an older copy. Reported until the server restarts; LEDGER_TIP_MISMATCH records it. |
unreadable |
The database could not be read (error names the fault). |
chains, legacy_records and unanchored_chains are explained in How verification works.
Answers
Section titled “Answers”| Status | Code | When |
|---|---|---|
200 |
The page, or the chain check. | |
400 |
A bad limit (“a whole number, 0 for every record”), before (“a positive whole number (the X-Audit-Next-Before of the previous page)”), from or to (“an RFC 3339 time or Unix milliseconds”). |
|
401 |
No session or token. | |
403 |
NO_AUDIT_TRAIL |
The server has no audit trail. |
500 |
The audit database could not be read: “the audit trail cannot be read in full: the audit database could not be read (…); run Verify in Security > Operations audit”. Never a shorter list that looks complete. |
403 NO_AUDIT_TRAIL
Section titled “403 NO_AUDIT_TRAIL”{ "status": "edition_required", "code": "NO_AUDIT_TRAIL", "edition_required": "starter", "error": "The audit trail requires a Starter licence or higher; this server has no audit trail."}The Free edition answers it on both routes. It also refuses, with the same code and status, the actions that would leave no record where one matters: the AI co-pilot’s setpoint staging and approval (403, “… is refused on a server without one, as it would leave no record”) and the genealogy purge. The co-pilot’s PLC deploy, I/O force, PLC control and rollback tools return the same refusal as their error.
503 AUDIT_NOT_WRITTEN
Section titled “503 AUDIT_NOT_WRITTEN”Not an answer of these routes, but of every action that records first when its record cannot be written: in Starter, Pro and Enterprise while the trail is down (ALM-SYS-AUDIT-DOWN), or when a commit fails. Nothing changed.
{"status": "refused", "code": "AUDIT_NOT_WRITTEN", "error": "… refused, nothing changed: the audit trail could not be written: …"}Treat it as “nothing changed; retry once the audit trail is back”. See When the audit trail is down.
The trail’s state
Section titled “The trail’s state”The trail is in one of four modes:
| Mode | Meaning |
|---|---|
recording |
Starter, Pro or Enterprise: the trail takes records. |
down |
Starter, Pro or Enterprise: the trail does not open or take writes, or its folder is refused. Every action that records first answers 503 AUDIT_NOT_WRITTEN (When the audit trail is down). |
read_only |
Free, with a trail kept from a paid period: read and verified, nothing written. |
none |
Free without a trail, or a build without DuckDB. |
Three routes give it besides the header:
| Route | Who | audit_trail |
|---|---|---|
GET /api/system/health |
Lead_Engineer, Administrator | The full state (below). |
GET /api/licence |
Administrator | mode; reason when down; why when none. |
GET /api/system/info |
Every signed-in user | mode; why when none. Never the reason (it may name a folder). |
why is free (the edition) or build (a build without DuckDB).
The full state in GET /api/system/health:
"audit_trail": { "mode": "recording", "file": "data\\audit\\audit.duckdb", "size_bytes": 20480, "records": 6, "last_append": "2026-11-11T11:57:53Z", "append_p50_ms": 6.3, "append_p99_ms": 6.77, "append_samples": 6, "encrypted": false, "warnings": ["…"]}| Field | Meaning |
|---|---|
mode |
recording, down, read_only or none. |
reason |
When down: why (the open error, or the system requirement refused). |
file |
The trail’s file (absent for none). |
size_bytes |
The file and its write-ahead log, in bytes. |
records |
Records in the trail. |
last_append |
When the last record was committed in this run, RFC 3339 UTC; absent before the first. |
append_p50_ms, append_p99_ms |
The time an append takes, from the start of its transaction to its commit: median and 99th percentile over the last 1,000 appends of this run (append_samples). System Health marks p99 above 50 ms amber. |
encrypted |
The file is encrypted with the historian’s key. |
warnings |
The system requirement warnings found when the trail opened (removable media, little free space, implausible sync times); absent when none. |
For none only mode and the zero counters are given.
The audit trail’s own records
Section titled “The audit trail’s own records”The trail records what happens to itself, in category SYSTEM:
| Action | When | What it says |
|---|---|---|
GENESIS |
The first record of a new trail (resource SYSTEM_INIT). |
“System initialized with 21 CFR Part 11 compliance”. |
AUDIT_TRAIL_STARTED |
After every genesis the server writes (resource audit.duckdb). |
“The audit trail starts here (eaxScada <version>).”; for a trail started by a licence installed while the server runs, “A licence that includes the audit trail was installed while the server ran: the audit trail records from here on.” When an earlier JSON trail (audit_ledger.jsonl) is in the audit folder, it adds its name and size and that it “is not part of this trail and is not read”. |
AUDIT_TRAIL_RESUMED |
The trail opens again after it was down; or a licence that includes the audit trail is installed on a Free server that kept a trail from a paid period (once). | After it was down: “no record was written while it was down (every action that needed one was refused)”. After a Free period: “… The audit trail records again: no records were kept from <its last record> to <now> (Free edition).” The chain continues. |
AUDIT_STORAGE_WARNING |
At start, one per system-requirement warning: removable media, an SD card or eMMC, less than 20 GB free, an implausibly fast or slow sync. | The warning and the fix (requirements). |
LEDGER_TIP_MISMATCH |
At start, the trail ends before the tip anchor kept in the security store, or holds another record at its place. | The anchor and the tip found. The start continues; Verify reports tip_anchor until the next start. |
LEDGER_COMMIT_UNCONFIRMED |
After the trail is opened again: a record whose commit reported an error is in the database after all. One per such record. | That record’s action, resource and hash, and that it was reported as not written: its action was refused. The chain stays valid. |
LEDGER_FILE_SET_ASIDE |
The first record after the genesis of a trail started by eaxscada audit-set-aside (resource: the old file’s new name). |
The old file’s new name, size and SHA-256, who set it aside (offline, e-signed) and why. |
LEDGER_FILE_REPAIRED |
The next record of a trail a checkpoint cut short, repaired by eaxscada audit-set-aside --repair (Repair a trail a checkpoint cut short). The chain continues. |
The reason, the open error, the block and its stored and computed checksums, the verification, who repaired it (offline, e-signed), the original’s new name (audit.torn-<UTC time>.duckdb) and SHA-256, the repaired file’s SHA-256, the write-ahead log and the journal. |
AUDIT_TRAIL_RESTORED |
The last record of a trail put back by eaxscada restore. |
The backup file, who restored it, the copy’s SHA-256, its record count and last hash; that the tip anchor was reset. |
The sign-in trail (Access audit) has its own AUDIT_TRAIL_RESTORED entry for its own restore, with the original records kept beside it.