Use cases
- Keeping names, emails, and account numbers out of third-party provider logs.
- Meeting data-handling requirements without rewriting prompts in every service.
- Sending sensitive support tickets to a model while preserving the reply for the end user.
- Excluding raw PII from trace storage while still tracing the request end to end.
pii_redaction plugin detects personally identifiable information in the request, replaces each value with a placeholder before the provider sees it, and restores the original values in the response. The provider receives only placeholders such as <EMAIL_ADDRESS_1> or <PERSON_2>.
This feature is in Beta.
Deployments do not yet support PII redaction, at the workspace level or per request.
Quick start
Add apii_redaction entry to the plugins array.
Workspace-level redaction
Enable PII redaction for every request from Settings > Plugins, without passing aplugins array on each call. Once enabled, it applies automatically to all AI Gateway and Agents calls that don’t already specify a pii_redaction plugin.

The Plugins settings page showing the PII Redaction toggle, with PDF Inputs and Response Healing listed as coming soon.
How it works
The plugin runs a redaction round-trip around the generation:- Redact: detected PII in the request is replaced with typed placeholders before the request leaves the AI Gateway.
- Generate: the provider processes the placeholder text and returns a response that keeps the placeholders intact.
- Restore: the original values are substituted back into the response before it returns to the caller.
embeddings, rerank, and images/generations, the plugin redacts the input only. The rerank response restores the echoed document text; embeddings and image generation have no echoed text to restore.
Configuration
Detection threshold
Thethreshold parameter sets the confidence score at which a detected value is counted as PII. The range is 0 to 1; the default is 0.5.
Scores are boosted for language-specific formats (for example, a Dutch BSN scores higher when the detected or selected language is Dutch). Adjust the threshold only when there is an observed problem: lower it if real PII is being missed, raise it if too many non-PII values are being redacted.
Restrict to specific entities
Passentities to redact only the listed types. The list is case-insensitive and must match the selected language catalog.
Failure modes
Theon_failure policy decides what happens when the detection service cannot run:
The detection service waits up to 90 seconds by default before timing out and applying the
on_failure policy.
Supported languages
The detectable entity catalog differs per language.English (en)
English (en)
AGE, API_KEY, BANK_ROUTING, BIC, BIOMETRIC_ID, BLOOD_TYPE,
BSN, CREDIT_CARD, CRYPTO, DATE_TIME, DEVICE_ID, EDUCATION_LEVEL,
EMAIL, EMAIL_ADDRESS, EMPLOYMENT_STATUS, GENDER, HEALTH_PLAN_ID,
HTTP_COOKIE, IBAN_CODE, ID, ID_CARD, IMEI, IP_ADDRESS,
JOBTITLE, JWT, KVK_NUMBER, LANGUAGE, LICENSE_NUMBER,
LICENSE_PLATE, LOCATION, MAC_ADDRESS, MEDICAL_LICENSE,
MEDICAL_RECORD, NRP, ORGANIZATION, PASSPORT, PASSWORD, PERSON,
PHONE_NUMBER, PIN, POLITICAL_VIEW, RACE_ETHNICITY,
RELIGIOUS_BELIEF, SEXUALITY, TAX_ID, TITLE, UK_NHS, URL,
US_BANK_NUMBER, US_DRIVER_LICENSE, US_ITIN, US_PASSPORT, US_SSN,
UUID, VEHICLE_IDDutch (nl)
Dutch (nl)
AGE, API_KEY, BANK_ROUTING, BIC, BIOMETRIC_ID, BLOOD_TYPE,
BSN, CREDIT_CARD, CRYPTO, DATE_TIME, DEVICE_ID, EDUCATION_LEVEL,
EMAIL, EMAIL_ADDRESS, EMPLOYMENT_STATUS, GENDER, HEALTH_PLAN_ID,
HTTP_COOKIE, IBAN_CODE, ID, ID_CARD, IMEI, IP_ADDRESS,
KVK_NUMBER, LANGUAGE, LICENSE_NUMBER, LICENSE_PLATE, LOCATION,
MAC_ADDRESS, MEDICAL_RECORD, NRP, ORGANIZATION, PASSPORT,
PASSWORD, PERSON, PHONE_NUMBER, PIN, POLITICAL_VIEW,
RACE_ETHNICITY, RELIGIOUS_BELIEF, SEXUALITY, TAX_ID, TITLE, URL,
US_DRIVER_LICENSE, US_SSN, VEHICLE_IDTracing
Redaction is traced in-process as child spans of the request:pii-redact for the input pass and pii-restore for the output pass. Each span carries the detector language, the failure policy, the requested entity count, the placeholder count, and the outcome. persist_redacted_to_traces controls whether the redacted (placeholder) form or the restored original is stored in trace content; it defaults to true (redacted form stored).