PII Removal
API reference for the PII removal endpoints
PII Removal
Detect and redact PII from documents using AI-powered analysis.
Enterprise plans. A request from another plan is refused with
402naming the plan that has it — the same body as every plan-gated feature (documented under the status codes in the OCR reference).
POST /v1/pii/redact
Upload a document for PII detection and redaction.
Endpoint
POST https://api.deepread.tech/v1/pii/redact
Authentication
Include your API key in the X-API-Key header:
X-API-Key: YOUR_API_KEY
Request
Headers
| Header | Required | Description |
|---|---|---|
X-API-Key | Yes | Your API key |
Content-Type | Yes | multipart/form-data |
Request Body (Multipart)
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
file | file | Yes | - | Document to redact (PDF, PNG, JPEG, or TXT) |
redaction_style | string | No | black_bar | Redaction style: black_bar |
webhook_url | string | No | - | HTTPS URL to receive job completion notifications |
language | string | No | en | Document language: en, zh, es, hi, ar |
Example Request
curl -X POST https://api.deepread.tech/v1/pii/redact \ -H "X-API-Key: $DEEPREAD_API_KEY" \ -F "file=@contract.pdf" \ -F "redaction_style=black_bar" \ -F "language=en" \ -F "webhook_url=https://your-app.com/webhooks/pii"Response
Success Response (200 OK)
{ "id": "550e8400-e29b-41d4-a716-446655440000", "status": "queued" }
Response Fields
| Field | Type | Description |
|---|---|---|
id | string | Unique job identifier (UUID) |
status | string | Initial job status (queued) |
Status Codes
| Code | Description |
|---|---|
200 | Job created successfully |
400 | Invalid input (unsupported file type, a file whose content does not match its declared type, invalid parameters) |
401 | Invalid or missing API key |
402 | PII redaction is not on the plan, or the credits do not cover the job; the body names what is needed |
413 | File over the size limit or the 500 MB hard maximum |
429 | Submissions per minute or pages in flight exceeded; Retry-After says when to try again |
500 | Internal server error |
503 | The API key could not be checked because our database did not answer; retry after Retry-After (5 s). A bad key is 401 |
GET /v1/pii/{job_id}
Retrieve the status and results of a PII redaction job.
Endpoint
GET https://api.deepread.tech/v1/pii/{job_id}
Authentication
X-API-Key: YOUR_API_KEY
Path Parameters
| Parameter | Type | Description |
|---|---|---|
job_id | UUID | The job ID returned from POST /v1/pii/redact |
Example Request
curl https://api.deepread.tech/v1/pii/550e8400-e29b-41d4-a716-446655440000 \ -H "X-API-Key: $DEEPREAD_API_KEY"Response
Success Response (200 OK)
{ "id": "550e8400-e29b-41d4-a716-446655440000", "status": "completed", "progress_percent": 100, "redacted_file_url": "https://storage.deepread.tech/redacted/abc123.pdf", "report": { "id": "550e8400-e29b-41d4-a716-446655440000", "page_count": 3, "processing_time_ms": 4200, "total_redactions": 8, "redaction_policy": "black_bar", "confidence_threshold_used": 0.85, "pii_detected": { "EMAIL": { "count": 3, "pages": [1, 2], "confidence_avg": 0.97, "confidence_min": 0.91 }, "PHONE": { "count": 2, "pages": [1], "confidence_avg": 0.94, "confidence_min": 0.89 }, "SSN": { "count": 1, "pages": [2], "confidence_avg": 0.99, "confidence_min": 0.99 }, "NAME": { "count": 2, "pages": [1, 3], "confidence_avg": 0.91, "confidence_min": 0.86 } } } }
Response Fields
| Field | Type | Description |
|---|---|---|
id | string | Job identifier |
status | string | queued, processing, completed, or failed |
progress_percent | integer | Processing progress (0-100) |
redacted_file_url | string | Signed URL to download redacted document (when completed) |
report | object | Detection report (when completed) |
error | object | Error details (when failed) |
Report Fields
| Field | Type | Description |
|---|---|---|
id | string | Job identifier |
page_count | integer | Number of pages processed |
processing_time_ms | integer | Processing time in milliseconds |
total_redactions | integer | Total number of PII instances redacted |
redaction_policy | string | Redaction style used |
confidence_threshold_used | number | Confidence threshold applied |
pii_detected | object | Detections grouped by PII type |
PII Detection Summary (per type)
| Field | Type | Description |
|---|---|---|
count | integer | Number of instances detected |
pages | array | Page numbers where detected |
confidence_avg | number | Average confidence score |
confidence_min | number | Minimum confidence score |
Status Codes
| Code | Description |
|---|---|
200 | Job found |
400 | Invalid job ID format |
401 | Invalid or missing API key |
404 | Job not found |
429 | Polling limit for the plan (Free 20 a minute, Standard 60, Enterprise 150); Retry-After says when to try again |
Webhooks
When you provide a webhook_url, DeepRead sends a POST request when the job completes:
{ "job_id": "550e8400-e29b-41d4-a716-446655440000", "status": "completed", "redacted_file_url": "https://storage.deepread.tech/redacted/abc123.pdf", "report": { "page_count": 3, "total_redactions": 8, "pii_detected": { ... } } }
For failed jobs:
{ "job_id": "550e8400-e29b-41d4-a716-446655440000", "status": "failed", "error": { "code": "DOCUMENT_CORRUPTED", "message": "Unable to parse the uploaded document" } }
Webhook URLs must use HTTPS. Private IP addresses, localhost, and loopback addresses are rejected.
PII Types
The following PII types may appear as keys in the pii_detected report object:
| Type | Description |
|---|---|
NAME | Personal names |
EMAIL | Email addresses |
PHONE | Phone numbers |
SSN | Social Security Numbers, national IDs |
CREDIT_CARD | Credit/debit card numbers, payment references |
ADDRESS | Physical addresses |
DATE_OF_BIRTH | Dates of birth |
PASSPORT_NUMBER | Passport numbers |
DRIVER_LICENSE | Driver's license, vehicle registration numbers |
BANK_ACCOUNT | Bank account numbers, routing numbers |
IBAN | International Bank Account Numbers |
IP_ADDRESS | IP addresses (IPv4/IPv6) |
URL | Web addresses |
MEDICAL_RECORD | Medical record numbers, patient IDs |
Supported File Types
| MIME Type | Extension | Description |
|---|---|---|
application/pdf | PDF documents | |
image/png | .png | PNG images |
image/jpeg | .jpg, .jpeg | JPEG images |
text/plain | .txt | Plain text files |
Rate Limits
Limits are per plan. Past a limit the request is refused with 429 and a Retry-After header saying when to try again.
| Plan | POST /v1/pii/redact per minute | GET /v1/pii/{job_id} per minute |
|---|---|---|
| Free | 10 | 20 |
| Standard | 100 | 60 |
| Enterprise | 500 | 150 |
A redaction job's pages count towards the account's pages in flight (16 on Free, 200 on Standard, 500 on Enterprise), shared with OCR and form-fill jobs. No document over 2,000 pages or 500 MB is accepted on any plan (413).
Response headers include:
X-RateLimit-Limit: Maximum requests per periodX-RateLimit-Remaining: Remaining requestsX-RateLimit-Reset: Unix timestamp when limit resets
Error Codes
| Code | Description |
|---|---|
INVALID_REQUEST | Missing or invalid parameters |
UNSUPPORTED_FORMAT | File type not supported |
DOCUMENT_CORRUPTED | Unable to parse the document |
PASSWORD_PROTECTED | Document is password protected |
EMPTY_DOCUMENT | Uploaded file is empty |
FILE_TOO_LARGE | File exceeds size limit |
UNAUTHORIZED | Invalid or missing API key |
RATE_LIMITED | Too many requests |
INTERNAL_ERROR | Server error |