> ## Documentation Index
> Fetch the complete documentation index at: https://koreai.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# PII Protection

PII Protection enables you to detect, redact, and control access to personally identifiable information (PII) across your project. You can configure built-in or custom patterns to identify sensitive information, define how detected values are rendered, and configure consumer access controls for the project.

To configure PII protection:

1. Go to **Govern** > **PII**.
2. Enable **PII Detection**.
3. Configure the PII protection settings.
4. Enable and configure built-in patterns or create custom patterns.
5. Save your changes.

## PII protection settings

The following project-level settings control PII detection behavior.

| Setting                         | Description                                                                                                                                                        |
| ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **PII Detection**               | Enables configurable PII detection for the project. When disabled, configured patterns do not run. Credential and secret scrubbing remains enabled.                |
| **Output Redaction**            | Redacts detected PII in agent responses before they are returned to users.                                                                                         |
| **Non-secret Field Allow-list** | Specifies output fields that bypass credential and secret scrubbing. Use this only for fields that are verified to be safe to expose.                              |
| **Confidence Threshold**        | Specifies the minimum confidence score required for model-based detection. Lower values detect more entities but may increase false positives.                     |
| **Model Detection Time Budget** | Specifies the maximum time allowed for model-based detectors to complete. Increasing the value may improve detection accuracy but can increase processing latency. |

<Note>
  Credential and secret scrubbing for API keys, access tokens, passwords, and similar credentials is always enabled and cannot be disabled.
</Note>

## Built-in patterns

Built-in patterns use platform-managed detection logic for commonly used PII types, including Email Address, Phone Number, Social Security Number, Credit Card Number, and Date of Birth.

Each pattern can be enabled individually and configured with its own context anchoring, redaction strategies, consumer access settings, and live test configuration.

| Section                  | Description                                                                                                                                                                   |
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Basics**               | Enable or disable the pattern. The pattern name and description are read-only.                                                                                                |
| **Context Anchoring**    | Improves detection accuracy by evaluating context words near a potential match. See [Context Anchoring](#context-anchoring).                                                  |
| **Redaction Strategies** | Determines how detected PII is rendered before it is shared with a consumer. See [Redaction Strategies](#redaction-strategies).                                               |
| **Consumer Access**      | Controls how detected PII is rendered for different consumers. See [Consumer Access](#consumer-access).                                                                       |
| **Live Test**            | Validates the pattern before saving. Enter sample text and select **Test Pattern** to verify detection and preview how detected PII is rendered for each configured consumer. |

## Custom patterns

In addition to built-in patterns, you can create custom patterns to identify organization-specific or domain-specific PII. Select **Add Pattern** to create a custom pattern and configure the following settings.

| Section                    | Description                                                                                                                                                                                                                                                                                                                                                                       |
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Basics**                 | Specify the pattern Name, Description, and enable or disable the pattern.                                                                                                                                                                                                                                                                                                         |
| **Regex-based Detection**  | Identifies PII using regular expressions. Supports:<br /><br />• **Built-in Library** – Uses a platform-managed regular expression from the built-in pattern library.<br />• **Custom Regex** – Uses a user-defined RE2-compatible regular expression.<br /><br />When using Custom Regex, you can optionally configure a **Validation Expression** to validate detected matches. |
| **Entity-based Detection** | Identifies PII using entity recognition. Supports:<br /><br />• **Inbuilt Entity** – Uses a platform-provided entity detector for supported entity types.<br />• **Model-based** – Uses the selected model and an **Identification Prompt** to identify custom entity types.                                                                                                      |
| **Context Anchoring**      | Improves detection accuracy by evaluating context words near a potential match. For more information, see [Context Anchoring](#context-anchoring).                                                                                                                                                                                                                                |
| **Redaction Strategies**   | Determines how detected PII is rendered before it is shared with a consumer. For more information, see [Redaction Strategies](#redaction-strategies).                                                                                                                                                                                                                             |
| **Consumer Access**        | Controls how detected PII is rendered for different consumers. For more information, see [Consumer Access](#consumer-access).                                                                                                                                                                                                                                                     |
| **Live Test**              | Validates the pattern before saving. Enter sample text and select **Test Pattern** to verify detection and preview how detected PII is rendered for each configured consumer.                                                                                                                                                                                                     |

<Tip>
  Custom regex replacement labels support capture-group backreferences using `$1` or `\1`. Use `$$` to insert a literal dollar sign `$`.

  For example:

  * Pattern: `(John)\s(Doe)`
  * Replacement Label: `Mr. $1*** $2***`
  * Result: `Mr. J*** D***`
</Tip>

***

## Context anchoring

Context anchoring improves detection accuracy by evaluating context words that appear near a potential match.

| Setting             | Description                                                                                                                                                                         |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Context Words**   | Comma-separated keywords associated with the pattern, such as *ssn*, *social security*, or *tax id*. Detection confidence increases when these words appear near a potential match. |
| **Base Confidence** | Specifies the confidence score assigned when the pattern matches without additional context.                                                                                        |
| **Context Boost**   | Specifies the additional confidence applied when the configured context words are found near the match.                                                                             |
| **Context Window**  | Specifies the distance from the detected value within which context words are evaluated.                                                                                            |

***

## Redaction strategies

Redaction strategies determine how detected PII is rendered before it is shared with a consumer.

| Strategy               | Description                                                                                                      |
| ---------------------- | ---------------------------------------------------------------------------------------------------------------- |
| **Predefined Label**   | Replaces the detected value with a configured label such as `[REDACTED]`.                                        |
| **Masked**             | Partially obscures the detected value while preserving a configurable number of leading and trailing characters. |
| **Random Replacement** | Replaces the detected value with a synthetic value using the selected character set.                             |

<Note>
  Only enabled strategies are available when configuring render modes.
</Note>

***

## Consumer access

Consumer Access controls how detected PII is rendered for different consumers.

| Setting                    | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Default Render Mode**    | Specifies the render mode applied to all consumers unless overridden.<br /><br />Available render modes include:<br /><br />• **Original** – Passes the original detected value to the consumer.<br />• **Redacted** – Replaces the detected value with the configured predefined label.<br />• **Masked** – Applies the configured masking settings.<br />• **Random Replacement** – Replaces the detected value with a generated replacement value.<br />• **Tokenized** – Replaces the detected value with a stable token.<br /><br />Render modes that depend on a disabled redaction strategy are unavailable for selection. |
| **Per-consumer Overrides** | Overrides the default render mode for selected consumers, such as **Users**, **Tool Input**, **Tool Output**, and **Logs**.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |

<Warning>
  Large language model (LLM) consumers never receive plaintext PII. If <b>Original</b> is selected, the platform automatically replaces the detected value with a stable token before it is sent to the model.
</Warning>
