Security
Redact PII from extracted text
Extract text from any document and redact PII with category tags.
How It Works
- Extract text from any supported format (PDF, DOCX, XLSX, PPTX, images, HTML, etc.)
- Detect PII using pattern matching and intelligent entity recognition
- Redact by replacing PII with category tags like [SSN], [EMAIL], [NAME]
- Return redacted text with audit metadata
PII Types Detected
| Type | Example Output | Confidence |
|---|---|---|
| ssn | [SSN] | 0.90 |
| credit_card | [CREDIT_CARD] | 0.95 |
| [EMAIL] | 0.98 | |
| phone | [PHONE] | 0.85 |
| ip_address | [IP_ADDRESS] | 0.95 |
| date_of_birth | [DATE_OF_BIRTH] | 0.70 |
| name | [NAME] | 0.85 |
| address | [ADDRESS] | 0.85 |
| organization | [ORGANIZATION] | 0.85 |
Parameters
- pii_types: Comma-separated list of types to detect, or "all" (default)
- use_ner: Enable intelligent name/address/organization detection (default: true)
- minimum_confidence: Threshold 0.0-1.0 (default: 0.8)
- ocr_language: OCR language if needed (default: "eng")
- ocr_fallback: Use OCR if text extraction fails (default: true)
Audit Metadata
The response includes masked values for compliance logging:
- SSN: ***-**-6789
- Email: j***@example.com
- Phone: ***-***-7890
- Credit Card: ************1234
Example
import httpx
response = httpx.post(
"https://api.filegraph.ai/security/text/redact",
headers={"X-API-Key": "your-api-key"},
files={"file": open("document.pdf", "rb")},
data={
"pii_types": "ssn,email,phone,name",
"use_ner": "true",
"minimum_confidence": "0.8"
}
)
result = response.json()
print(f"Found {result['pii_found']} PII instances")
print(result['redacted_text'])
# Audit log
for match in result['matches']:
print(f"{match['pii_type']}: {match['masked_value']}")
post/security/text/redact
Request
- Base URL: https://api.filegraph.ai (the document declares no server; this is the origin it was published from)
- URL: https://api.filegraph.ai/security/text/redact
- Auth: API key in header X-API-Key
Response
Successful Response
Example response
{
"char_count": 892,
"format_detected": "pdf",
"matches": [
{
"confidence": 0.85,
"end_position": 16,
"masked_value": "J*** D***",
"pii_type": "name",
"redacted_tag": "[NAME]",
"start_position": 8
},
{
"confidence": 0.98,
"end_position": 36,
"masked_value": "j***@example.com",
"pii_type": "email",
"redacted_tag": "[EMAIL]",
"start_position": 20
}
],
"ner_enabled": true,
"pii_by_type": {
"email": 1,
"name": 1,
"phone": 1,
"ssn": 1
},
"pii_found": 4,
"processing_time_ms": 245,
"redacted_text": "Contact [NAME] at [EMAIL] or [PHONE]. SSN: [SSN]",
"used_ocr": false,
"word_count": 150
}Changes
No recorded changes to this operation across all 1 revision of this API.