Skip to content

Content capture

Last updated: 2026-11-26T02:16:00-03:00 (UTC-3)

Data inventory · Cryptography · Access control

By default the gateway keeps no prompt and no answer: logs, traces, request events and the request log carry metadata only. Some operators must keep what their users sent and received, for example for a regulatory audit. Content capture is that option. It stores the request and response bodies of a team’s inference requests in PostgreSQL, encrypted, for a bounded time. What each person reads of it follows the content permissions of their role, from the whole record at the top down to metadata only, and every read is recorded.

Turning this on changes your data profile. Captured prompts and answers can contain personal data, secrets and anything else your users type. The gateway then holds that data for the retention you choose, in your database and in its backups. Decide with whoever is accountable for privacy and audit: which teams, which side (request, response or both), for how long, and who may read it. Prefer short retentions and few readers.

  1. The operator turns on the flag content_capture and configures the content key.
  2. A team gets a capture policy (YAML or console). Without a policy nothing is captured, even with the flag on.
  3. For each chat, Messages, Responses or generateContent request of that team the policy selects, the gateway copies what the client sent and what the client received, bounded, and after the answer is complete writes one encrypted record.
  4. People read according to their role (who can read): an administrator reads the whole record, a team administrator the request after guardrail masking and the answer, a viewer the record’s metadata only. A global administrator can grant content:read to a named console user, for some teams or all of them, to give that user the whole record of those teams.
  5. A reader opens a request in Logs → Requests, clicks Show captured content, and the gateway records the read in the audit log before returning the content.
  6. Records are deleted when their retention ends, or earlier by hand.

Three optional parts, each behind its own flag and off by default, add to what a record keeps: captured images and audio, the model’s reasoning and, for teams that keep no content at all, the shape of the conversation on the span.

features:
console_users: true # required: every read is attributed to a named user
content_capture: true # default false (operator control)
storage:
content_encryption_key_env: GATEWAY_CONTENT_ENCRYPTION_KEY
content_encryption_previous_key_env: "" # only during a key rotation
content_capture:
policies:
- team: support
capture: both # request | response | both
sample_rate: 1 # (0, 1]
retention_days: 30 # 1 to 3650
max_bytes: 65536 # per side, 1024 to 1048576
keys: [] # optional: only these key IDs
models: [] # optional: only these model aliases

Generate the key once and keep it in your secret store, next to the database backup procedure:

Terminal window
openssl rand -hex 32

The gateway refuses to start (or a console change to the flag is refused) when content_capture is on and the key is missing or is not 32 bytes in hex, when console_users is off, or when there is no database. The key is read like every other secret: environment variable, <NAME>_FILE with secret_files, or a secret manager.

Setting Default Accepted Applied
features.content_capture false boolean; operator control Runtime (feature API or console)
storage.content_encryption_key_env GATEWAY_CONTENT_ENCRYPTION_KEY in the shipped YAML variable name; its value 64 hex characters At write and read time
storage.content_encryption_previous_key_env empty variable name, value 64 hex characters, different from the current key Reads only

The same fields apply in the YAML (content_capture.policies[]), the API and the console.

Field Default Bounds Meaning
content_capture.policies[].team required team ID; one policy per team The team whose keys are captured
content_capture.policies[].capture both request, response, both Which side is stored
content_capture.policies[].sample_rate 1 (also when null) greater than 0 and at most 1; 0 is refused Share of the team’s requests captured, drawn at random per request
content_capture.policies[].retention_days 30 1 to 3650 Days a record is kept; fixed when it is written
content_capture.policies[].max_bytes 65536 1024 to 1048576 Bytes kept per side; a longer body is cut and marked truncated
content_capture.policies[].keys empty (every key) up to 50 key IDs Only requests made with these keys
content_capture.policies[].models empty (every model) up to 50 aliases Only requests that named these aliases (the name the client sent)
content_capture.policies[].disabled false boolean Keeps the policy but captures nothing; use it to switch a YAML policy off from the console
content_capture.policies[].identifiers plain plain, hashed How the team’s organization, team and key IDs leave the gateway in provider request labels: as they are, or as keyed digests. It applies whenever the team has a policy, also a disabled one and with content_capture off; it captures nothing
content_capture.policies[].request_view follows purposes received, sent, both Which copies of the request a record keeps; applies with content_capture_evaluation (one policy for audit and evaluation)
content_capture.policies[].purposes [audit] audit, evaluation, app_spans, each at most once Who may use a record; applies with content_capture_evaluation
content_capture.policies[].operations all four chat, messages, responses, generate_content The operations the policy captures; applies with content_capture_evaluation
content_capture.policies[].media defaults below object The bounds of the team’s captured images and audio; applies with content_capture_media (captured images and audio)

A console policy replaces the team’s YAML entry until it is removed; removing it returns to the YAML entry or to no capture. A change applies at once on the replica that saved it and within 30 seconds on the others. Records already written keep their retention.

One policy for audit and evaluation (content_capture_evaluation)

Section titled “One policy for audit and evaluation (content_capture_evaluation)”

Audit and evaluation want different copies of the same request. An auditor needs what the user really submitted. A judge model, and the person reviewing its verdicts, must not see a secret that an input guardrail masked before the request went to the provider. With the flag content_capture_evaluation one team policy says which copies a record keeps and who may use them, and live evaluation reads the content store instead of keeping a second one.

Turn it on after content_capture works for you:

features:
content_capture: true
content_capture_evaluation: true # default false (operator control); requires content_capture
eval_capture: true # only if rules should judge the captured requests
content_capture:
policies:
- team: support
capture: both
purposes: [audit, evaluation] # default [audit]
request_view: both # default follows the purposes
operations: [chat, responses] # default: all four
evaluation: # optional limits of the evaluation purpose
sample_rate: 0.1 # evaluate a tenth of what is captured
retention_days: 14 # evaluation reads a record for 14 days
models: [] # default: every captured model
operations: [chat] # default: every captured operation
Field Default Values Meaning
request_view received for [audit], sent for [evaluation], both for the two received, sent, both received is the request exactly as the client sent it. sent is the request as the gateway holds it after its input stage: after a mandatory system prompt was added and the input guardrails masked it. both keeps the two, as two copies
purposes [audit] audit, evaluation, app_spans app_spans (T186.016): the message content of the team’s OTLP-ingested application spans is stored, normalized to role and content, readable under the same grants as audit; a policy with app_spans alone captures no inference request. audit: the record is kept for the people whose permissions cover it. evaluation: evaluators, review queues, session transcripts and dataset imports also read its sent view and its answer
operations all four chat, messages, responses, generate_content The operations the policy captures

