cd /news/artificial-intelligence/redact-pii-from-call-recordings-with… · home topics artificial-intelligence article
[ARTICLE · art-79278] src=dev.to ↗ pub= topic=artificial-intelligence verified=true sentiment=↑ positive

Redact PII from Call Recordings with Python and Telnyx AI

Telnyx released a Python Flask example that redacts personally identifiable information (PII) from call transcripts and recordings using its AI inference API. The app replaces common PII types like names, credit card numbers, and SSNs with placeholders and returns structured JSON with a redaction map for audit trails. It supports both text and audio inputs, transcribing audio via the distil-whisper/distil-large-v2 model before redaction.

read1 min views1 publishedJul 29, 2026

I put together a small Flask example that redacts PII from call transcripts and call recordings using Telnyx AI.

Code:

https://github.com/team-telnyx/telnyx-code-examples/tree/main/call-recording-redactor-python

The app has two workflows:

The prompt asks the model to replace common PII with placeholders:

[NAME]

[CREDIT_CARD]

[SSN]

[PHONE]

[EMAIL]

[ADDRESS]

[DOB]

[ACCOUNT_NUMBER]

The useful part is that the response is structured JSON, not just rewritten text.

{
  "redacted_transcript": "Hi, this is [NAME] calling. My card number is [CREDIT_CARD].",
  "redactions": [
    {
      "type": "name",
      "original": "John Smith",
      "redacted": "[NAME]",
      "count": 1
    }
  ],
  "items_redacted": 2,
  "pii_types_found": ["name", "credit_card"]
}

That means your app can show the sanitized transcript while still keeping an audit-friendly redaction map.

git clone https://github.com/team-telnyx/telnyx-code-examples.git
cd telnyx-code-examples/call-recording-redactor-python
cp .env.example .env
pip install -r requirements.txt
python app.py

Configure .env

:

TELNYX_API_KEY=your_telnyx_api_key
AI_MODEL=meta-llama/Llama-3.3-70B-Instruct
HOST=127.0.0.1
curl -X POST http://localhost:5000/redact \
  -H "Content-Type: application/json" \
  -d '{
    "transcript": "Hi, this is John Smith calling. My card number is 4532-1234-5678-9012 and my SSN is 123-45-6789."
  }'

This calls Telnyx AI Inference through:

POST /v2/ai/chat/completions
curl -X POST http://localhost:5000/redact/audio \
  -F "file=@recording.wav"

For audio, the app first calls:

POST /v2/ai/audio/transcriptions

using:

distil-whisper/distil-large-v2

Then it sends the transcript through the same PII redaction flow.

POST /redact

POST /redact/audio

GET /redactions

GET /redactions/<id>

GET /health

This is a starter app, so it stores redaction jobs in memory.

For production, I would add:

The main pattern is reusable: turn communications data into structured, safer application data before it moves deeper into your systems.

Resources:

── more in #artificial-intelligence 4 stories · sorted by recency
── more on @telnyx 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/redact-pii-from-call…] indexed:0 read:1min 2026-07-29 ·