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

# Scrub Pii Text • AI Agent SDK

> scrub_pii_text: Redact API keys, passwords, SSNs, credit cards, and emails from free text.

# scrub\_pii\_text

Function

> This function is defined in the [**redact**](https://praison.ai/docs/sdk/reference/praisonaiagents/modules/redact.md) module.

Redact API keys, passwords, SSNs, credit cards, and emails from free text.

Reuses REDACT\_KEYS for `key=value` pairs and adds value-pattern rules
for naked secrets. Zero dependency (stdlib re only).

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def scrub_pii_text(text: str) -> str
```

## Parameters

**text** `str` *required*

Input string — returned unchanged if empty or None.

### Returns

**Returns** `str`

Scrubbed string with literal secrets replaced by `[REDACTED*]`.

## Uses

* `redact_string`
* `pat.sub`

## Source

> [card] [View on GitHub](https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/trace/redact.py#L152)
>
> `praisonaiagents/trace/redact.py` at line 152


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.