> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.fabricgateway.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.fabricgateway.ai/_mcp/server.

# PII Redaction plugin

> Reference for the PII Redaction plugin, which masks, hashes, or blocks personal data in LLM prompts and MCP messages.

The PII Redaction plugin finds personal data in what the client sends and masks it, replaces it with a short hash, or refuses the request. The same rules scrub MCP `tools/call` results before the client gets them, and the copies of the request and of MCP tool results that the gateway keeps for traces and LLM logs. The upstream receives the rewritten body. On a standalone data plane that has no control plane, the plugin doesn't rewrite request bodies yet.

## Where it runs

|             |                                                                                 |
| ----------- | ------------------------------------------------------------------------------- |
| Protocols   | LLM routes (the prompt) and MCP routes (the JSON-RPC request, and tool results) |
| Scope kinds | `global`, `service`, `route`                                                    |
| Phase       | Request                                                                         |

LLM answers aren't scrubbed on the way to the client. Only their copies on traces and in LLM logs are.

## Configuration

| Field            | Type   | Default | Description                                                                                                                                                                     |
| ---------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `entities`       | object | None    | Maps an entity to an action. Entities are `email`, `credit_card`, `ssn`, `aws_key`, `phone`, and `ip`. The console shows this under **Customize per type**.                     |
| `default_action` | string | `mask`  | The action for entities that `entities` doesn't name: `mask`, `hash`, or `block`. The console labels this **Default action**, and its **Redact PII** switch turns scanning off. |
| `hash_salt`      | string | None    | The salt for the `hash` action. The console labels this **Hash salt**.                                                                                                          |

The actions do the following:

* `mask` replaces a match with its type, for example `[EMAIL]`.
* `hash` replaces a match with its type and 8 hexadecimal characters of a salted SHA-256, for example `[EMAIL:1a2b3c4d]`. The same value gives the same hash across requests.
* `block` refuses the request with `422`. Nothing is rewritten.
* `off` doesn't scan for that entity.

`phone` and `ip` are scanned only when `entities` names them, because their patterns match ordinary numbers and version strings. With no configuration, the plugin masks email addresses, card numbers, US social security numbers, and AWS access key IDs. Card numbers must pass the Luhn check.

## Example

```json
{
  "name": "redact-prompts",
  "plugin_id": "pii-redaction",
  "scope": { "kind": "route", "name": "openai-route" },
  "config": {
    "default_action": "mask",
    "entities": { "credit_card": "block", "email": "hash", "phone": "mask" },
    "hash_salt": "my-salt"
  }
}
```

## Related guides

* [Inspect traces](/use/monitor/traces)