> ## 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

<div className="flex items-center gap-2">
  <Badge color="teal">Function</Badge>
</div>

> This function is defined in the [**redact**](../modules/redact) 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

<ParamField query="text" type="str" required={true}>
  Input string — returned unchanged if empty or None.
</ParamField>

### Returns

<ResponseField name="Returns" type="str">
  Scrubbed string with literal secrets replaced by `[REDACTED*]`.
</ResponseField>

## Uses

* `redact_string`
* `pat.sub`

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/trace/redact.py#L147">
  `praisonaiagents/trace/redact.py` at line 147
</Card>
