Skip to main content

How to Build a Complete API Audit Trail for Banking Regulators

Banking regulators want to know who accessed which API, when, and what happened. Here's how to build an API audit trail that satisfies regulators and internal compliance teams.

  • banking
  • compliance
  • audit-trail
  • open-banking
  • psd2
Zerq team

When a banking regulator asks about API access, they want one thing: a complete, accurate, tamper-evident record of who accessed what, when, and what the outcome was. Not a set of server logs. Not a spreadsheet reconstructed from three different systems. A single, queryable audit trail.

Most banks and financial institutions do not have this - not because they are negligent, but because API infrastructure has grown in layers. A gateway here, a logging tool there, partner credentials managed in a spreadsheet, AI tools that started calling APIs before anyone thought about authentication. The audit trail exists in fragments across systems, and assembling it for a regulator takes days of engineering effort that should not be necessary.

This article covers what a complete API audit trail requires for banking and financial services, what regulators actually ask for, and how to build an architecture that answers those questions without scrambling.

What Regulators Actually Ask For

Before designing an audit trail, it helps to know what you will be asked to produce. Across PSD2, open banking frameworks (UK Open Banking, Berlin Group), and broader financial services regulation, the common audit questions are:

Access questions

  • Which third-party providers (TPPs) accessed which account or payment APIs, and when?
  • Did a specific TPP access an endpoint they were not authorized to use?
  • What was the rate of API calls from a given TPP over a specific period?

Consent and authorization questions

  • Was the customer's consent in place at the time of the API call?
  • Was the TPP's certificate or token valid at the time of access?
  • Were the correct scopes enforced for each request?

Incident questions

  • What API calls were made in the 30 minutes before a specific transaction?
  • Was there any unusual access pattern from a specific TPP on a given date?
  • Which endpoints were called most frequently and by whom in the past quarter?

Configuration and change questions

  • Who changed the rate limits for a specific TPP, and when?
  • When was a TPP's access credential last rotated?
  • What changes were made to the API product configuration in the past 90 days?

Notice that these questions cover two distinct categories: API usage (who called what) and platform configuration (who changed what). A complete audit trail needs both.

The Four Components of a Complete API Audit Trail

1. Request-level logging

Every API request that passes through your gateway should produce a structured log entry containing at minimum:

  • Timestamp (to millisecond precision, in UTC)
  • Client identifier (which TPP or partner made the request)
  • Credential used (which API key, token, or certificate)
  • API product and endpoint called
  • HTTP method
  • Response status code
  • Response time (latency)
  • Request identifier (for correlation with downstream logs)

This is the foundation. Without it, you cannot answer basic access questions. Critically, this logging needs to happen at the gateway, not at the backend. Backend-level logging misses requests that are rejected at the gateway (authentication failures, rate limit violations) and cannot correlate across multiple backends that serve different parts of your API surface.

2. Configuration change audit

Every change to your API platform configuration should produce a separate audit record containing:

  • Who made the change (user identity, not just a service account)
  • What was changed (which resource, which field, old value, new value)
  • When the change was made
  • Whether the change was made through the UI, via automation, or via an API

This is where many platforms fall short. Request-level logging is common; configuration change audit is less so. But configuration changes are exactly what regulators ask about when something goes wrong - "who changed the rate limits for this TPP and when?" is unanswerable without a configuration audit trail.

3. Authentication event logging

