Overview
Streaming PII Redaction lets you automatically detect and remove personally identifiable information from your streaming transcripts in real time. When enabled, the API redacts PII in final turns only before sending them to the client. When you enable PII redaction, your final turns will look like this:- With
hashsubstitution:Hi, my name is ####! - With
entity_namesubstitution:Hi, my name is [PERSON_NAME]!
Connection parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
redact_pii | boolean | Yes | false | Enable PII text redaction. Only applies to final turns. |
redact_pii_policies | array | No | All | PII entity types to redact. Over the raw WebSocket, pass a JSON-encoded array of policy names (e.g. ["person_name","phone_number"]). The SDKs accept a native list/array. If omitted and redact_pii is true, all detected PII is redacted. See PII policies for the full list. |
redact_pii_sub | string | No | hash | Replacement scheme. hash replaces PII with # characters, entity_name replaces with [ENTITY_TYPE]. |
include_partial_turns | boolean | No | false when redact_pii is true, otherwise true | Whether to include partial (non-final) turns. Defaults to false automatically when PII redaction is enabled, so no unredacted text reaches the client. Set to true only if you explicitly want to receive partial turns, which will contain unredacted PII. |
Quickstart
Enable PII redaction by settingredact_pii to true when you open the WebSocket. Optionally pass redact_pii_policies to limit which entity types are redacted, and redact_pii_sub to choose the replacement scheme.
- Python
- Python SDK
- Javascript
- JavaScript SDK
Example output
Withentity_name substitution:
hash substitution:
Supported PII policies
Streaming PII redaction supports the same policies as pre-recorded PII redaction, includingperson_name, phone_number, email_address, credit_card_number, us_social_security_number, date_of_birth, and more.
For the full list of available policies, see PII policies.
Troubleshooting
Why am I still seeing PII in the transcript?
Why am I still seeing PII in the transcript?
PII redaction only applies to final turns. If you’re seeing PII, you
likely set
include_partial_turns to true, which returns unredacted
partial turns alongside redacted finals. Remove that override (or set it to
false) to only receive redacted final turns — this is the default when
redact_pii is enabled.Can I redact PII from the audio itself?
Can I redact PII from the audio itself?
Audio redaction is not available for streaming. To generate a redacted audio
file, use pre-recorded PII redaction
with the
redact_pii_audio parameter.