---
title: "Sensitive data and LLM APIs - redaction and minimisation"
description: "How to send customer, health or financial data to an LLM API safely: classify fields, redact with reversible placeholders, use zero retention, keep logs clean."
url: https://broadrouter.com/blog/llm-api-sensitive-data/
lang: en
updated: 2026-11-14
publisher: BroadRouter (a BroadNet site); API by BroadNet Inference, https://inference.broadnet.ai
---

# Sending sensitive data to an LLM API: redact, minimise, log less

By the BroadNet Inference team · 5 min read · Published 2026-11-14 · Updated 2026-11-15

To send sensitive data to an LLM API, first decide which fields the task needs and drop the rest. Replace names, numbers and IDs with reversible placeholders before the request, and restore them in your own code after. Use a provider with zero data retention, keep prompt content out of your own logs, and lock API keys to your servers.

## Key takeaways

-   Most leaks happen on your side: in app logs, tracing tools, error reports and analytics, not at the model provider.
-   Classify fields first. Many tasks never need the name, phone number or account ID.
-   Reversible placeholders such as \[PHONE\_1\] keep the text readable for the model and let you restore values after.
-   Zero data retention limits what the provider keeps. It does not replace redaction or a contract.
-   Treat voice as sensitive by default: one voice note can hold a name, a number and a health detail.

**On this page**

1.  What counts as sensitive data for an LLM API?
2.  Step 1: which fields does the task actually need?
3.  Step 2: how do you redact so the model still understands the text?
4.  Step 3: what happens to the data at the provider?
5.  Step 4: how do you keep prompts out of your own logs?
6.  Step 5: how do you protect the path to the API?
7.  Step 6: what should you check in the response?
8.  Does sensitive audio need the same treatment?
9.  Where BroadNet Inference fits