Failed authentication attempts are as important as successful ones. Your audit trail should capture:

  • Successful authentications (token issued, certificate validated)
  • Failed authentication attempts (invalid credentials, expired token, certificate mismatch)
  • Credential rotation events (when a key or certificate was rotated, by whom)
  • Access revocation events (when a TPP's access was suspended or revoked)

Authentication event logging is what lets you answer incident questions. If a TPP's credentials were compromised, you need to know every API call made with those credentials - and every failed attempt to use them - in a given time window.

4. Consent and authorization logging (open banking specific)

For open banking specifically, the audit trail needs to capture the consent context for each API call:

  • The consent reference or authorization code associated with the request
  • The scopes that were active at the time of the request
  • Whether the consent was valid (not expired, not revoked) at the time of the request

This links API access to customer consent, which is the specific question regulators ask in open banking audits: was this access authorized by the customer, and can you prove it?

Architecture Decisions That Affect Audit Completeness

How you build your API infrastructure determines whether a complete audit trail is achievable or requires ongoing engineering effort to maintain.

Centralize authentication at the gateway. If some requests are authenticated at the gateway and others are authenticated at individual backend services, you have split logging - and a gap in your audit trail for any request that bypasses the gateway. Every API call, from every client type (apps, partners, AI agents), should authenticate at the gateway. This is the single enforcement point that produces a complete, consistent log.

Use structured logging, not free-text. Audit logs that are machine-readable (JSON, not log lines) can be queried directly, filtered by any field, and exported to your SIEM without transformation. Free-text logs require parsing to answer audit questions - and parsers break when log formats change. Structured logging from day one avoids this technical debt.

Keep audit data in your environment. For regulated financial institutions, audit logs contain sensitive metadata about customer API access. This data should be stored in infrastructure you control - not in a cloud logging service operated by a third party. Data residency requirements are common in banking and financial services; your audit trail needs to respect them.

Separate audit logs from operational logs. Operational logs (for debugging, performance monitoring) and audit logs (for compliance) serve different purposes and have different access requirements. Compliance teams should be able to query audit logs without needing access to operational systems. The simplest implementation is a dedicated audit role that can read audit logs and nothing else.

Log AI agent requests identically to app requests. AI tools calling your APIs are increasingly common in banking environments - internal assistants, automated reconciliation tools, chatbots that query account data. If these tools use a separate authentication path or a separate log stream, you have a gap in your audit trail. AI agents should authenticate through the same gateway, with the same logging, as every other client.

What "Tamper-Evident" Means in Practice

Regulators do not just want audit logs - they want audit logs they can trust. Tamper-evident means the logs cannot be modified after the fact without detection.

In practice, this means:

Append-only storage. Audit logs should be written to storage where records can be added but not modified or deleted. Most SIEM systems and log management platforms support this mode.

Log integrity verification. Some regulated environments require cryptographic verification that log records have not been altered. This can be implemented with hash chaining (each log entry includes a hash of the previous entry) or by writing logs to a write-once storage tier.

Separation of who can write and who can read. The systems that produce audit logs should not be the same systems that can modify them. The gateway writes audit logs; compliance teams read them; neither can edit them.

Retention policy enforcement. PSD2 requires transaction records to be retained for a minimum period. Your audit log retention policy should be configured and enforced automatically - not dependent on someone remembering to archive records before storage is recycled.

Common Audit Trail Failures in Banking

Having reviewed how banks typically handle API audit trails, these are the failure patterns that show up most frequently:

Logs exist but are not queryable. The data is there, in blob storage or a logging pipeline, but there is no way for a compliance officer to ask "show me all requests from TPP X between these dates" without involving an engineer. Audit logs that require engineering effort to query are audit logs that do not exist in practice.

Configuration changes are not logged. Request-level logging is in place, but nobody tracked who changed the rate limits, added a new TPP, or modified the API product definition. When the regulator asks about a configuration change, the answer is genuinely "we do not know."

AI tools have a parallel path. Internal AI assistants or automated tools are calling account APIs through a service account that bypasses the main gateway. Requests from these tools do not appear in the main audit trail. This is invisible until an auditor asks specifically about it.

Multi-system correlation is required. Consent records are in one system, API access logs in another, authentication events in a third. Answering a single audit question requires correlating records across three systems, and the correlation logic breaks when any system changes its log format.

Logs are retained inconsistently. Some API products have 90-day log retention; others have 30 days; some have no defined retention policy. When a regulator asks for records from 18 months ago, some are available and some are not.

Practical Steps to Improve Your API Audit Trail

If you are building or improving an API audit trail for banking compliance, the priority order is:

First: establish a single gateway as the sole authentication point. Every API client - apps, TPPs, AI tools, internal services - authenticates at the gateway. Nothing bypasses it.

Second: implement structured request-level logging at the gateway. JSON format, UTC timestamps, client identifier, endpoint, method, status code, latency, request ID. Write to your SIEM or a dedicated audit store.

Third: add configuration change audit. Every change to the platform - rate limits, credentials, API product definitions, user access - should produce an audit record with who, what, and when.

Fourth: implement a dedicated audit role. Compliance teams should be able to query audit logs directly without engineering support. A read-only audit role with access to the audit log query interface solves this.

Fifth: define and enforce retention policies. Decide on retention periods for each log type, automate enforcement, and document the policy for regulators.

Sixth: test it. Before your next compliance review, give your compliance team a set of audit questions and ask them to answer the questions themselves using the audit tooling. If they cannot, you have a gap.

Zerq and Banking Compliance

Zerq is built specifically for regulated environments. It produces structured JSON audit logs for every API request and every configuration change, stores them in your MongoDB instance (fully in your environment), and includes a dedicated audit role so compliance teams can query logs without admin access.

For open banking specifically, Zerq supports per-TPP access control, OAuth 2.0 / OIDC with FAPI 1 Advanced, client certificate (mTLS) authentication, and workflow-based consent flows - all producing the same structured audit trail as every other request type.

See how Zerq handles banking and open banking, explore the security architecture, or request a demo to walk through your specific compliance requirements.