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:

PresetUse Case
autoGeneral redaction - detects PII, financial, healthcare, legal data
gdprEU data protection - names, emails, IPs, phone numbers, national IDs
hipaaHealthcare - patient names, medical records, insurance, prescriptions
ferpaEducation - student names, school records, educational IDs
foiaGovernment - classified content, addresses, government IDs
glbaFinancial services - bank accounts, credit cards, loan records
ccpaCalifornia privacy - purchase history, geolocation, online identifiers
manualCustom rules only - use with redaction_rules parameter

Detection Categories

Enable specific detection types using boolean parameters (combine with presets for finer control):

ParameterSet to true to detectExample data detected
piiPersonally identifiable informationNames, emails, phone numbers, addresses, birthdates
phiPatient health informationMedical records, prescriptions, insurance info
financialFinancial dataCredit cards, bank accounts, transactions
legalLegal/contractual dataCase numbers, contracts, legal clauses
confidentialConfidential business dataTrade 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

filenamestring required

Output filename

content_typestring required

MIME type of the file

size_bytesinteger required

File size in bytes

content_base64string required

Base64-encoded file content

redactions_foundinteger required

Number of redactions applied to the document

pages_processedinteger required

Number of pages processed

preset_usedstring required

Redaction preset that was applied

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.