Customer support bots read complaints with names and order numbers. Call-centre pipelines send transcripts with card digits. Health apps send symptoms. All of it is useful to a model, and all of it is sensitive data the moment it leaves your servers.
OWASP lists sensitive information disclosure as LLM02 in its 2025 Top 10 for LLM applications. Most guidance focuses on what the model might reveal. This post focuses on the part you control: what you send, and what you keep.
What counts as sensitive data for an LLM API?
Sort fields into three buckets before you write a prompt:
| Bucket | Examples | Default rule |
|---|---|---|
| Direct identifiers | Name, email, phone, national ID, account number | Replace with placeholders |
| Special or regulated | Health, biometrics, religion, card numbers, credentials | Do not send unless the task requires it and you have a legal basis |
| Context | Product names, issue type, dates, amounts | Usually fine to send |
Under the GDPR, special categories (Article 9) need a specific condition before you process them at all. Card data and secrets such as passwords or API keys should never reach a prompt.
Step 1: which fields does the task actually need?
The best redaction is not sending the field. Ask what the task needs:
- Summarise a ticket? The model needs the complaint, not the customer’s address.
- Classify intent? It needs the message text, not the account ID.
- Draft a reply? It needs a first name at most, and a placeholder works.
Build prompts from selected fields, not by dumping the whole record as JSON. This also cuts input tokens, so it saves money.
Step 2: how do you redact so the model still understands the text?
Replace each value with a typed, numbered placeholder. The model keeps the structure of the sentence, and your code restores the values afterwards.
import os, re
from openai import OpenAI
PATTERNS = { # order matters: IBAN before PHONE, or the phone pattern eats IBAN digits
"EMAIL": r"[\w.+-]+@[\w-]+\.[\w.-]+",
"IBAN": r"\b[A-Z]{2}\d{2}[A-Z0-9]{11,30}\b",
"PHONE": r"\+?\d[\d\s-]{7,}\d",
}
def redact(text):
mapping, n = {}, {}
for kind, pat in PATTERNS.items():
def sub(m):
n[kind] = n.get(kind, 0) + 1
key = f"[{kind}_{n[kind]}]"
mapping[key] = m.group(0)
return key
text = re.sub(pat, sub, text)
return text, mapping
def restore(text, mapping):
for key, value in mapping.items():
text = text.replace(key, value)
return text
client = OpenAI(base_url="https://inference.broadnet.ai/v1", api_key=os.environ["BROADNET_API_KEY"])
# Any OpenAI-compatible endpoint works; this uses Qwen3.8 27B on BroadNet Inference.
ticket = "Call me on +971 50 123 4567 or mail sara@example.com about my refund."
safe, mapping = redact(ticket)
reply = client.chat.completions.create(
model="broadnet/qwen3.8-27b",
messages=[
{"role": "system", "content": "Keep placeholders like [PHONE_1] exactly as written."},
{"role": "user", "content": f"Draft a short reply to this ticket:\n{safe}"},
],
).choices[0].message.content
print(restore(reply, mapping)) # the mapping never left your server
Regular expressions catch structured values. Names and addresses need entity recognition. Open-source tools such as Microsoft Presidio combine patterns, checksums and named-entity models, and let you add your own recognisers. Test any detector on your own data: Arabic names, Gulf phone formats and mixed-script text are where generic detectors miss.
If you would rather run a proxy than write the redaction yourself, BroadNet publishes one as open source: the LLM Sensitive Data Firewall (LSDF), under Apache-2.0. It sits in front of any OpenAI-compatible endpoint, including models BroadNet does not host, and BroadNet says it inspects requests, responses, streamed chunks, streamed tool-call arguments, retrieved context and reasoning fields, with a separate sanitiser for traces and logs. In BroadNet’s May 2026 evaluation on its own corpora, its broad-PII detectors recalled 1.000 of a 40-case credential replay, 0.944 of synthetic clinical data and 0.685 of broad English PII, against 0.194, 0.056 and 0.326 for Microsoft Presidio alone (BroadNet’s write-up). Those are BroadNet’s numbers for its own tool; run its monitor profile on your traffic before you enforce anything.
Two rules for placeholders:
- Keep them consistent within a conversation, so
[NAME_1]is the same person in every turn. - Tell the model to keep them unchanged, as in the system prompt above.
Step 3: what happens to the data at the provider?
Redaction reduces what leaves. The provider decides what happens next. Ask:
- Is content stored after the request, and for how long?
- Is it used for training, and what is the default?
- Who runs the hardware, and where?
Providers answer very differently. See LLM API data retention compared for official wording from five of them, the ZDR checklist for the technical questions, and the GDPR checklist for the contract side.
Step 4: how do you keep prompts out of your own logs?
Your own stack is where prompts most often persist. Common leaks:
- HTTP client debug logging that prints request bodies.
- Tracing and observability SDKs that record full prompts by default.
- Error reporters that attach the failed request payload.
- Analytics events that include the user’s message.
- Retry queues and dead-letter queues that store whole requests.
Log this instead: request ID, model, prompt and completion token counts, latency, status code and your own redaction mapping ID (never the mapping itself). That is enough to debug cost and errors. The usage logging post has a wrapper that writes exactly these fields and computes cost per call.
Step 5: how do you protect the path to the API?
- Keep keys on servers, never in browser or mobile code. LLM API key security covers storage and rotation.
- Lock keys to your egress addresses with IP allow-lists.
- Use one API key per service, so you can revoke one without stopping everything.
Step 6: what should you check in the response?
Redaction protects the request. The response needs a check too, because a model can echo, guess or rebuild values:
- Placeholder integrity. After
restore(), look for leftover tokens such as[PHONE_3]that were never in your mapping. They mean the model invented one. - New PII in the output. Run the same detector on the response. A reply that contains an email address you never sent deserves a second look before it reaches a customer.
- Cross-user leakage. If you cache responses or share conversation state, make sure one user’s restored values can never appear in another user’s reply.
Check every output channel, not only the chat reply. BroadNet’s Safety Map study found sensitive values leaving through tool-call arguments in 20 of 73 runs that filled them, and through the reasoning field in 29 of 43 runs that filled it, while the visible reply was rated safe, missed or truncated.
Test the whole loop on a fixed set of 50 real, sensitive examples whenever you change the prompt, the model or the detector. Count missed values, not just caught ones: one missed card number matters more than a hundred correct placeholders.
Does sensitive audio need the same treatment?
A voice note can carry a name, a phone number and a health detail in ten seconds. Transcripts inherit all of it. Redact the transcript before it goes to an LLM for summarising, and keep raw audio only as long as you must. Our call-centre transcription pipeline shows redaction between the transcription and summary steps.
Where BroadNet Inference fits
BroadNet’s privacy statement says its gateway “keeps no prompts, messages, images, audio, responses or transcripts” and that it does not use inference data “to train, fine-tune or evaluate models”. It keeps content-free records such as timings, token counts and cost; the full list is on the zero data retention page. Keys can be limited to your IP addresses. Qwen3.8 27B, used in the example above, was tested in Arabic by BroadNet, which matters when your placeholders sit inside Arabic text.
That covers the provider’s side. It does not redact for you, and it does not clean your logs. Steps 1, 2 and 4 stay your job with any provider, including BroadNet. If you need a written DPA or a subprocessor list for regulated data, ask BroadNet before you send it; the statement says the subprocessor list is available on request.

