Skip to main content
Auditors, compliance officers, and disputes teams use this layer to answer one question: “Why did this transaction get this decision?” What changes in your operation: evidence of a control goes from “let me pull logs from N systems and reconcile timestamps” to “here is the immutable record, cryptographically chained, showing that this transaction got this decision because this specific rule fired at this moment.” Trade-off: there is no “delete” or “edit” on audit records, by design. A TRUNCATE trigger at the database level blocks bulk deletion. Removing, re-ordering, or re-dating a record makes verification fail. If you need to remove a record for legal reasons (such as GDPR right-to-be-forgotten on PII), the answer is data minimization upfront, not retroactive editing.
Who is this guide for? Compliance officers and auditors checking what Tracer guarantees, disputes teams looking up validation history, and developers building reports against the audit endpoints. The retention section assumes zero API knowledge. The query and verify sections assume basic REST.
Tracer maintains an immutable of validation decisions. This guide explains how the audit system works and how to query validation history for compliance reporting.

Audit trail architecture


Tracer records decisions with full context for compliance and investigation: each POST /v1/validations call, each POST /v1/validations/rules-only call and each reserve of the Midaz ledger that holds capacity.

What gets recorded

The audit record of a validation contains:
Audit events are deduplicated for transaction validations. If you retry a validation request with the same requestId, Tracer stores only the first audit event. This ensures the audit trail reflects unique business events, not API retry patterns.

Immutability and hash chain

Audit records are write-once and cryptographically chained:
  • You cannot modify a record after creation.
  • A TRUNCATE trigger protects the audit table at the database level and blocks bulk deletion.
  • Each record stores a SHA-256 hash, and Tracer links the records into a hash chain. Removing, re-ordering, or re-dating a record makes the verification of the records linked with it fail.
You can verify the chain at any time using GET /v1/audit-events/{id}/verify, which returns:
The check covers the record you name and its links in the hash chain. When every hash it checks still matches, isValid is true and message confirms it. When a record no longer matches its stored hash, isValid is false. The message field reports tampering. A record that Tracer has not linked into the chain yet answers 409 with code 0566. Retry after a few seconds. On a failed check, firstInvalidId carries an internal sequence number for the diverging record. It is not an audit-event id, so it is not a value you can pass to GET /v1/audit-events/{id}.

Data retention


Retention periods


Querying validation history


Use the GET /v1/validations endpoint to query historical validations.

Basic query

Returns validations in cursor-paginated reverse chronological order.
A query with no dates covers the last 90 days, not the full retention period. Tracer applies that default window only when both start_date and end_date are absent. Send either one, or both, to query an older range. With only start_date, the range runs forward from that date with no end. With only end_date, the range runs backward from that date with no start.

Filtered query

Available filters

Dates use RFC3339, or yyyy-mm-dd or yyyy-mm-dd hh:mm:ss, read in UTC. A date-only end covers the whole day.

Pagination

Results use cursor-based pagination. The response includes nextCursor and hasMore fields to navigate through results.
Cursor pagination keeps sort_by and sort_order from the original query.

Sorting


Getting validation details


Retrieve complete details for a specific validation using GET /v1/validations/{id}. The response contains everything needed to understand a validation decision:
  • Request snapshot: The request data
  • Response snapshot: Full response including decision and reason
  • Evaluated rules: All rules that Tracer checked
  • Matched rules: Rules that triggered (if any)
  • Limit details: Usage information for checked limits
  • Ledger transaction: The transactionId of a reserve from the Midaz ledger, with its organizationId and ledgerId
  • Sources: For a reserve with more than one source account, the outcome of each source: account, amount, decision, matched rules and exceeded limits
  • Timestamps: When the validation occurred and processing time

Querying audit events


Beyond validation records, Tracer also exposes a generic audit event log via GET /v1/audit-events. This is the only way to see lifecycle changes for rules and limits: who created, updated, activated, deactivated, drafted, or deleted them.

Event types

Filters

GET /v1/audit-events accepts the same date-range and scope filters as GET /v1/validations, plus filters tailored to lifecycle events:

Use cases

  • Who activated this rule? GET /v1/audit-events?resource_type=rule&resource_id={ruleId}&action=ACTIVATE
  • All rule changes last week: GET /v1/audit-events?resource_type=rule&start_date=...&end_date=...
  • All limit deletions in 2026: GET /v1/audit-events?resource_type=limit&action=DELETE&start_date=2026-01-01T00:00:00Z

Single event detail

Use GET /v1/audit-events/{id} to retrieve a specific audit record, including the snapshot of state at the time of the event.

Compliance reporting scenarios


Common queries for audit and compliance reporting.

Scenario 1: Audit investigation

“Why was this transaction denied on January 15th?”
The response shows the exact request received, all rules evaluated, which rule or limit caused the denial, and the timestamp.

Scenario 2: Monthly compliance report

“Show all denied transactions for corporate accounts in January”

Scenario 3: Rule effectiveness analysis

“Which transactions were denied by a specific fraud rule?”

Scenario 4: Limit usage review

“Which transactions exceeded spending limits this month?”

Best practices for compliance


Recommendations for maintaining audit readiness.

Record keeping

  • Store validation IDs in your transaction records for easy cross-reference
  • Log the requestId you send to Tracer for correlation
  • Export regularly if you need records in external audit systems
Common pitfalls when reading the audit trail:
  • “I can see the validation but the rule that fired was already deleted.” Deleted rules are soft-deleted. The row stays in the database, but it doesn’t appear in GET /v1/rules. To investigate, query GET /v1/audit-events?resource_type=rule&resource_id={ruleId} for the lifecycle of that rule, including its activations and the eventual delete.
  • “Two retries of the same requestId only produced one audit event.” This is by design (deduplication via idx_audit_events_validation_dedup). The audit trail reflects unique business events, not API retry patterns. If your retry produced a different decision, that’s worth investigating. Tracer should return the original cached response.
  • “/verify says the chain is broken on a record I haven’t touched.” The check covers the record you name and the records linked with it, so a change to a linked record fails the check even when the record you named is intact. A valid answer covers only those records, so run /verify on each record you must attest.
  • “My audit query came back empty for last year.” A query with no start_date and no end_date covers the last 90 days. Supply the range you want.

Audit preparation

  • Test queries before audit season to ensure you can retrieve needed data
  • Verify date ranges work correctly with your timezone requirements

Investigation workflow

When investigating a specific transaction:
  1. Find the validation ID from your transaction logs or Tracer history. For a Midaz ledger transaction, use GET /v1/validations?transaction_id={transactionId}
  2. Retrieve full details using GET /v1/validations/
  3. Review the request snapshot to see the data in the request
  4. Check matched rules to understand the reason for the decision
  5. Verify limit status if limits apply. For a Midaz ledger transaction, GET /v1/validations/{id}/reservations lists the holds with their state

No-match behavior and audit


When a rules-only validation runs and no rule matches, Tracer returns a configured default decision instead of treating the empty match as an error. This is a per-request fallback, not an infrastructure resilience strategy. The DEFAULT_DECISION_WHEN_NO_MATCH environment variable governs the decision (default: ALLOW).
Set DEFAULT_DECISION_WHEN_NO_MATCH=DENY. The service logs a warning at startup if this remains at the default ALLOW.
Infrastructure failures (database down, cache stale, timeout) do not fall back to ALLOW. They surface as HTTP errors to the client, and the original transaction has no audit record. Operators should monitor tracer_audit_persist_failures_total and the /readyz endpoint to detect these cases.

Quick reference


Key endpoints and retention information.

Endpoints

Retention summary