Get Started with Aeion Governance

Five steps to enterprise governance — hash-chained audit trails, framework-driven compliance evaluation, approval workflows with delegations, and retention policies. Custom endpoints for the workflow surface; auto-CRUD on every collection for everything else.

1

Inspect the Governance Dashboard

The governance module exposes a roll-up endpoint that drives the admin homepage widget and powers the sidebar badge. Call it any time to see open work, posture, and active alerts:

bash GET /api/governance/stats

json { "data": { "pendingApprovals": 4, "activePolicies": 27, "recentChanges": 12, "complianceScore": 92, "alerts": [ { "type": "approval", "severity": "medium", "message": "4 approval requests awaiting review", "timestamp": "2026-05-20T10:00:00Z" } ] } }

For the sidebar badge alone, use the cheaper count endpoint:

bash GET /api/governance/approvals/pending-count

json { "data": { "count": 4 } }

Risk roll-up (open requests, overdue requests, non-compliant resources):

bash GET /api/governance/risk/summary

json { "data": { "totalRequests": 142, "openRequests": 6, "overdueRequests": 1, "nonCompliantResources": 3 } }

2

Write a Tamper-Evident Audit Entry

Aeion records audit events in gov_audit_trails. Every row carries a SHA-256 hash that chains to the previous entry, so any historical edit is detectable on verification. Other modules call the audit service directly; for direct API access, post to the collection:

bash POST /api/v1/gov_audit_trails { "timestamp": "2026-05-20T10:15:00Z", "data": { "action": "update", "actor": "<userId>", "resource": "customer_record", "resourceId": "cust-123", "before": { "status": "active" }, "after": { "status": "suspended" }, "ip": "192.168.1.100", "classification": { "sensitivity": "high", "complianceFrameworks": ["SOC2", "GDPR"], "requiresRetention": true } } }

Export the audit trail (CSV download — handy for SOC2 auditors and incident response):

bash GET /api/governance/audit/export GET /api/governance/audit/export?startDate=2026-01-01&endDate=2026-12-31 GET /api/governance/audit/export?action=update&actor=<userId>

Returns up to 10,000 rows as text/csv with content-disposition header for browser download. Columns: id, timestamp, action, actor, resource, resourceId, details.

Query specific entries via auto-CRUD with JSON-path filters:

bash GET /api/v1/gov_audit_trails?where[data.action][equals]=delete&sort=-timestamp&limit=100

3

Run a Compliance Evaluation

Compliance frameworks live in gov_compliance_frameworks and the engine writes per-resource results to gov_compliance_logs. SOC2, GDPR, ISO 27001, HIPAA, and PCI-DSS ship as seed framework templates — extend or add new ones as collection rows.

List available frameworks:

bash GET /api/governance/compliance/frameworks

Evaluate a framework (admin only — sweeps every applicable resource for the tenant):

bash POST /api/governance/compliance/evaluate { "frameworkId": "<frameworkId>" }

json { "data": { "framework": "<frameworkId>", "passed": 45, "failed": 3, "warnings": 8, "results": [ { "resourceType": "user", "resourceId": "u-1", "status": "compliant" }, { "resourceType": "encryption_key", "resourceId": "k-9", "status": "non_compliant", "controlId": "CC6.6" } ] } }

Get current status across all frameworks:

bash GET /api/governance/compliance/status

Get status for a specific framework:

bash GET /api/governance/compliance/status/<frameworkId>

Ad-hoc check for a single resource (useful right after a sensitive operation):

bash POST /api/governance/compliance/check { "frameworkId": "<frameworkId>", "resourceType": "customer_record", "resourceId": "cust-123" }

Returns a gov_compliance_logs row recording the check result, the controlling check function, and the tenant + user who triggered it.

4

Wire Approvals (with Delegations)

Approval requests live in gov_requests. Policies — who can approve what, under what conditions — live in gov_policies. Delegations (vacation coverage, role transitions) live in gov_delegations.

Define an approval policy (auto-CRUD):

