Summary
Financial platforms are subject to AML/KYC and data-residency regulations that require producing a verifiable, tamper-evident audit trail on demand. Currently, audit log data exists in the database but there is no export mechanism for regulators or internal compliance teams.
Proposed Solution
Add GET /api/admin/audit-log/export endpoint:
Query params: from, to (ISO 8601), userId (optional), eventType (optional), format=json|csv
Response fields per record:
eventId, occurredAt, userId, adminKeyId, eventType, ipAddress, userAgent, requestId (correlation ID), metadata (JSONB)
Tamper-evidence:
- Each exported batch includes an HMAC-SHA256 digest of the full payload, signed with a dedicated
AUDIT_EXPORT_SECRET
- Recipients can verify the digest to confirm the export has not been modified
Access control:
- Requires admin key with
super scope
- Every export request is itself logged to the audit log (who exported, what range)
- Exports rate-limited to 5 per hour per admin key
Acceptance Criteria
Summary
Financial platforms are subject to AML/KYC and data-residency regulations that require producing a verifiable, tamper-evident audit trail on demand. Currently, audit log data exists in the database but there is no export mechanism for regulators or internal compliance teams.
Proposed Solution
Add
GET /api/admin/audit-log/exportendpoint:Query params:
from,to(ISO 8601),userId(optional),eventType(optional),format=json|csvResponse fields per record:
eventId,occurredAt,userId,adminKeyId,eventType,ipAddress,userAgent,requestId(correlation ID),metadata(JSONB)Tamper-evidence:
AUDIT_EXPORT_SECRETAccess control:
superscopeAcceptance Criteria
X-Audit-DigestAUDIT_EXPORT_SECRETdocumented in.env.exampledocs/API_REFERENCE.md