> For the complete documentation index, see [llms.txt](https://docs.mediafier.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mediafier.ai/trust/audit-observability-and-compliance.md).

# Audit, Observability & Compliance

Every response carries a trace ID; the audit trail is designed to record authenticated tool calls and is append-only by enforcement.

> **Every response carries a trace ID. The audit trail keys its records to it. The evidence chain is append-only.** Audit is not an afterthought bolted onto the gateway — it is part of the gateway's enforcement.

***

## The audit posture in one paragraph

Every tool call that crosses the gateway gets a trace ID at entry. The gateway threads it through identity, authorization, billing, and dispatch, and the audit trail is designed to hold a record of each authenticated tool call — allowed, refused, or failed — keyed by that trace ID. Errors carry the same trace ID, so support can pivot from a customer report to the call's history without asking the customer for anything beyond that one identifier. Audit records are append-only; the data layer enforces it.

***

## The trace ID is the join key

```
Request enters gateway
  ↓ X-Trace-Id stamped at entry
Gateway checks: identity · organization · authorization · rate limits · billing
  ↓
The tool's runtime executes (trace ID propagated)
  ↓
Response (X-Trace-Id in headers + error envelopes)
  ↓
Audit record · Billing ledger entries
   — all keyed by the same trace ID —
```

Wherever the call goes, the trace ID goes with it. That is what lets an audit record, a billing ledger entry, and a customer-visible error envelope be joined from a single piece of information.

***

## What's in an audit record

The audit trail is designed to hold one immutable row for each authenticated tool call — allowed, refused, or failed. A request refused before the caller is authenticated is not in an organization's audit trail; it still returns a trace ID you can quote to support. If the record for a successful call cannot be written, the call returns an `AUDIT_WRITE_FAILED` error even though the action may already have taken effect — check the outcome before retrying. The shape of an audit row:

| Field          | What it captures                                                            |
| -------------- | --------------------------------------------------------------------------- |
| Trace ID       | The same `X-Trace-Id` returned to the caller and propagated to the runtime. |
| Organization   | The server-derived tenant context.                                          |
| Principal      | The Auth0-resolved caller identity.                                         |
| Surface called | The qualified surface name (the tool the agent invoked).                    |
| Authorization  | Whether the call was allowed, or refused with a reason.                     |
| Cost           | Linked to the call's billing ledger entries through the trace ID.           |
| Outcome        | Success / failure with structured error category.                           |
| Timestamp      | When the call happened.                                                     |

What is **not** in an audit row: the agent's prompt text, the content of the request or the response, or any credential.

***

## Append-only by enforcement

Audit records are protected from ordinary update or deletion. New records are appended, and expired records are removed through a controlled retention process. The data layer enforces it directly — not by convention, and not by trusting application code to behave.

The same posture applies to other evidence artifacts on the platform:

* **Evidence Cards** that MediaClaws emit during a run are immutable — enforced at the platform's data layer, not by convention.
* **Provenance Passports** in the Media Library are append-only — new events are added; existing events are not edited.

Append-only is the platform's stance on every evidence surface, not a property of one specific log.

***

## Observability beyond audit

Audit answers "what happened, who did it, what did it cost?" That is not the only observability surface. The platform also exposes:

| Layer              | What it shows                                                                                       |
| ------------------ | --------------------------------------------------------------------------------------------------- |
| Per-call telemetry | Tracing, structured logs, error categories, usage analytics — emitted as the call runs.             |
| Per-org analytics  | Spend, surface usage, error rates, latency distribution — rolled up to the organization.            |
| Per-run timeline   | For MediaClaw runs: the plan, every step, every Evidence Card, every cost — readable end-to-end.    |
| Pippa control room | A web/mobile surface that aggregates across MCP servers, MediaClaws, and workflows for an operator. |

Organizations can search their own audit trail in the app and over MCP, and export activity records from the app. There is no streaming integration into a customer's own observability stack today.

***

## What customer-support correlation looks like

A customer reports a failed run. The audit chain works like this:

1. The customer hands support the trace ID — it appeared in the error envelope and in the response headers.
2. Support looks up the call's audit record by that trace ID, where one exists: principal, organization, surface, time, outcome.
3. Independently, support looks up billing ledger entries under the same trace ID: what was charged or refunded, and why.
4. If the call was part of a MediaClaw run, support reaches the run's record and its Evidence Cards; if it changed a Media Library asset, the asset's Provenance Passport.

That chain is keyed by one piece of information, and no step in it requires the customer to share a secret. Access to these records on Mediafier's side is limited to authorized platform operators.

***

## Compliance posture

The platform commits to:

* An audit trail designed to hold a record of each authenticated tool call, allowed or refused, keyed by the trace ID returned to the caller. A request refused before authentication still returns a trace ID, so a support investigation starts from one identifier either way.
* Append-only evidence enforced at the data layer.
* Server-derived tenant context on every authorization and audit decision.
* Trace correlation across audit, billing, and runtime so external evidence requests are reproducible.

What the platform does **not** commit to in launch documentation:

* A specific number for retention. Audit retention is set by the platform, not per organization. Where a customer's procurement or regulatory profile requires a specific retention term, raise it during procurement.
* A specific compliance certification badge. [Enterprise Readiness](https://docs.mediafier.ai/trust/enterprise-readiness.md) covers the procurement-facing posture; any certifications and audit reports are discussed under NDA during procurement, not in public documentation.

***

## Where to go next

| If you're…                                   | Read next                                                                                                    |
| -------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| Looking at identity and tenant boundaries    | [Identity & Authentication](https://docs.mediafier.ai/trust/identity-and-authentication.md)                  |
|                                              | [Multi-Tenant Organization Model](https://docs.mediafier.ai/trust/multi-tenant-organization-model.md)        |
| Studying the gateway's full chain            | [The Gateway](https://docs.mediafier.ai/platform/gateway.md)                                                 |
| Reviewing decision memory across runs        | [Decision Tracing & Learning Loop](https://docs.mediafier.ai/platform/decision-tracing-and-learning-loop.md) |
| Looking for enterprise procurement readiness | [Enterprise Readiness](https://docs.mediafier.ai/trust/enterprise-readiness.md)                              |