bash POST /api/v1/gov_policies { "name": "Budget Approval Over $10,000", "status": "active", "priority": 1, "data": { "conditions": [ { "field": "amount", "operator": "greaterThan", "value": 10000 }, { "field": "type", "operator": "equals", "value": "expense" } ], "approvers": [ { "type": "role", "role": "vp_finance" }, { "type": "user", "id": "<cfoId>" } ], "escalationHours": 48, "requireUnanimous": false } }

Submit an approval request:

bash POST /api/v1/gov_requests { "type": "expense", "status": "pending", "dueDate": "2026-05-22T17:00:00Z", "data": { "amount": 25000, "vendor": "Office Supplies Inc", "description": "Q3 equipment purchase", "requestedBy": "<userId>" } }

The policy engine matches the request to the highest-priority policy, computes the approver set (substituting delegates for any approver currently on leave), and writes the result back to the request row.

Approve or reject:

bash POST /api/governance/approvals/requests/<requestId>/decide { "decision": "approved", "comments": "Within Q3 budget" }

Decisions are recorded with approverId (from the authenticated user), audit-stamped, and the request status transitions to approved or rejected. If unanimous approval is required, the row stays pending until every approver has decided.

Create a delegation for vacation coverage:

bash POST /api/v1/gov_delegations { "delegatorId": "<managerId>", "delegateId": "<backupId>", "fromDate": "2026-07-01", "toDate": "2026-07-14", "reason": "Annual vacation", "status": "active", "data": { "scope": { "policyIds": ["<budget-approval-policy-id>", "<purchase-policy-id>"], "maxAmount": 50000, "types": ["expense", "purchase_order"] }, "notifyOnDelegation": true, "notifyOnReturn": true } }

Overlapping delegations are blocked by the service when it creates a row (date range check against existing active delegations for the same delegator).

5

Set Retention Policies + Track Changes

Two final collections close the governance loop. Both are pure auto-CRUD — the heavy lifting happens in scheduled jobs and event-driven workers.

Retention policy — declares how long records of a given collection live, and what to do when they're past their date:

bash POST /api/v1/gov_retention_policies { "name": "Customer Records — 7 Year Retention", "collection": "customers", "status": "active", "data": { "conditions": [ { "field": "status", "operator": "equals", "value": "inactive" } ], "retentionPeriod": { "duration": 7, "unit": "years" }, "archiveBeforeDelete": true, "archiveStorageLocation": "s3://aeion-archive/customers", "encryption": "AES-256" } }

A nightly cron evaluates active policies, archives matching rows to the configured storage location, and writes a deletion audit trail before removing the originals. The retention worker is the only path to permanent deletion — every step ends up in gov_audit_trails.

Change requests — track infrastructure or policy changes that need governance review:

bash POST /api/v1/gov_change_requests { "title": "Migrate to new S3 archive bucket", "type": "retention_change", "status": "pending", "riskLevel": "medium", "data": { "before": { "bucket": "old-archive" }, "after": { "bucket": "new-archive" }, "rollbackPlan": "Switch bucket env var back; archives are dual-written for 30 days", "estimatedDowntime": 0, "affectedSystems": ["governance", "legal"] } }

Access policies — fine-grained per-resource access rules, evaluated in priority order:

bash POST /api/v1/gov_access_policies { "name": "Restrict PII reads after hours", "resource": "customers", "priority": 10, "effect": "deny", "data": { "conditions": [ { "field": "operation", "operator": "equals", "value": "read" }, { "field": "fieldGroup", "operator": "equals", "value": "pii" }, { "field": "hour", "operator": "outsideRange", "value": [9, 18] } ] } }

Sorted by priority ascending; first matching policy wins; no match = default deny.

Quick Reference

SlugPurpose
`gov_audit_trails`Hash-chained audit ledger
`gov_compliance_frameworks`Framework definitions (SOC2, GDPR, ISO 27001, etc.)
`gov_compliance_logs`Per-resource compliance check results
`gov_policies`Approval policies (matched by conditions + priority)
`gov_requests`Approval request instances
`gov_delegations`Vacation / role-transition coverage
`gov_change_requests`Tracked infrastructure or policy changes
`gov_retention_policies`Auto-archive + auto-delete rules
`gov_access_policies`Per-resource access rules with priority + effect

