Skip to main content
The Data Loss Prevention detector (data_loss_prevention) finds sensitive data — PII and secrets — in prompts and model output, and can mask it in flight. It is the only mutable detector: the only one that can be used with the Transform action and the only one that populates transformed_payload.
PropertyValue
Slugdata_loss_prevention
Categorydata_loss_prevention
Sidesinput, output
Protocolsall
Mutable
JSON bodies are masked structurally (string values only — keys are never touched); text bodies are masked directly. Detected secrets (API keys, access tokens, JWTs, Stripe keys) are reported with signal.type: "secret"; all other entities as "pii".

Actions

As a detector, DLP only detects. What happens is set on the policy rule:
  • Monitor — report what was found, change nothing.
  • Block — report and flag the request for the caller to block.
  • Transform — report and return a transformed_payload with matches masked; forward the masked payload instead of the original. (Only DLP supports Transform.)

Settings

Provide at least one of apply_all, predefined_entities, or rules.
FieldTypeNotes
apply_allbooleanDetect/mask every catalog entity.
predefined_entitiesarray<{ entity, enabled, mask_with, preserve_len }>Select specific PII entities and how to mask them.
rulesarray<{ type, pattern, mask_with, preserve_len }>Custom rules; type is keyword or regex (pattern required for regex).
  • mask_with — the replacement token. Defaults to an entity‑specific token (e.g. [MASKED_EMAIL]) for predefined entities, or *** for custom rules.
  • preserve_len — keep the original length when masking.
With a Transform rule, the response carries the masked body:

Entity catalog

43 built‑in entities, grouped by false‑positive risk. Pick the tier appropriate to your tolerance — Tier 1 is safe to enable broadly; Tier 3 benefits from the Monitor action first. Tier 1 — near‑zero false positives (15): api_key, access_token, email, uuid, jwt_token, crypto_wallet, stripe_key, ip_address, ip6_address, mac_address, device_mac, italian_cf, mexican_curp, french_nir, cvv. Tier 2 — structural markers, some ambiguity (16): spanish_iban, iban, us_medicare, ssn, brazilian_cnpj, brazilian_cpf, credit_card, spanish_dni, spanish_nie, spanish_cif, spanish_nss, spanish_phone, german_id, mexican_rfc, chilean_rut, swift_bic. Tier 3 — pure format patterns, higher false positives (12): device_imei, bank_account, colombian_cc, tax_id, routing_number, peruvian_dni, argentine_dni, phone_number, vehicle_vin, drivers_license, passport, isin. Secrets — the four entities reported as signal.type: "secret" (the rest are "pii"): api_key, access_token, jwt_token, stripe_key.

When to use

  • Output + Transform to strip PII the model regurgitates before it reaches the user.
  • Input + Transform to keep PII out of third‑party model providers entirely.
  • Block secrets (api_key, access_token, jwt_token, stripe_key) to stop credential leakage.