Documentation

AI Gateway · Guides

Policies

How AI Gateway policies work — the entity types it detects, choosing redact/mask/block per type, content rules that block things like password-reset emails, and mapping policies to HIPAA, PCI, and GDPR.

A policy is the set of rules the Gateway applies to every request in a project: which data types to look for, what to do with each, and which content to refuse outright. They are the configurable half of the AI privacy and policy enforcement layer — the Gateway brings the detectors, you decide what happens when one fires. Policies are versioned, so you can change them safely and see exactly which version handled any past request.

Entity types

The Gateway ships with tuned detectors for the sensitive data that matters most.

CategoryExamplesDefault action
PIINames, addresses, SSN / TIN, DOBRedact
ContactEmail, phoneMask
Cardholder data (PCI)Card numbers (PAN), CVVMask / block
Health (PHI)Diagnoses, MRNs, clinical notesRedact
SecretsPasswords, tokens, API keys, private keysBlock
CustomYour own patterns (account IDs, case numbers)Configurable

Detection combines deterministic patterns (for well-structured data like card numbers) with ML classifiers (for free-text names, addresses, and health details), so it catches entities that a regular expression alone would miss.

Actions: redact, mask, block

For every entity type you choose one of three actions:

  • Redact — remove the value entirely, replaced with a typed reversible token.
  • Mask — reveal only part of it (for example, the last four digits of a card).
  • Block — refuse the whole request; it is never sent to a model.

You can set different actions per type and per project — mask phone numbers in a support assistant, but block them in a marketing tool, for instance.

Content rules

Beyond entities, policies can block whole classes of content that should never reach a model, regardless of the PII in them:

  • Password-reset and MFA-code emails — the Gateway won't read or forward them.
  • Credentials and secrets in any field.
  • Documents above a sensitivity label (see Microsoft Purview integration).
  • No training — a standing rule that customer data is never used to train a third-party model.

Block rules always win

If a request matches a block rule, it is stopped before the model call — even if other parts of the request would have been fine to send. Block is a hard stop, not a redaction.

Framework mappings

Policies map to the controls auditors ask about, so "are you compliant" has a concrete answer.

FrameworkWhat the policy enforces
HIPAARedact PHI on non-clinical prompts; audit every access.
PCI DSSMask or block PAN before any model call.
GDPRMinimize and redact personal data; honor data-residency settings.
SOC 2Full audit trail, access control, and no-training guarantee.

Managing policies

  • Per project — each project has one active policy; reuse a shared policy across projects or fork one.
  • Versioned — every change creates a new version; logs record which version ran.
  • Testable — run a policy against sample prompts in Policy → Test before you publish it.
  • Human-in-the-loop — optionally route borderline requests to a reviewer instead of auto-blocking.

To have the Gateway propose and maintain these rules for you, see Automatic policy setting.

Need a hand with AI Gateway?Talk to our team →