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
| Field | Type | Required | Description |
|---|---|---|---|
text | string | Yes | The text to scan and redact |
pii_types | string[] | No | Specific PII types to detect (default: all) |
confidence_threshold | number | No | Minimum confidence score 0.0-1.0 (default: 0.5) |
language | string | No | Language code, e.g. en, es (default: en) |
policy_id | string | No | Apply a saved redaction policy |
Response
| Field | Type | Description |
|---|---|---|
redacted_text | string | Text with PII replaced |
findings | array | List of detected PII entities |
entity_count | number | Total number of entities found |
Each finding contains:
| Field | Type | Description |
|---|---|---|
entity_type | string | PII type (e.g. PERSON, EMAIL_ADDRESS) |
start | number | Start character offset |
end | number | End character offset |
score | number | Confidence score |
original | string | Original text (if not redacted) |
redacted | string | Replacement 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
| Field | Type | Required | Description |
|---|---|---|---|
input_uri | string | Yes | URI of the file to redact (S3, GCS, or HTTPS URL) |
output_uri | string | No | Destination URI for the redacted file |
pii_types | string[] | No | Specific PII types to detect (default: all) |
confidence_threshold | number | No | Minimum confidence score 0.0-1.0 (default: 0.5) |
policy_id | string | No | Apply a saved redaction policy |
Response
| Field | Type | Description |
|---|---|---|
job_id | string | Unique identifier for the async job |
status | string | Initial 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
| Type | Extensions |
|---|---|
| Text | .txt |
.pdf | |
| Images | .png, .jpg, .jpeg, .tiff, .bmp |
| Audio | .wav, .mp3, .flac, .ogg |