Skip to Content
API ReferenceRedaction

Redaction

The core redaction endpoints detect and remove PII from text and files.

POST /redact

Redact PII from text synchronously. Returns the redacted text and a list of findings.

Request Body

FieldTypeRequiredDescription
textstringYesThe text to scan and redact
pii_typesstring[]NoSpecific PII types to detect (default: all)
confidence_thresholdnumberNoMinimum confidence score 0.0-1.0 (default: 0.5)
languagestringNoLanguage code, e.g. en, es (default: en)
policy_idstringNoApply a saved redaction policy

Response

FieldTypeDescription
redacted_textstringText with PII replaced
findingsarrayList of detected PII entities
entity_countnumberTotal number of entities found

Each finding contains:

FieldTypeDescription
entity_typestringPII type (e.g. PERSON, EMAIL_ADDRESS)
startnumberStart character offset
endnumberEnd character offset
scorenumberConfidence score
originalstringOriginal text (if not redacted)
redactedstringReplacement value

Example

curl -X POST https://api.pii-redactor.dev/api/v1/redact \ -H "X-API-Key: pk_live_abc123" \ -H "Content-Type: application/json" \ -d '{ "text": "Contact John Smith at john@example.com or 555-0123.", "confidence_threshold": 0.6 }'
{ "redacted_text": "Contact <PERSON> at <EMAIL_ADDRESS> or <PHONE_NUMBER>.", "findings": [ { "entity_type": "PERSON", "start": 8, "end": 18, "score": 0.95, "original": "John Smith", "redacted": "<PERSON>" }, { "entity_type": "EMAIL_ADDRESS", "start": 22, "end": 38, "score": 0.99, "original": "john@example.com", "redacted": "<EMAIL_ADDRESS>" }, { "entity_type": "PHONE_NUMBER", "start": 42, "end": 50, "score": 0.85, "original": "555-0123", "redacted": "<PHONE_NUMBER>" } ], "entity_count": 3 }

POST /redact/uri

Submit a file or URI for asynchronous redaction. The file is processed in the background and results are available via the Jobs endpoint.

Request Body

FieldTypeRequiredDescription
input_uristringYesURI of the file to redact (S3, GCS, or HTTPS URL)
output_uristringNoDestination URI for the redacted file
pii_typesstring[]NoSpecific PII types to detect (default: all)
confidence_thresholdnumberNoMinimum confidence score 0.0-1.0 (default: 0.5)
policy_idstringNoApply a saved redaction policy

Response

FieldTypeDescription
job_idstringUnique identifier for the async job
statusstringInitial status, always queued

Example

curl -X POST https://api.pii-redactor.dev/api/v1/redact/uri \ -H "X-API-Key: pk_live_abc123" \ -H "Content-Type: application/json" \ -d '{ "input_uri": "s3://my-bucket/documents/report.pdf", "output_uri": "s3://my-bucket/redacted/report.pdf", "confidence_threshold": 0.7 }'
{ "job_id": "job_8f3a1b2c4d5e", "status": "queued" }

Poll the job status with GET /jobs/{job_id} or configure a webhook to receive a notification when processing completes.

Supported File Types

TypeExtensions
Text.txt
PDF.pdf
Images.png, .jpg, .jpeg, .tiff, .bmp
Audio.wav, .mp3, .flac, .ogg