FAQ

Every `gov_audit_trails` row carries a SHA-256 hash computed from the entry payload plus the previous row's hash. Modifying a historical row invalidates every subsequent hash, making tampering detectable on a chain-walk. Verification scans the chain and compares stored hashes to recomputed ones; any mismatch surfaces the offending row.

SOC2 Type II, GDPR, ISO 27001, HIPAA, and PCI-DSS. They're seeded into `gov_compliance_frameworks` on first boot. Add your own by inserting rows with `data.controls` arrays — the evaluator walks every control's `checkFunction` against tenant resources to populate `gov_compliance_logs`.

It's a single SQL aggregation over the latest `gov_compliance_logs` row per `(resourceType, resourceId)` pair (so re-checks of the same resource don't inflate the denominator). Score = compliant / total × 100, rounded. With no logs yet, the score is 100% — neutral, not pessimistic, so a fresh tenant doesn't see misleading red flags.

Policies are sorted by `priority` ascending — lower number wins. Each policy's `conditions` array is evaluated against the request context with operators `equals` / `notEquals` / `greaterThan` / `lessThan` / `contains` / `in` / `notIn`. The first policy whose every condition matches is selected, and its `approvers` array becomes the request's approver set.

Before inserting a `gov_delegations` row, the service queries for active or scheduled delegations whose date ranges overlap the proposed window. If `fromA <= toB AND toA >= fromB`, the request is rejected with `OVERLAPPING_DELEGATION`. A separate cycle check refuses A→B when an active B→A delegation already exists.

A scope limits what the delegate can approve on the delegator's behalf — by policy ID list, by monetary cap (`maxAmount`), or by request type. Anything outside scope falls through to the next approver in the policy or escalates. Scopes default to the delegator's full authority if not provided.

Same shape as approval policies: sort by `priority` ascending, first match wins. The match is "first policy whose conditions all evaluate true." A matching `deny` policy beats any later `allow`. No match = default deny.

When `archiveBeforeDelete: true` the worker writes the row to the configured storage (S3 / GCS / Azure) before deleting from the live DB. The archive object's URL goes into a `gov_audit_trails` entry so legal-hold retrievals can find it. Setting `archiveBeforeDelete: false` skips the archive step — discouraged for any regulated workflow.

`/api/governance/risk/summary` returns `overdueRequests` — open requests where `dueDate < NOW()`. The admin dashboard widget uses this. For the full list, query the underlying collection: `GET /api/v1/gov_requests?where[status][equals]=pending&where[dueDate][lt]=now`.

Yes — `POST /api/governance/compliance/check` with `{frameworkId, resourceType, resourceId}` runs every applicable control against that single resource and writes one `gov_compliance_logs` row. Useful right after a sensitive change so the next `/stats` call reflects reality.

`startDate`, `endDate`, `action`, `actor` — all optional, all as query params, all hit the JSON `data->>'field'` accessors and the top-level `timestamp` index. Max 10,000 rows per export; chain multiple requests with date ranges for larger pulls.

`gov_change_requests` track _what is changing_ (the diff, the rollback plan, the risk score, the affected systems). `gov_requests` track _who needs to say yes_ (the workflow, the approvers, the decisions). A risky change usually has a `gov_change_requests` row referencing one or more `gov_requests` for the approvals it needs.

`governance.audit.recorded`, `governance.audit.chain_break_detected`, `governance.compliance.evaluated`, `governance.compliance.resource_failed`, `governance.approval.requested`, `governance.approval.decided`, `governance.approval.escalated`, `governance.delegation.created`, `governance.delegation.expired`, `governance.delegation.revoked`, `governance.retention.archived`, `governance.retention.deleted`. Subscribe to drive notifications or downstream policy responses.

Open the Governance Dashboard