Before AI

The OpenAI API sees every message and file you send

A practical guide to redact before openai api: what leaves the document, what to mask, and how to verify the result.

Redact Before OpenAI API: Keep Client Data Out of the Prompt

The OpenAI API sees every message and file you send. An API request can contain a system prompt, a conversation, a file, an image and tool output. The developer controls the request, so there is a place to mask before the model sees the text; the same request can also be logged by your own stack.

What leaves the document

Put a middleware between the application and the API. Mask the personal data, send stable tokens, receive the answer and restore the values on your side. Keep the mapping in your environment and out of the request. Use separate keys per application.

Where the data hides

The prompt is only one layer. Check:

The redaction flow

  1. Classify the fields and files in the request.
  2. Mask the personal data in the middleware.
  3. Send only the tokens and the task instructions.
  4. Restore the values on your side.
  5. Log the request id and the policy, not the payload.

Controls to verify

  • A middleware on every path, including retries.
  • A mapping store with restricted access.
  • Separate keys per app and environment.
  • Payload-free logging.
  • A test with a unique marker in each field.

Retention and evidence

The provider's retention is one copy; your logs, batch files and evaluation sets are others. Ask for the current retention and training terms, then check what your own stack writes to disk.

Limits

Masking is not anonymization. Context can still identify a person, and a tool result can reintroduce a value. The API cannot enforce your policy; the middleware and the reviewer do.

What the API sees

An API call is a disclosure with a receipt: every message, every file, every system instruction travels to the provider and lands in their logs under their retention terms. Consumer and enterprise tiers differ on retention and training use — the enterprise terms generally exclude training and shorten retention, but the current agreement is the only source that counts. Assume the conversation persists until the terms say otherwise, and read the terms when they change, because they do.

The masking habit

Mask before the call, not after the worry. Replace client names with role labels, account numbers with format-matching fakes, and dates with relative ones — the model reasons about the shape, not the identity. Keep a mapping table locally if the response must re-identify values; tools exist for exactly this round trip. The habit that fails is the reverse: paste the file, ask the model to anonymize, and trust the output — the model's idea of anonymized is not a standard.

The team question

Decide which accounts may hold client data and write it down: a team API key under enterprise terms for real work, personal accounts for experiments that never see a client value. The mixed-account period of an adoption is when leaks happen — someone pastes into the wrong surface. The approved-account list plus the masking habit covers most of the category's risk, and it costs a wiki page to maintain.

How Veilbrook fits

Veilbrook can sit in the request path, mask the document before it reaches the model and restore the values on your side. The exact integration depends on your application.

Questions for the vendor

Before you send

Classify the document, mask the identifiers, attach only what the task needs, and keep the mapping outside the tool. After the answer, restore the values on your side and check that the output did not reintroduce one. If the tool keeps the conversation, decide the retention before you start. A receipt is not a substitute for a review.

Common mistakes

Questions

Can we mask only the user message?

No. The system prompt, history, files and tool results can all carry data.

Does the API train on our data?

Ask for the current terms; a contract or a setting is stronger than a general page.

Where should the mapping live?

In your environment, with restricted access and a deletion rule.