Redaction
Experimental10 creditsGDPR-compliant PII detection and redaction. Automatically find and remove sensitive information from text with configurable masking or replacement.
Production Recommendation
This is a direct endpoint for development and testing. For production workloads, use the Data Intelligence Pipeline -- it provides structured Data Packages with quality metrics, is async by default, and is covered by Enterprise SLAs.
Overview
GDPR-compliant PII detection and redaction. Automatically find and remove sensitive information from text with configurable masking or replacement.
Key features:
- •50+ PII types detected
- •Mask or replace modes
- •LLM refinement for accuracy
- •Confidence scores and audit trail
- •Custom regex patterns for domain-specific PII
API Reference
POST
https://api.latence.ai/api/v1/redaction/detect_piiDetect and redact PII from text
Request Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
text | string | — | Input text | |
config.redact | boolean | — | Whether to redact detected PII | |
config.redaction_mode | string | — | Redaction mode: mask or replace | |
config.mode | string | — | Detection mode: balanced or strict | |
custom_labels | array | — | Custom PII patterns (regex) |
Response Fields
| Field | Type | Description |
|---|---|---|
original_text | string | |
redacted_text | string | |
pii_detected | array | |
success | boolean | |
usage | object |
Response Example
200 OKJSON
{
"original_text": "Contact john.doe@email.com or call 555-123-4567",
"redacted_text": "Contact [EMAIL] or call [PHONE_NUMBER]",
"pii_detected": [
{"text": "john.doe@email.com", "label": "EMAIL", "start": 8, "end": 26, "score": 1.0},
{"text": "555-123-4567", "label": "PHONE_NUMBER", "start": 35, "end": 47, "score": 1.0}
],
"success": true,
"usage": { "credits": 1.0 }
}Code Examples
from latence import Latence
client = Latence(api_key="YOUR_API_KEY")
# Detect and redact PII
result = client.experimental.redaction.detect_pii(
text="Contact john.doe@email.com or call 555-123-4567 for support.",
config={
"redact": True, # Actually redact, not just detect
"redaction_mode": "mask" # or "replace"
}
)
print(result.redacted_text)
# Output: "Contact [EMAIL] or call [PHONE_NUMBER] for support."
print(f"Found {len(result.pii_detected)} PII entities:")
for pii in result.pii_detected:
print(f" - {pii.label}: {pii.text}")Explore Tutorials & Notebooks
Deep-dive examples and interactive notebooks in our GitHub repository
View on GitHub
Looking for production-grade processing?
The Data Intelligence Pipeline chains services automatically and returns structured Data Packages.