Security
Redact sensitive data from PDF
Automatically detect and redact sensitive information from PDF documents using AI.
Compliance Presets
Choose a preset to match your regulatory requirements:
| Preset | Use Case |
|---|---|
| auto | General redaction - detects PII, financial, healthcare, legal data |
| gdpr | EU data protection - names, emails, IPs, phone numbers, national IDs |
| hipaa | Healthcare - patient names, medical records, insurance, prescriptions |
| ferpa | Education - student names, school records, educational IDs |
| foia | Government - classified content, addresses, government IDs |
| glba | Financial services - bank accounts, credit cards, loan records |
| ccpa | California privacy - purchase history, geolocation, online identifiers |
| manual | Custom rules only - use with redaction_rules parameter |
Detection Categories
Enable specific detection types using boolean parameters (combine with presets for finer control):
| Parameter | Set to true to detect | Example data detected |
|---|---|---|
| pii | Personally identifiable information | Names, emails, phone numbers, addresses, birthdates |
| phi | Patient health information | Medical records, prescriptions, insurance info |
| financial | Financial data | Credit cards, bank accounts, transactions |
| legal | Legal/contractual data | Case numbers, contracts, legal clauses |
| confidential | Confidential business data | Trade secrets, internal communications, IP |
Usage: Pass each as a separate form field: pii=true, phi=true, etc.
Custom Redaction Rules
For precise control, pass redaction_rules as JSON:
[
{"text": "john@domain.com"},
{"detect": "Bank account number"},
{"regex": "\\b\\d{3}-\\d{2}-\\d{4}\\b"}
]
Example
import httpx
import base64
response = httpx.post(
"https://api.filegraph.ai/security/pdf/redact",
headers={"X-API-Key": "your-api-key"},
files={"file": open("sensitive.pdf", "rb")},
data={
"preset": "hipaa",
"minimum_confidence": "0.7",
"pii": "true", # Enable PII detection
"financial": "true" # Also detect financial data
}
)
result = response.json()
print(f"Redacted {result['redactions_found']} items")
# Save the redacted PDF
output = base64.b64decode(result["content_base64"])
with open("redacted.pdf", "wb") as f:
f.write(output)
Note: This endpoint applies visual redactions (black boxes) to PDFs. If you need text output with category tags like [SSN] or [EMAIL], use /security/text/redact instead.
post/security/pdf/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/pdf/redact
- Auth: API key in header X-API-Key
Response
Successful Response
Example response
{
"content_base64": "JVBERi0xLjQK...",
"content_type": "application/pdf",
"filename": "redacted.pdf",
"pages_processed": 5,
"preset_used": "auto",
"redactions_found": 15,
"size_bytes": 102400
}Changes
No recorded changes to this operation across all 1 revision of this API.