Audit usually wants everything, for a long time. Evaluation usually wants a sample, for a short time. The evaluation block gives the evaluation purpose its own limits inside the same policy. Each one is optional, and none can be wider than the policy:

Field Default Bounds Meaning
content_capture.policies[].evaluation.sample_rate all captured requests greater than 0 and at most 1 Share of the captured requests that also carry the evaluation purpose. It is decided by the request ID, so the same request always decides the same way on every replica
content_capture.policies[].evaluation.retention_days the policy’s retention_days 1 to the policy’s retention_days Days judges and evaluation reviewers may read a record. After that the record stays for audit until it expires
content_capture.policies[].evaluation.models every captured model up to 50, each a model the policy captures Only these models are evaluated
content_capture.policies[].evaluation.operations every captured operation among the policy’s operations Only these operations are evaluated

A captured request the limits leave out is an audit record and nothing else: its purposes say audit, no rule is queued on it, no skipped result is written, and the evaluation screens do not list or open it. So a team can audit every request for a year while its evaluation reviewers read one request in ten, of one model, for two weeks. The limits need the evaluation purpose (400 otherwise).

Rules the gateway enforces:

  • Evaluation never reads the received view. A judge prompt, a review queue item, a session transcript and a dataset built from captures get the sent view and the answer, whatever else the record holds.
  • The evaluation purpose needs capture: both and request_view: sent or both. A judge reads the masked request and the answer; a policy that keeps neither is refused with 400 instead of producing rules that skip every request.
  • A request the input guardrails refused has no sent view: nothing was sent on. Its record keeps the received view (when the policy asks for it) and the refusal the client got, and it is not an evaluation record: its purposes say audit only, whatever the policy says.
  • The sent view has one shape whether or not a guardrail changed the request. It is the body the input stage let through, in the Chat Completions shape when the gateway translated a Messages, Responses or generateContent request before its guardrails ran (dialect: chat), so a judge reads the same structure for every request. Native generateContent requests are read by no input guardrail: their sent view is the received body, stored once (same_as_received: true) when the record keeps both.
  • A policy for evaluation alone stores only what a judge can read: served requests (status 200) with a sent view and an answer. Refused and failed requests of such a team leave no record. With the audit purpose every outcome is recorded, as before.
  • Streams and every captured operation are judged. A streamed answer is judged from the text the stream carried. A cache hit is captured as the client received it and judged like any other answer.
  • A record kept for audit alone is not a judge’s to read. When a rule matches such a request, its result is skipped with the reason content_not_captured, so the gap is visible instead of silent. A request or an answer longer than max_bytes is skipped with content_truncated: raise max_bytes (up to 1 MiB) for teams with long conversations.
  • With the flag off the three fields are stored but not applied, and never widen a policy. A policy that has the audit purpose, keeps the received view and covers all four operations captures the request as received, for audit, as it always did. Any other policy (evaluation alone, the sent view alone, some operations) captures nothing while the flag is off: turning the flag off never starts storing a copy or an operation the policy was written to leave out.

Each request span says what happened to its content, never the content itself: the attribute capture_state is not_captured, audit_only or evaluation, with capture_id naming the record (stored spans on both span engines, and gateway.capture.state / gateway.capture.id on the exported OTLP server span). Logs → Requests → Open trace shows it as Content.

The evaluation screens (a capture in Evals → Live, a review queue item, a session transcript, a dataset built from captures) show the sent view and the answer of a team’s records that carry the evaluation purpose. They need evals:manage for the team, as before, and they follow the same ladder as every other read: a reader needs content_sent:read of the record’s team, sees the model’s reasoning only with content_reasoning:read, and gets image and audio parts only with content_media:read; without them those parts are marked as withheld. The built-in team administrator holds all three. The evaluation screens never show the received view, whatever the reader holds: they show what a judge reads. Each such read is written to the audit log (content_capture.read, with what was shown in its target, for example view:sent+reasoning+media) before the content is decrypted; when the audit row cannot be written the read is refused. Add the evaluation purpose only for teams whose masked requests those people may read: unless you set limits, every record the policy captures, for its whole retention, becomes readable by them, not only the requests a rule samples. A judge’s own read is not audited row by row: the purpose on the policy is the authorization, and every judge call is a request in the request log.

Upgrade: the evaluation capture policies move here

Section titled “Upgrade: the evaluation capture policies move here”

Before this flag, live evaluation had its own capture policy per team (Evals → Live) and its own store. The first time the gateway runs with content_capture_evaluation on, it folds each of those policies into the team’s content capture policy, once, and reports it under Content capture → Moved from evaluation capture (and in migrated of GET /api/v1/admin/content-capture). No capture becomes broader than either policy allowed:

The team had Result Outcome
An evaluation policy and no active content policy A console policy for evaluation alone: capture: both, request_view: sent, purposes: [evaluation], operations: [chat] (the only operation the evaluation capture covered), the evaluation policy’s sampling, models and retention, max_bytes 524288; disabled if the evaluation policy was. A disabled console policy it replaces is kept in the report created
An evaluation policy and a content policy that captures both sides The content policy keeps its sampling, retention, max_bytes, keys and models, and gains purposes: [audit, evaluation] with request_view: both (a policy that kept only the sent view keeps only it). The evaluation purpose gets the evaluation policy’s own limits: its sampling, its models, its retention and operations: [chat]. No rule changes merged
A policy that could not be written (it would not validate) Nothing changes; the reason is in the report skipped
An evaluation policy and a content policy that captures one side, that does not capture chat or that shares no model with it, or a disabled evaluation policy beside a content policy Nothing changes; the team’s requests are no longer judged until an administrator adds the evaluation purpose kept_audit
Only a content policy, or no policy Nothing changes (not listed)

