Skip to main content
Velma-2 offers two approaches to PII/PHI handling depending on what you need:
PII/PHI taggingPII/PHI redaction
How to usepii_phi_tagging=true on any STT endpointDedicated Redaction API
TranscriptSensitive spans wrapped in entity tagsSensitive spans replaced with entity tags
AudioOriginal audio unchangedSensitive audio ranges silenced
Use whenYou need the transcript cleaned but keep audioYou need both transcript and audio sanitized
The examples on this page use the Redaction APIs.

Batch

Send a complete audio file. The response is multipart/form-data with two parts: metadata (JSON transcript) and audio (redacted MP3).
curl -X POST https://modulate-developer-apis.com/api/velma-2-pii-phi-redaction-batch \
  -H "X-API-Key: $MODULATE_API_KEY" \
  -F "upload_file=@audio.mp3" \
  -F "speaker_diarization=true" \
  -o response.multipart \
  -D response_headers.txt
Install requests-toolbelt to decode the multipart response: pip install requests-toolbelt.
{
  "text": "My name is [FIRSTNAME] and my SSN is [SSN].",
  "duration_ms": 5600,
  "redaction_ranges": [
    { "start_ms": 1100, "end_ms": 1800 },
    { "start_ms": 3200, "end_ms": 4400 }
  ],
  "utterances": [
    {
      "start_ms": 0,
      "end_ms": 5600,
      "speaker": 1,
      "language": "en",
      "text": "My name is [FIRSTNAME] and my SSN is [SSN]."
    }
  ]
}
Entity tags in the transcript ([FIRSTNAME], [SSN], [PHI], etc.) correspond directly to the silenced redaction_ranges in the audio.

Streaming (WebSocket)

Connect over WebSocket and receive redacted utterances and silenced MP3 clips as each utterance completes. The stream delivers two message types interleaved:
  • JSON text framesutterance messages with the redacted transcript text
  • Binary frames — MP3 clips with the silenced audio for each utterance
websocat "wss://modulate-developer-apis.com/api/velma-2-pii-phi-redaction-streaming?api_key=$MODULATE_API_KEY&speaker_diarization=true" \
  --binary - < audio.mp3
{ "type": "utterance", "utterance": { "start_ms": 0, "end_ms": 5600, "speaker": 1, "language": "en", "text": "My name is [FIRSTNAME] and my SSN is [SSN]." } }
<binary MP3 clip>
{ "type": "done", "duration_ms": 5600, "trailing_redacted_audio": false }

API reference