What the gateway stores
The gateway has no retention setting of its own. Each record it produces lives in a platform store, and that store's rule applies.
| Record | What it holds | Where it lives | Governed by |
|---|---|---|---|
| Traces | One trace per request, with the model, the tokens, the cost and the request and response content, in the project the virtual key is scoped to. A successful /v1/chat/completions or /v1/messages request that returns no output, no completion tokens and no cost is dropped before export and stores no trace | Trace store | The data retention policy of the project, its team or the organization |
| Spend records | One spend event per request: cost, tokens, model, virtual key, end user | Spend store | A fixed 13 months. Exempt from the data retention policy. See Billing and spend events |
| Budget ledger | The debits each budget enforces against | Budget ledger | No expiry |
| Audit log | Who created, rotated, revoked or changed a virtual key, budget, provider, cache rule or guardrail | Postgres audit log | Not subject to the data retention policy. See Audit log |
| OCSF events | One OCSF row per trace that arrives through an ingestion source | OCSF event store | No expiry. See OCSF export |
Traces follow the data retention policy
Set the policy under Settings > Data Retention. A policy applies to an organization, a team or a project, and the most specific one wins. Periods are whole weeks. You can apply a new policy to data that is already stored.
Retention is scoped per organization, team, and project, never per ingestion source. Compliance notes that describe a per-source retention class map onto these scoped policies instead.
Trace retention and spend retention are independent. When a trace ages out before its spend record, the spend record still reconciles, and only the link from the record to the trace is gone.
Also check: Data retention for the plan limits, the presets and how deletion works.