The fold is lossless for a team that had both policies. Audit goes on exactly as the audit policy said. Judges and evaluation reviewers read what the evaluation capture let them read and no more: the same share of requests (chosen by the request ID, as before, among the requests the audit policy captures), the same models, for the evaluation policy’s retention. Two things are new for those requests, and they are the point of this feature: a streamed answer and a cache hit are now judged too. To evaluate Messages, Responses or generateContent requests, or more of the traffic, widen the evaluation limits yourself; the console asks you to confirm.

A content policy that lives in the YAML cannot be edited by the gateway: the fold copies it into a console policy that adds the purpose. To keep the YAML as the source, add purposes and request_view to the YAML entry and remove the console policy.

The schema change is migration 206: five columns on gateway_content_captures with constant defaults and a table that remembers which teams were folded. It rewrites and scans nothing, so it is quick on a large table, and it is applied whether or not the flag is on.

After the fold:

  • PUT /api/v1/admin/evals/capture-policies/{team} answers 409 capture_policy_moved; GET /api/v1/admin/evals/capture-policies is a deprecated, read-only view of the content policies that carry the evaluation purpose.
  • Captures the evaluation capture wrote before stay where they are, encrypted under the providers key, and stay readable by rules, review queues and dataset imports until they expire (at most 90 days). They are not copied or re-encrypted. New captures are written only to the content store, under the content key.
  • Turn the flag on only when every replica runs a version that has it: a replica of an older version keeps writing to the evaluation capture store and accepts its policy API.
  • Turning the flag off again returns plain audit policies to their audit behaviour and live evaluation to its own capture. The folded policies stay as written (those for evaluation alone idle). A team is folded once: when the flag comes back, only evaluation policies created meanwhile are folded, and a change made to an already folded team through the old API while the flag was off is not carried over.
  • The first request, or the first read of the Content capture page, after the flag is on starts the fold. Requests do not wait for it: for the moment it takes, capture goes on under the policies as they were.
Route Operation
POST /v1/chat/completions chat
POST /v1/messages messages
POST /v1/responses responses (stateless and stored responses; not the Conversations and Containers routes)
POST /v1beta/models/{model}:generateContent and :streamGenerateContent generate_content
  • Request: the body exactly as the client sent it, before any input guardrail masks it. An audit record of a masked prompt would not show what the user submitted. If a team must not keep data that a masking guardrail removes, capture only response for it, or, with content_capture_evaluation, keep only the sent view.
  • Response: the body exactly as the client received it. For a stream, the record keeps the text the stream carried (the content deltas of Chat Completions, Messages, Responses and generateContent), joined at the end, with format: stream_text; the raw events and tool call arguments are not kept, and a stream with no text stores an empty text. Reasoning deltas are never part of that text: they are dropped, or kept as their own part with content_capture_reasoning.
  • Output guardrails (T107): an answer blocked at output is stored as the refusal the client got, never as the blocked text, and the record has output_blocked: true. A masked answer is stored masked.
  • Every outcome: a request refused after authentication (guardrail, budget, provider error) is captured with its status and the error the client got. A request refused before its body was read stores an empty request side.
  • Not captured: requests the gateway makes for itself (batch items, eval runs and judges, m7 ai, auto-routing classification, semantic fallbacks, moderation guardrail calls, vector store embeddings), Realtime sessions, embeddings, media and the other operations. Batch input files are kept by the Files API under its own lifecycle. Playground calls use a client key and are captured like any other request of its team.

The task of an agent run. With agent_recognition and agent_recognition.task_capture set to preview or full, the first 200 or 2,000 characters of the text a user typed to start a coding-agent run are kept with the run, for the teams whose policy here keeps requests (capture: request or both, not disabled), for the runs whose first call the policy covers: its key, model and operation when the policy lists keys, models or operations, and the policy’s sample_rate. It is content of the sent view: sealed with the content key like a record, bound to its run, expiring after the policy’s retention_days, read with content_sent:read and audited. It is stored in the run’s row of gateway_agent_runs, not as a capture record, so it is not in the captures list. With content_capture turned off, the text already kept is shown to nobody.

Each record has metadata in clear: ID, request ID, team, key ID, model, operation, HTTP status, which sides were captured, whether it was a stream, the original size of each side, truncation, output_blocked, the reference of the key that wrapped it, when it happened and when it expires; with content_capture_evaluation also request_view (received, sent, both, or none when the record keeps no copy of the request), purposes, and the size and truncation of the sent view. The content itself is only in the encrypted envelope.

Captured images and audio (content_capture_media)

Section titled “Captured images and audio (content_capture_media)”

A request with an image, or an answer with audio, is mostly base64. Without this flag the record keeps those bytes inside the body, up to max_bytes, so a multimodal request is usually cut and cannot be judged. With the flag content_capture_media the gateway moves each image and audio out of the body into a media store: the body keeps a short reference in its place, and the bytes become attachments of the record.

features:
content_capture: true
content_capture_media: true # default false (operator control); requires content_capture
content_capture:
policies:
- team: support
media:
max_items: 4 # attachments kept per record
max_item_bytes: 2097152 # one attachment, decoded
max_team_bytes: 1073741824 # everything the team's records keep at once
disabled: false # true: keep no media for this team
Field Default Bounds Meaning
features.content_capture_media false boolean; operator control; requires content_capture Turns the media store on for every team with a policy. Runtime (feature API or console)
content_capture.policies[].media.max_items 4 1 to 16 Attachments stored per record, request and answer together. Further ones are named in the record (type, size, hash) and not stored
content_capture.policies[].media.max_item_bytes 2097152 (2 MiB) 1024 to 10485760 Size of one attachment, decoded. A larger one is named by its type and size and not stored (nor decoded, so it has no hash); it is never cut, because half an image is no image
content_capture.policies[].media.max_team_bytes 1073741824 (1 GiB) 1048576 to 107374182400 Everything the team’s retained records keep in the store. When a new record would pass it, the record is written without media and names each attachment as not stored (team_limit), until older records expire
content_capture.policies[].media.disabled false boolean Keeps this team’s media out of the store with the flag on

