Privacy with Veil
Turn on Veil for a project so the AI Gateway finds personal details in prompts and masks, redacts, tokenises or blocks them before they leave for a provider.
Veil is Dekka's engine for finding personal information in text. When a project turns it on, the AI Gateway sends the text of every request to Veil before any provider sees it, and applies the project's policy to what Veil finds. A Ghana Card PIN can be refused outright, a phone number masked to 024 *** 4567, and an email address replaced with a placeholder that's put back in the model's reply. The provider receives only what the policy allows.
Turn it on
Open AI Gateway, then Routing, choose the project, and find Personal data in prompts below Where requests can go. Choose a mode and save.
| Mode | What happens |
|---|---|
| Off | Prompts reach the provider as your app sends them. This is the default. |
| Detect | Veil reports what it finds in the request log and the text goes unchanged. Use it to see what your prompts contain before you change anything. |
| Protect | Veil applies the policy before the text leaves. A request the policy blocks never reaches a provider. |
Veil scans every message in a request, including your system prompt and earlier replies, because a previous reply can contain values Veil restored. Try it on sample text runs sample text through your settings, saved or not, and shows what the provider would receive. Nothing you try is stored.
Choose a policy
The built-in default-protection policy blocks credentials and Ghana Card PINs, masks phone numbers and redacts every other detail Veil finds as a typed placeholder such as [EMAIL_ADDRESS].
For anything else, write a custom policy in YAML. Each rule matches entity types or categories and chooses an action, and the default action covers everything no rule matches. The name and revision are recorded with every request, so you can tell which version of a policy handled it.
version: 1
name: support-desk
revision: "1"
default_action: redact
rules:
- match: { entity_types: [GH_GHANA_CARD_PIN] }
action: block
- match: { entity_types: [GH_MOBILE_NUMBER] }
action: mask
- match: { entity_types: [EMAIL_ADDRESS] }
action: tokenize
- match: { categories: [CREDENTIAL] }
action: blockA block always wins over any other rule. Veil checks a custom policy when you save it, and any error appears under the editor with its path, such as rules.0.action.
What each action does
Each action below is shown on the same prompt. It holds a Ghana Card PIN, an email address, a digital address and two phone numbers, one of which appears twice.
The customer holds Ghana Card GHA-723451904-3.
Call 024 123 4567 or write to ama@example.com.
Deliver to GA-183-8164.
If nobody is in, call 024 123 4567 again, then 020 555 0187.A policy usually gives each kind of detail its own action, as the one above does. Here a single action is applied to everything, so you can see what it does to each kind and choose by how much the model needs to know.
Detect and allow
detect leaves the text alone and records what Veil found in the request log, so the provider receives the prompt exactly as your app sent it. Use it to see what your prompts contain before you change anything. allow does the same and says that leaving this kind of detail in place is a decision you made.
Mask
mask keeps part of each value readable and hides the rest. How much stays depends on the kind of detail: a phone number keeps its network code and last four digits, an email address keeps its first letter and its domain, and a digital address keeps only its last two digits. The model can still tell that the first and third phone numbers are probably the same one, and a person reading the reply can recognise their own details, but nobody can use them from what the provider holds.
The customer holds Ghana Card GHA-********4-3.
Call 024 *** 4567 or write to a***@example.com.
Deliver to **-***-**64.
If nobody is in, call 024 *** 4567 again, then 020 *** 0187.Redact
redact replaces each value with the kind of detail it was. The model knows that a card number, a phone number, an email address and a digital address were there and nothing more, so it can't tell one phone number from the other. Use it when the task doesn't depend on which value is which, such as summarising a conversation or sorting a support ticket.
The customer holds Ghana Card [GH_GHANA_CARD_PIN].
Call [GH_MOBILE_NUMBER] or write to [EMAIL_ADDRESS].
Deliver to [GH_DIGITAL_ADDRESS].
If nobody is in, call [GH_MOBILE_NUMBER] again, then [GH_MOBILE_NUMBER].Tokenize
tokenize gives each different value its own numbered placeholder, counted separately for each kind of detail, and the same value gets the same number within a request. Below, the phone number that appears twice is [GH_MOBILE_NUMBER_1] both times and the other is [GH_MOBILE_NUMBER_2], so the model can follow which is which and refer to them in its reply without ever seeing them.
The customer holds Ghana Card [GH_GHANA_CARD_PIN_1].
Call [GH_MOBILE_NUMBER_1] or write to [EMAIL_ADDRESS_1].
Deliver to [GH_DIGITAL_ADDRESS_1].
If nobody is in, call [GH_MOBILE_NUMBER_1] again, then [GH_MOBILE_NUMBER_2].With Restore tokenised values in replies on, your app gets the real values back in the reply. Use tokenize when the reply has to contain them, such as a drafted message that tells a customer which number to call.
Block
block refuses the whole request with blocked_by_privacy_policy, and the provider receives nothing. Use it for details that should never reach a provider in any form, such as Ghana Card PINs and credentials.
Stricter rules for some providers
A provider can have its own policy and its own choice of what happens when Veil can't scan. Use it to block more before prompts reach a provider outside Ghana, for example, while keeping a lighter policy for others. When a request falls back to another provider, the gateway applies that provider's policy, and reuses the first scan when the policies are the same.
When Veil can't scan
If Veil is unreachable or doesn't answer within two seconds, the project's enforcement decides:
- Refuse it answers 503
privacy_scan_unavailable, and nothing reaches a provider. This is the default. - Send it with a warning sends the request as your app wrote it and adds
X-Dekka-Veil-Warning: scan_unavailableto the response.
Detect mode doesn't refuse a request when Veil can't scan, since it only reports. It does refuse images, and audio sent for transcription, with 422 privacy_media_blocked while the media rule blocks them, which it does by default.
Restoring tokenised values
With Restore tokenised values in replies on, placeholders the policy creates are put back in the model's reply, so your app sees ama@example.com where the model wrote [EMAIL_ADDRESS_1]. The mapping between placeholders and values exists in memory for that one request and is never logged or stored.
Streamed replies are restored as they arrive. The gateway holds back at most one placeholder's length of text, so a placeholder split across two chunks is still replaced.
Scanning replies
With Scan replies too on, Veil also scans each reply and the request log records how many personal details it found. A non-streamed reply's count is in the X-Dekka-Veil-Response-Findings header. A streamed reply is scanned after it finishes, so the count appears only in the log, and the reply itself is never changed.
Images and audio
Veil reads text only, so a project that uses Veil refuses images in chat and audio for transcription with 422 privacy_media_blocked, unless you choose Allow with a warning. Allowed requests carry X-Dekka-Veil-Warning: media_not_scanned. Image prompts and text to speak are scanned like any other text, and transcripts can be scanned as replies.
Headers
| Header | What it says |
|---|---|
X-Dekka-Veil |
protected, detected or off |
X-Dekka-Veil-Findings |
How many personal details Veil found in the request |
X-Dekka-Veil-Response-Findings |
How many it found in the reply, when replies are scanned |
X-Dekka-Veil-Warning |
scan_unavailable or media_not_scanned |
What a refusal looks like
{
"error": {
"code": "blocked_by_privacy_policy",
"message": "This project's privacy policy blocks the request, because it contains details the policy doesn't allow to leave.",
"details": {
"policy": "default-protection@2026-11-04",
"by_entity": { "GH_GHANA_CARD_PIN": 1 },
"by_action": { "block": 1 }
}
}
}A refusal names the kinds of detail and how many, never the values.
What the request log keeps
Each request on the Requests page shows whether Veil protected, detected or blocked it, and which kinds of detail it found. The log keeps the mode, the policy and its revision, counts by entity type and by action, and how long the scan took. It never keeps the prompt, the reply, the values Veil found or the restore map.
With the API
The settings are part of a project's routing rules, and have their own endpoints too.
curl -X PUT https://api.dekka.cloud/v1/projects/$PROJECT_ID/ai/privacy \
-H "Authorization: Bearer $DEKKA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"mode": "protect", "preset": "default-protection", "enforcement": "closed", "restore_in_responses": true}'POST /v1/projects/{id}/ai/privacy/preview with {"text": "…", "provider": "openai"} returns what the provider would receive, with the findings, and stores nothing.