_[image: The word "PRIVATE" in bold letters, with the text "Control what AI sees." and "LSDF by BroadNet".]_

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](https://genai.owasp.org/llmrisk/llm022025-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:

1.  **Summarise a ticket?** The model needs the complaint, not the customer’s address.
2.  **Classify intent?** It needs the message text, not the account ID.
3.  **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](https://broadrouter.com/glossary/input-and-output-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.

```python
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](https://microsoft.github.io/presidio/supported_entities) 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)](https://github.com/brntech/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](https://www.broadnet.ai/blog/open-source-sensitive-data-firewall)). 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](https://broadrouter.com/blog/llm-api-data-retention-compared/) for official wording from five of them, the [ZDR checklist](https://broadrouter.com/blog/zero-data-retention-llm-api-checklist/) for the technical questions, and the [GDPR checklist](https://broadrouter.com/blog/gdpr-llm-api-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](https://broadrouter.com/blog/llm-api-usage-logging/) 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](https://broadrouter.com/blog/llm-api-key-security/) covers storage and rotation.
-   Lock keys to your egress addresses with [IP allow-lists](https://broadrouter.com/guides/api-keys-ip-allow-lists/).
-   Use one [API key](https://broadrouter.com/glossary/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](https://broadrouter.com/blog/llm-safety-map-39-models/) 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](https://broadrouter.com/blog/transcribe-call-center-recordings/) shows redaction between the transcription and summary steps.

## Where BroadNet Inference fits

BroadNet’s [privacy statement](https://www.broadnet.ai/inference-privacy) 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](https://broadrouter.com/zero-data-retention/). Keys can be limited to your IP addresses. [Qwen3.8 27B](https://broadrouter.com/models/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.

Free tools for this

-   [OpenAI-compatible API request builder](https://broadrouter.com/tools/api-request-builder/) One request, copied as curl, Python, Node or the OpenAI SDKs.
-   [LLM API cost calculator](https://broadrouter.com/tools/llm-api-cost-calculator/) Price a workload on every model at once, with cache hits, reasoning and a flat-plan check.

[All free tools](https://broadrouter.com/tools/)

## Terms in this article

[Token](https://broadrouter.com/glossary/token/)

A token is the unit of text a language model reads and writes: a word, part of a word, a punctuation mark or a byte sequence produced by the model's tokenizer. LLM APIs count, limit and usually bill usage in tokens.

[API key](https://broadrouter.com/glossary/api-key/)

An API key is a secret string that identifies and authorizes a client calling an API. LLM APIs usually expect it in an Authorization: Bearer header, and anyone who holds the key can make requests that are billed to the account that owns it.

[GDPR](https://broadrouter.com/glossary/gdpr/)

The GDPR (General Data Protection Regulation, Regulation (EU) 2016/679) is the EU law on processing personal data. It has applied since 25 May 2018 and covers EU-established organisations and some outside the EU. For LLM APIs it governs processor contracts, international transfers and data minimisation.

[PII (personally identifiable information)](https://broadrouter.com/glossary/pii/)

PII (personally identifiable information) is information that can be used to distinguish or trace a person's identity, such as a name, ID number or biometric record, plus other information linked or linkable to that person. The GDPR's broader term is personal data. In LLM work, PII redaction removes it from prompts before they leave your systems.

[Subprocessor](https://broadrouter.com/glossary/subprocessor/)

A subprocessor is a third party that a processor engages to carry out processing of personal data on behalf of the controller. For an LLM API, subprocessors can include GPU hosts, partner inference providers and backup capacity. Under GDPR Article 28 they need the controller's authorisation and the same data protection obligations.

[Zero data retention](https://broadrouter.com/glossary/zero-data-retention/)

Zero data retention (ZDR) is a data-handling policy in which an AI provider processes prompts and outputs only to serve a request and does not store that content afterward, in logs, caches or training data. Content-free records such as token counts and timings are usually still kept.

[Data processing agreement (DPA)](https://broadrouter.com/glossary/dpa/)

A data processing agreement (DPA) is the contract between a controller and a processor that governs how the processor handles personal data. GDPR Article 28(3) requires it and lists its contents: documented instructions, confidentiality, security, subprocessor rules, deletion or return of data, and audits.

[Input and output tokens](https://broadrouter.com/glossary/input-and-output-tokens/)

Input tokens are the tokens a language model reads in a request, including the system prompt, conversation history, tool definitions and images. Output tokens are the tokens it generates in reply, including any reasoning. LLM APIs usually price them separately, and output usually costs more.

## Questions

### Is it safe to send PII to an LLM API?

It can be, with controls: a contract with the provider, a clear retention and training policy, minimisation and redaction before the request, and clean logs on your side. Without those, avoid sending raw PII.

### Should I redact data before sending it to ChatGPT or another LLM API?

Redact anything the task does not need. For summaries, classification and drafting, names and numbers can usually be replaced with placeholders without hurting quality, then restored after the response.

### What is the difference between redaction and pseudonymisation?

Redaction removes a value for good. Pseudonymisation replaces it with a placeholder you can map back with a key you keep. Under the GDPR, pseudonymised data is still personal data, so it still needs protection.

### Does zero data retention mean I can send anything?

No. Zero data retention means the provider does not keep content after the request. The data still leaves your systems and is processed by the provider, so minimisation and legal checks still apply.

### How do I stop prompts appearing in my own logs?

Log request IDs, model, token counts, latency and status, never message bodies. Check HTTP client debug logging, tracing SDKs and error reporters, which often capture request bodies by default.

## Keep reading

-   [Saudi and UAE PDPL and LLM APIs: a cross-border checklist](https://broadrouter.com/blog/saudi-uae-pdpl-llm-api-checklist/)
-   [The Safety Map: how 39 LLMs handle sensitive data](https://broadrouter.com/blog/llm-safety-map-39-models/)
-   [How to test an LLM for sensitive-data safety: BroadNet's method](https://broadrouter.com/blog/llm-sensitive-data-safety-evaluation-method/)
-   [Zero data retention LLM API: a 10-question checklist](https://broadrouter.com/blog/zero-data-retention-llm-api-checklist/)
-   [GDPR and LLM APIs: 15 questions to ask your provider](https://broadrouter.com/blog/gdpr-llm-api-checklist/)
-   [LLM API data retention compared: OpenAI, Anthropic, Gemini, Mistral](https://broadrouter.com/blog/llm-api-data-retention-compared/)
-   [How to transcribe call center recordings: an Arabic-ready pipeline](https://broadrouter.com/blog/transcribe-call-center-recordings/)
-   [LLM API key security: storage, rotation and IP allow-lists](https://broadrouter.com/blog/llm-api-key-security/)
-   [Egypt's data protection law (Law 151 of 2020) and LLM APIs](https://broadrouter.com/blog/egypt-data-protection-law-llm-api/)
-   [Guide: Lock API keys to your servers with IP allow-lists](https://broadrouter.com/guides/api-keys-ip-allow-lists/)
-   [Guide: Use the OpenAI Python SDK with BroadNet Inference](https://broadrouter.com/guides/openai-python-sdk/)

Try it on your real workload. New accounts start with $5 of credit for Gemma and transcription. DeepSeek, GLM and Qwen3.8 need a top-up.

[Get started](https://inference.broadnet.ai/account/?utm_source=broadrouter&utm_medium=referral&utm_campaign=blog-llm-api-sensitive-data&utm_content=page-cta) ·

**Sources**

-   [BroadNet: the LLM Sensitive Data Firewall (LSDF), open source, with its May 2026 recall table (fetched 2026-11-15)](https://www.broadnet.ai/blog/open-source-sensitive-data-firewall)
-   [LSDF repository on GitHub, Apache-2.0 (fetched 2026-11-15)](https://github.com/brntech/lsdf)
-   [Al Zubaidi, The Safety Map: What Does and Doesn't Transfer in LLM Sensitive-Data Handling, Zenodo preprint (fetched 2026-11-15)](https://doi.org/10.5281/zenodo.19688433)
-   [OWASP GenAI Security Project, LLM02:2025 Sensitive Information Disclosure](https://genai.owasp.org/llmrisk/llm022025-sensitive-information-disclosure/)
-   [Microsoft Presidio, PII detection and anonymisation SDK, supported entities](https://microsoft.github.io/presidio/supported_entities)
-   [Regulation (EU) 2016/679 (GDPR), Articles 5 and 9, EUR-Lex](https://eur-lex.europa.eu/eli/reg/2016/679/oj)
-   [BroadNet Inference privacy statement (effective September 2026, fetched 2026-11-14)](https://www.broadnet.ai/inference-privacy)
-   [BroadNet Inference API reference](https://inference.broadnet.ai/docs?utm_source=broadrouter&utm_medium=referral&utm_campaign=blog-llm-api-sensitive-data&utm_content=sources)