The same fields are in the YAML, in PUT /api/v1/admin/content-capture/policies/{team} and in the policy form of the Content capture page (Captured images and audio). With the flag off they are stored and not applied.

How it behaves:

  • What is taken. At most 64 attachments per body are looked for, stored or not; anything after that stays in the body as it came. A media type must be a plain image/… or audio/… type (letters, digits, ., +, -); anything else stays in the body. Inline images and audio in the four captured dialects: data: URLs of image/* and audio/* (Chat Completions image_url, Responses input_image), input_audio data, Messages base64 image sources, generateContent inlineData, the audio of a Chat Completions answer and a generated image of a Responses answer. Images referenced by URL are not fetched: the URL stays in the body. Other files (a PDF, a video) stay in the body.
  • The record keeps a reference and a hash. In the stored body each attachment is replaced by gateway-media:<id>. The record’s media list says, for each one: id, source (request or response), kind (image or audio), content_type, bytes, sha256 of the bytes, stored, and reason when it was not stored (item_too_large, record_limit, team_limit, or store_failed when the attachments could not be written in time and the record was kept without them). The hash is inside the encrypted record, never in a clear column.
  • The record comes first. If writing the attachments fails, the record is written again without them, so an audit record is never lost to its media.
  • Media is never on a span, in a log line or in OTLP.
  • Request media is taken after the input guardrails. A request the guardrails refused keeps no media. The sent view, no longer swollen by base64, is then usually whole, so a multimodal request can be judged from its text. The received view stays the bytes as the client sent them, within max_bytes.
  • Answer media is taken from a buffered answer the gateway could read whole: up to max_bytes plus 8 MiB. A larger answer is cut as before and keeps no media. The audio or images of a streamed answer are not captured.
  • Encryption. Each attachment is sealed with AES-256-GCM under its record’s own data key, bound to its record, team, request, type and size, so it cannot be moved to another record or relabelled. A key rotation rewraps one key per record and the media follows; there is nothing more to rewrap.
  • Retention and isolation. An attachment lives exactly as long as its record: the retention purge, a deletion by hand and the end of the evaluation purpose apply to both. Every row carries the request ID, team, organization, key and principal of its request. A reader of another team or organization gets 404 for it, also when the attachment ID is known.
  • Judges. An evaluator with multimodal: true gets the record’s stored images back in place of their references (up to five, as before). Any other judge reads the text and the references.
  • Datasets. An item built from a capture keeps text and tool traffic only: each image or audio becomes a text part [media not imported], so the item never points at an attachment that will expire.

Read an attachment with:

POST /api/v1/admin/content-captures/{id}/media/{media_id}
X-CSRF-Token: ...

It needs content_media:read of the record’s team (who can read) and answers the bytes with their stored Content-Type (application/octet-stream for anything that is not a plain image or audio type), Content-Disposition: attachment, X-Content-Type-Options: nosniff, Cache-Control: no-store and X-Gateway-Media-Kind. Like a reveal, it is a POST with the CSRF token and writes its audit row (content_capture.media.read) in the transaction that reads the attachment. It answers 404 with the flag off, for an unknown attachment and for one outside the reader’s teams, and 403 without the permission.

GET /api/v1/admin/content-capture adds media and reasoning (the two flags), media_usage (attachments and bytes stored per team) and media_limits (the bounds above). The schema change is migration 208: four counters on gateway_content_captures (media_count, media_bytes, reasoning_bytes, reasoning_truncated), the table gateway_content_media and one column on the evaluators. It rewrites nothing and is applied whether or not the flags are on.

The model’s reasoning (content_capture_reasoning)

Section titled “The model’s reasoning (content_capture_reasoning)”

Models that reason before answering return that reasoning beside the answer. With the flag content_capture_reasoning a record keeps it as its own part, apart from the answer, for streamed and buffered answers alike:

Client API Buffered answer Streamed answer
Chat Completions message.reasoning_content (or reasoning) delta.reasoning_content (or delta.reasoning)
Messages thinking blocks thinking_delta
Responses reasoning items (summary and reasoning text) response.reasoning_summary_text.delta, response.reasoning_text.delta
generateContent parts marked thought parts marked thought

Every provider the gateway translates reaches the client in one of these four shapes, so the same capture covers them all.

features:
content_capture: true
content_capture_reasoning: true # default false (operator control); requires content_capture
Setting Default Accepted Applied
features.content_capture_reasoning false boolean; operator control; requires content_capture Runtime (feature API or console)
  • The part is bounded by the policy’s max_bytes, like each side, and marked truncated when cut. It is stored only for policies that capture the response, and not for an answer an output guardrail blocked.
  • Only readers with content_reasoning:read get it (who can read): reasoning in a reveal and in the evaluation screens. A reader without it gets the answer as text and, in a conversation, a mark where reasoning was. This holds for records written before the flag too: a buffered answer’s raw body, which may hold reasoning, is shown only to readers who hold the reasoning permission.
  • Judges do not read reasoning unless their evaluator asks. An evaluator has include_reasoning, false by default (Evals → Evaluators → Include the model’s reasoning, or the field in POST /api/v1/admin/evals/evaluators). When it is true, a live rule’s judge gets the reasoning after its prompt, labelled as not part of the answer. Without it the judge also reads the conversation without the reasoning of earlier turns (thinking blocks, reasoning items, thought parts a client sent back). Code evaluators take no reasoning.
  • Datasets never keep reasoning: an item built from a capture is the conversation and the answer as text.
  • A reasoning part cut at max_bytes is shown to readers as truncated and is not given to a judge.
  • Reasoning the provider returns encrypted or as a signature is not text and is not captured.

Structural items on the span (span_structural_items)

Section titled “Structural items on the span (span_structural_items)”

A team that captures no content can still record the shape of each conversation, without a word of it. With the flag span_structural_items the request span gets one bounded structure attribute, and the exported OTLP server span the same as gateway.structure.* attributes:

Item Stored span (structure) OTLP attribute
Number of messages messages gateway.structure.messages
Roles, in order roles: one letter per message (s system, d developer, u user, a assistant, t tool, o other), at most 32, then + gateway.structure.roles
Messages per role role_counts gateway.structure.role.<role>
Tools declared tools_declared, tool_names (at most 16 names, sorted) gateway.structure.tools_declared, gateway.structure.tool_names (comma separated)
Tool calls in the conversation tool_calls, tool_call_names (at most 16) gateway.structure.tool_calls, gateway.structure.tool_call_names
Attachments by type attachments: image, audio, file, video gateway.structure.attachments.<type>
File parts that name a slice or a resolution (file inputs) file_slices gateway.structure.file_slices
Token split tokens: input, output, cached_input, reasoning, cache_write, as far as the provider reported them gateway.structure.tokens.<name>
features:
span_structural_items: true # default false (operator control)
Setting Default Accepted Applied
features.span_structural_items false boolean; operator control Runtime (feature API or console)
  • Tool names leave the gateway with the span. They are names your application chose; with otlp_traces they are exported to your OpenTelemetry receiver like the rest of the span. Leave the flag off if tool names are confidential.
  • No content. A tool name is recorded only when it is a short identifier (letters, digits, _ - . : /, at most 64 bytes); any other name is counted and not recorded. Role values outside the known ones are counted as other. Nothing else of a message is read.
  • Bounded. The attribute stays under 4 KiB whatever the conversation. None of it becomes a metric label.
  • Where it is read. It needs a reader: the span store (span_store, on either span engine) or the OTLP trace export (otlp_traces). In the console, Logs → Requests → Open trace shows Conversation, Tools declared, Tool calls in the conversation, Attachments and Token split on the request span.
  • Who sees it. Readers with content_structure:read of the span’s team, the lowest rung of the ladder. For anyone else the attribute is left out of the span.
  • It does not need content_capture, and it records the request as the input guardrails let it through; a request refused before them has no structure.
  • Tool calls counted are the ones in the conversation the client sent (earlier turns). The calls of the answer being produced are not read, since nothing of the answer is kept: they appear on the next turn’s span.

Each record has its own random 256-bit data key. The content is sealed with AES-256-GCM under that data key, and the data key is sealed with AES-256-GCM under the content key (envelope encryption). Both seals are bound to the record by associated data that covers its ID, request ID, team, key, model, operation, status, sides, sizes, truncation, output_blocked, time and expiry (the wrapped data key also binds the key reference; a record written with content_capture_evaluation also binds its request view, its purposes, the size of its sent view and the end of its evaluation purpose, so nobody can add the evaluation purpose to a stored audit record): moving a ciphertext to another row, or changing any of that metadata in the database, makes decryption fail instead of returning the content under a false label. The record stores only a 16-character reference of the key (an HMAC of a fixed label under the key), never the key. Details in cryptography.

Why a key of its own, and not the providers key: the content key can be rotated or destroyed on its own. Destroying it makes every capture unreadable at once (a cryptographic erase), without touching provider secrets.

There are two ways: rewrap the stored records under the new key with gateway content-rewrap, or let the old records expire.

content_key_rotation is a boot operator flag, false by default. It needs storage.content_encryption_key_env and a database, even when content_capture itself is off. A rewrap changes only the record’s key reference and its 60-byte wrapped data key. The content ciphertext, the metadata and the expiry are never rewritten, so the command is fast and can run while the replicas keep serving.

  1. Take and verify a PostgreSQL backup, and keep the old key with it (backup and recovery). A backup without the key that wrapped its records cannot be read.
  2. Generate the new key (openssl rand -hex 32). First rollout: keep the old key as the current key, add the new one as content_encryption_previous_key_env and set content_key_rotation: true. Every replica can now read both keys and still writes with the old one.
  3. Second rollout: swap the two references, so the new key is current and the old one is previous. A replica still on the first step writes with the old key, but every replica reads both, so no record becomes unreadable during the rollout.
  4. Run gateway content-rewrap --check (read-only, exit 3 while records need a rewrap), then gateway content-rewrap --apply beside the serving replicas, with the same key configuration as them. Each batch of storage.reencrypt.page_size records commits on its own, with one content_key.rewrap audit row. An interrupted, cancelled or timed-out run keeps the batches it committed, and running it again resumes. The rewrap never waits on a record that a reveal, a deletion or another run holds: it skips it, and the next run picks it up. Run it again until it exits 0: skipped records and records that a replica on the first step wrote during the run are found by the next run. The same pass rewraps the task texts of agent runs, which the content key wraps too: they are counted with the records in every figure of the command and of key.rotation, and an unexpired task text blocks the retirement of its key in step 6 like an unexpired record.
  5. Check Content capture in the console, or key.rotation in GET /api/v1/admin/content-capture: current_records, previous_records and unknown_records are live counts (expired records awaiting the purge included), and complete is true when every record uses the current key.
  6. Remove content_encryption_previous_key_env and roll out. With the flag on, a replica refuses to start (content key check failed: content key retirement refused) while any unexpired record names a key that is not configured. Expired records are never revealed and do not block the start; the purge removes them. Restore the key instead of working around the refusal. If the check itself cannot run, the error says content key usage could not be checked instead.
  7. Keep the old key as long as a backup taken before step 6 might be restored.

The target key comes from the command’s own environment. --apply refuses (current_key_unused) when stored records exist but none uses its current key yet, because nothing then shows that the serving replicas hold that key: moving every record to a key they lack would make all of them unreadable. Usually a replica on step 3 has already written a record with the new key. When capture is quiet, or for a rollback, confirm the replicas run that key and pass --apply --unused-current-key.

Rollback. Until the old key is retired, swap the two references back and run --apply --unused-current-key again: the records are rewrapped to the old key in the same way.

Startup only. The retirement check runs when a replica starts. Serving replicas resolve the content keys again on each capture and reveal, so a key removed from a secret file or a secret manager without a restart is not refused: reveals of its records answer 503 encryption_unavailable until it is restored. Change content keys only through a rollout.

Exit Meaning
0 No record left on another key
3 A check found records to rewrap, or an apply finished while records written meanwhile with the previous key remain: run it again
1 Invalid configuration, flag off, no current key, an unused current key without acknowledgement, database or schema unavailable, cancellation or timeout, an uncertain commit, or records left untouched
2 Invalid syntax: only --check, --apply and --apply --unused-current-key are accepted

Each run logs one content_rewrap_checked or content_rewrap_applied line with counts (scanned, pending, rewrapped, already_current, unknown_key, unreadable, vanished, batches, remaining), or content_rewrap_failed with a finite reason. It never logs a key, a ciphertext or content. commit_outcome_unknown means the connection ended during a batch commit, which may have succeeded: run a check before anything else. The command reads storage.reencrypt.page_size and storage.reencrypt.timeout, and never applies a schema migration: run gateway migrate first (migration 146 adds the key-reference index).

Failing closed. Before writing, the command authenticates every wrapped data key with the key its record names. A wrong previous key has another reference: the records are counted as unknown_key and left untouched, and the boot is refused. A key that claims the right reference but is not that key, or a record altered in the database, is counted as unreadable and left exactly as it was. Nothing is deleted to make a run look complete. Each update is a compare-and-swap on the old reference and wrapped key, on a locked record, so a reveal, a deletion or a second run at the same time never sees a mixed record.

Recovery. Restore the backup with the keys it needs, both of them for a backup taken during a rotation, and run --check and --apply again: a backup taken mid-rotation resumes like an interrupted run. Starting a restored database with only the new key is refused and changes nothing.

  1. Generate a new key. Set it as the current key and the old one as content_encryption_previous_key_env, and roll out. New records use the new key; old records stay readable.
  2. Wait for the longest retention_days of your policies. Every record written with the old key has then expired and been purged.
  3. Remove content_encryption_previous_key_env and destroy the old key.

Because the expiry is bound to the ciphertext, a record’s retention cannot be changed in place. A record whose key is no longer configured answers 503 encryption_unavailable when revealed.

What a person reads of captured content follows the permissions of their role. There are five content permissions, and they form a ladder: the top role holds all of them and each role below holds fewer.

Permission What it lets a person read
content_structure:read The metadata of a record (the list) and the structural items of a span. No content
content_sent:read The sent view (the request after the input guardrails) and the answer, as text
content_reasoning:read The model’s reasoning
content_media:read Captured images and audio
content_received:read The received view: the request exactly as the client sent it, before any guardrail masked it

Which built-in role holds which:

Role Reads Of which teams Structure Sent view Reasoning Media Received view
admin Everything Every team yes yes yes yes yes
org_admin Everything The teams of its organization yes yes yes yes yes
team_admin The sent view, reasoning and media The teams it administers yes yes yes yes no
team_viewer Metadata only Its teams yes no no no no
user Metadata only Its teams yes no no no no
operator Metadata only Every team yes no no no no
viewer Metadata only Every team yes no no no no

The rules behind the table:

  • A reader of text is shown only what is known to be text. Without the reasoning or the media permission, a conversation is narrowed to text parts, tool calls and tool results; any other part or field, including one a provider adds later, is replaced by a mark ({"type": "withheld", "kind": "media" | "reasoning" | "other"}) or left out.
  • One rule for every screen. The reveal in the request details, the media read, the evaluation screens, the review queue, a session transcript, a dataset built from captures, a judge’s reasoning on an evaluation result and the structural items of a span all ask the same function what the session’s permissions cover of the record’s team.
  • Organizations are never crossed. A role scoped to teams reads only its own teams; an organization admin reads only the teams of its organization. A record of another team or organization answers 404, like a record that does not exist. admin, operator and viewer are the gateway’s own roles and read every team.
  • With membership_roles, a team a team administrator only belongs to (association member) gives the member’s share: metadata.
  • The operator reads no content. It changes routing and provider credentials and reads no request log, so of captured content it holds metadata only. An operator who must read content needs a role that does, or a content:read grant.
  • An evaluator is, in the built-in roles, the team administrator: it is the role that holds evals:manage. To give someone the review screens with less, bind a custom role ceiling on team_admin that withholds what they should not read.
  • A custom role ceiling can withhold any of the five and never adds one. The catalog offers each content permission only to the base roles that hold it: content_structure:read to all five bases; content_sent:read, content_reasoning:read and content_media:read to team_admin alone; content_received:read to none. A ceiling that allows only content_structure:read reads metadata; one that keeps content_sent:read without the other two reads the conversation and the answer as text. A ceiling that lists none of them reads nothing, so add content_structure:read to existing ceilings whose users should keep seeing the capture state details.
  • The received view names a person. A session opened with the shared admin token is audited as that token, which names nobody: it reads what the administrator reads except the received view. The shared viewer token reads metadata.

Below the administrator, the received view is not part of any role. A global administrator can give it to one named person for some teams:

Permission Who has it What it allows
content_capture:manage the global admin role Policies, reader grants, deletion
content:read nobody by role; a named console user with an explicit grant All five content permissions, so the whole record, for the teams of the grant
  • A grant is given by a named global administrator to another console user: the shared admin and viewer tokens cannot grant, and an administrator cannot grant themselves. The grantor and the reader both appear in the audit log. Review content_capture.reader.grant and user.create rows together: whoever holds users:manage can create console users and sign in as them, so the audit log, not the grant rule, is what shows a misuse.
  • A grant covers a list of teams or all teams. For a role scoped to teams it applies only to teams the user already belongs to, so it never takes anyone outside their teams or organization. For viewer and operator it applies to the teams it names.
  • A grant does not raise a custom role ceiling: a ceiling is a restriction.
  • A disabled console user loses access at once; the grant is kept and applies again if the user is enabled again. Revoke the grant when someone no longer needs it.

GET /api/v1/admin/content-access tells any session what it reads: the ladder above (ladder), and for the session its level and permissions for every team (all_teams, for a gateway-wide role) and per team (teams). It grants nothing.

Upgrade: reading no longer needs a grant at the top

Section titled “Upgrade: reading no longer needs a grant at the top”

Before this version no role read captured content: everyone needed a content:read grant. Now the roles hold content permissions, so on upgrade:

  • A named administrator and an organization admin read the whole record of their teams without a grant. If your process relied on administrators not reading content, review who holds those roles before upgrading.
  • A team administrator reads the sent view and the answer of the teams it administers, with reasoning and media.
  • An operator lists the metadata of captured records and reads no content, as before.
  • Every role that reads the request log lists the metadata of captured records, where the list answered 403 without a grant.
  • Existing grants keep their meaning: the whole record of their teams. A grant held by a user of a team role for a team they do not belong to no longer applies.
  • This applies to records already stored, not only to new ones: content captured while reading needed a grant becomes readable by these roles on upgrade. Delete or shorten what should not be, before upgrading.
  • Nothing changes for records, policies or keys. Every read is still audited, now with what was shown.

Open Logs → Requests and select a request. The request details show the captured records of that request (what was kept, how many media attachments, whether reasoning was kept apart). When your permissions cover more than metadata there is a Show captured content button. Nothing is fetched until you click: the click is the audited read, and the content then appears with This read was recorded in the audit log. You were shown … and, when the record holds more than you may read, Not shown with your permissions: …. A reader of text gets the conversation and the answer as text, with a mark where media or reasoning was. With metadata only there is no button, and without content_structure:read the console never asks for captures.

The Content capture page (Settings) is for the global administrator: the key status, the policies with their source (YAML or console), Who reads what (the table above, as the server computes it), the reader grants and the deletion form. With content_capture_evaluation the policy form also has Purposes, Request view and Operations, and the page lists the evaluation capture policies it moved.

Saving a policy that captures more than the team’s current one asks for a second click. The console names what widens (a team that starts being captured, another side or view of the request, the evaluation purpose, another operation, a higher sample rate, a longer retention, a larger max_bytes, or a key or model filter removed) and saves only after Confirm and save. A narrower policy is saved at once. Every save is a content_capture.policy.set row in the audit log either way.

All under /api/v1/admin, with the console session cookie; writes need X-CSRF-Token.

Method and path Permission What it does
GET /content-capture content_capture:manage Policies (effective, with source and the YAML entry they replace), grants, key status (configured, current_ref, previous_ref) and bounds
PUT /content-capture/policies/{team} content_capture:manage Store the console policy of a team (body: the policy fields)
DELETE /content-capture/policies/{team} content_capture:manage Remove the console policy
PUT /content-capture/readers/{user} content_capture:manage, named session, not oneself {"teams": ["support"]} or {"all_teams": true}
DELETE /content-capture/readers/{user} content_capture:manage Revoke a grant
GET /content-captures?request_id=&team=&limit= content_structure:read Metadata of the visible records, newest first, 1 to 200 (default 50), and levels: for each record ID, what a reveal would show this session (received, sent, text or structure)
POST /content-captures/{id}/reveal a content permission beyond structure, or a grant The content the session’s permissions cover, audited; 403 with structure alone
POST /content-captures/{id}/media/{media_id} content_media:read One attachment, audited (captured images and audio)
GET /content-access any console session The ladder, and what this session reads per team
DELETE /content-captures/{id} content_capture:manage Delete one record
POST /content-captures/delete content_capture:manage {"team": "...", "request_id": "...", "before": "RFC 3339"}; team required

A reveal answers, with Cache-Control: no-store:

{
"capture": {"id": "cc_5f0c...", "request_id": "req-42", "team_id": "support", "operation": "chat", "status": 200, "captured": "both", "stream": false, "request_truncated": false, "response_truncated": false, "output_blocked": false, "occurred_at": "2026-11-08T13:37:30Z", "expires_at": "2026-12-08T13:37:32Z"},
"request": {"content_type": "application/json", "format": "body", "encoding": "utf8", "body": "{\"model\":\"chat-default\",\"messages\":[...]}", "truncated": false},
"response": {"content_type": "application/json", "format": "body", "encoding": "utf8", "body": "{\"id\":\"chatcmpl-...\",\"choices\":[...]}", "truncated": false}
}

A side the policy did not capture is absent. encoding is base64 when the bytes are not valid UTF-8.

With content_capture_evaluation, request is the received view and a third member, request_sent, is the sent view. It has the same fields plus dialect (chat, messages, responses or generate_content: the API shape of the body, which is chat when the gateway translated the request before the guardrails ran). For a native generateContent request in a record that keeps both views it is same_as_received: true with an empty body:

{
"capture": {"id": "cc_5f0c...", "request_view": "both", "purposes": ["audit", "evaluation"], "sent_bytes": 118, "sent_truncated": false},
"request": {"format": "body", "encoding": "utf8", "body": "{\"messages\":[{\"role\":\"user\",\"content\":\"Reply to ana@example.com\"}]}", "truncated": false},
"request_sent": {"format": "body", "encoding": "utf8", "dialect": "chat", "body": "{\"messages\":[{\"role\":\"user\",\"content\":\"Reply to [EMAIL]\"}]}", "truncated": false},
"response": {"format": "body", "encoding": "utf8", "body": "{\"choices\":[...]}", "truncated": false}
}

What a reveal answers depends on the reader. level names it and withheld lists what the record holds that this reader was not shown:

level Reader holds Members
received content_received:read (and the rest) request, request_sent, response, reasoning, media
sent sent view, reasoning and media request_sent (with its body, also when it is the same as the received one), response, reasoning, media; withheld: ["received"]
text the sent view, with one or none of reasoning and media input (the conversation as a list of messages, with {"type": "withheld", "kind": "media"} or "reasoning" in place of the parts not shown), output (the answer’s text), output_truncated, plus reasoning or media for the one permission held
{
"capture": {"id": "cc_5f0c...", "request_view": "both", "media_count": 1, "reasoning_bytes": 212},
"level": "text",
"withheld": ["received", "reasoning", "media"],
"input": [{"role": "user", "content": [{"type": "text", "text": "What is in this picture, [EMAIL]?"}, {"type": "withheld", "kind": "media"}]}],
"output": "A red square.",
"output_truncated": false
}

reasoning has the fields of a side (format: text). Each entry of media is a reference: {"id": "cm_...", "source": "request", "kind": "image", "content_type": "image/png", "bytes": 48213, "sha256": "...", "stored": true}.

Every action is a row of the control audit (the Admin audit tab and GET /api/v1/admin/audit), never with content:

Action Target Actor
content_capture.read capture:<id> request:<request_id> team:<team> view:<what was shown>, for example view:received+sent+reasoning+media for an administrator, view:sent+reasoning+media for a team administrator and view:sent for a reader of text; the same through a reveal and through an evaluation screen The reader
content_capture.media.read capture:<id> media:<media_id> request:<request_id> team:<team> view:media The reader
agent_run_task.read run:<run_id> team:<team> view:sent: the task text of an agent run, one row per run shown The reader
evaluation.reasoning.read team:<team> view:sent; the number of results whose judge explanation was shown is in version The reader
content_capture.policy.fold <team> <outcome> (the fold of an evaluation capture policy) upgrade
content_capture.reader.grant / .revoke The user ID The administrator
content_capture.policy.set / .delete The team The administrator
content_capture.delete capture:<id>, or team:<team> with the request and time filters; the count is in version The administrator
content_capture.purge expired; the count is in version retention

The read is written in the same transaction that reads the record and is committed before anything is decrypted: no content leaves without its audit row. A read that then fails to decrypt is still recorded.

  • A record expires retention_days after it is written. From then on it is invisible to every read, and a purge, at startup and then every minute on every replica, deletes expired records in batches of 1,000 (up to 200,000 per minute). It runs whether the flag is on or off, and also during the emergency stop.
  • Deletion by hand works with the flag off too, so turning capture off never prevents erasing what was stored.
  • The task text of an agent run expires with the retention_days of the policy that allowed it and is removed within a minute of that. Deleting a team’s captures (POST /api/v1/admin/content-captures/delete with the team, also with before) removes the task text of that team’s runs too, those that began before before when it is sent; a deletion narrowed to one request, or of one capture, does not. An end-user deletion removes it for the runs whose first request it erases. The run and the keyed hash of its task stay.
  • Shortening a policy’s retention does not shorten records already written; delete them by team and time if needed.
  • Deleting a team does not delete its records; they expire with their retention, or delete them by team.
  • Backups of the database keep records until those backups expire. Destroying the content key makes every copy unreadable.
  • Personal data. This is the only place where the gateway keeps prompts and answers on purpose. Update your records of processing and inform your users as your law requires. The capture never appears in the request log, logs, traces, request events or exports; only the reveal endpoint returns it.
  • Everyone with the database and the key can decrypt. Keep the key out of the database host and its backups.
  • Write latency. The record is written after the client has the complete answer, on the request’s own goroutine, bounded to 3 seconds; a failure is logged (content_capture_failed, without content) and the request is not affected. A failed write loses that record.
  • Memory. A captured request holds up to max_bytes per side; before its key is known, up to 1 MiB of request body.
  • Model filter. models compares the name the client sent; a model alias of a listed model is not covered unless listed too.
  • Key wrap volume. Each record seals a data key under the content key with a random 96-bit nonce. Rotate the content key well before 4 billion records (at 100 records per second, about a year).
  • Consistency across replicas. A policy change reaches other replicas within 30 seconds.
  • The sent view is the request after the gateway’s input stage, not the exact bytes on the provider’s wire. It includes a mandatory system prompt, which is added before the guardrails; a context overflow summary and the translation to the provider’s own protocol happen after it and are not part of it. A record that keeps both views holds two copies of the request: keep only sent when an audit of the masked request is enough.
  • Evaluation needs text or tool calls. An answer of tool calls only (not streamed) is judged as one tool call: name(arguments) line per call; the tools the request offered are {{tools}} (evaluators). A streamed answer with no text, or an output a guardrail blocked, is not judged; reasoning is read only for an evaluator with include_reasoning.
  • Media limits. Only inline images and audio are stored; images by URL are not fetched, and other file types stay in the body. Media of streamed answers, and of buffered answers larger than max_bytes plus 8 MiB, is not captured. A native generateContent request keeps its media inline in the received view as well (within max_bytes), because no input stage rewrites it. While a team’s media is captured, a request holds its decoded attachments in memory until the record is written (at most max_items × max_item_bytes), and a buffered answer up to max_bytes plus 8 MiB.
  • Streamed generateContent answers captured by an earlier version may hold thought text inside the answer’s text; this version keeps the two apart for new records only.
  • The media bound of a team is checked when a record is written. Records that expire free their room at the next purge, within a minute.
  • A shared token reads without a name. Its reads are audited as bootstrap_admin. Turn admin.token_login off, or keep the shared token for recovery only, when every read must name a person.
  • Rules are queued on captured requests only. A request the policy’s sampling left out, or of a team with no capture policy, is neither judged nor reported as skipped. In Evals → Live, the rule form warns when the chosen team is not captured for evaluation, or when the team’s capture policy keeps fewer models than the rule reads.

Every route below needs a console session or an admin Bearer token, the role’s permission and, for writes, the X-CSRF-Token header; the full contract is in the API reference.

Route What it does
PUT /api/v1/admin/content-capture/policies/{team} Stores a team’s console capture policy, replacing its YAML entry
DELETE /api/v1/admin/content-capture/policies/{team} Removes the console policy, so the YAML entry applies again
PUT /api/v1/admin/content-capture/readers/{user} Grants content:read to a console user, for every team or for up to 200 listed teams
DELETE /api/v1/admin/content-capture/readers/{user} Revokes that grant at once
GET /api/v1/admin/content-captures Lists the metadata of the captures the caller may see, never their content
POST /api/v1/admin/content-captures/{id}/reveal Decrypts what the reader’s permissions cover of one capture, and audits the read
POST /api/v1/admin/content-captures/{id}/media/{media} Answers one captured image or audio to a reader with content_media:read, and audits the read
GET /api/v1/admin/content-access The content ladder, and what the session reads per team
DELETE /api/v1/admin/content-captures/{id} Deletes one capture and audits the deletion; it works with the flag off

m7gtwcontact@m7gtw.com