Policies
Policies define reusable redaction configurations. Instead of passing PII types, thresholds, and methods with every request, create a policy and reference it by ID.
Policy Object
| Field | Type | Description |
|---|---|---|
id | string | Unique policy identifier |
name | string | Human-readable name |
description | string | Optional description |
pii_types | string[] | PII entity types to detect |
confidence_threshold | number | Minimum confidence score (0.0-1.0) |
redaction_method | string | One of mask, hash, pseudonymize |
language | string | Language code (e.g. en, es) |
llm_detection_enabled | boolean | Enable LLM-based NER in addition to Presidio |
created_at | string | ISO 8601 timestamp |
updated_at | string | ISO 8601 timestamp |
Redaction Methods
| Method | Description | Example Output |
|---|---|---|
mask | Replace with entity type label | <PERSON> |
hash | Replace with a deterministic hash | a1b2c3d4e5 |
pseudonymize | Replace with a reversible pseudonym | Person_7f3a |
POST /policies
Create a new policy.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Policy name |
description | string | No | Description |
pii_types | string[] | Yes | PII types to detect |
confidence_threshold | number | No | Confidence threshold (default: 0.5) |
redaction_method | string | No | Redaction method (default: mask) |
language | string | No | Language code (default: en) |
llm_detection_enabled | boolean | No | Enable LLM detection (default: false) |
Example
curl -X POST https://api.pii-redactor.dev/api/v1/policies \
-H "X-API-Key: pk_live_abc123" \
-H "Content-Type: application/json" \
-d '{
"name": "HIPAA Compliance",
"description": "Redact all PHI for healthcare documents",
"pii_types": ["PERSON", "PHONE_NUMBER", "EMAIL_ADDRESS", "DATE_OF_BIRTH", "SSN", "ADDRESS"],
"confidence_threshold": 0.7,
"redaction_method": "mask",
"language": "en",
"llm_detection_enabled": true
}'{
"id": "pol_h1i2p3a4",
"name": "HIPAA Compliance",
"description": "Redact all PHI for healthcare documents",
"pii_types": ["PERSON", "PHONE_NUMBER", "EMAIL_ADDRESS", "DATE_OF_BIRTH", "SSN", "ADDRESS"],
"confidence_threshold": 0.7,
"redaction_method": "mask",
"language": "en",
"llm_detection_enabled": true,
"created_at": "2026-02-13T10:00:00Z",
"updated_at": "2026-02-13T10:00:00Z"
}GET /policies
List all policies for the current tenant.
Example
curl https://api.pii-redactor.dev/api/v1/policies \
-H "X-API-Key: pk_live_abc123"Returns an array of policy objects.
GET /policies/{policy_id}
Get a specific policy by ID.
Example
curl https://api.pii-redactor.dev/api/v1/policies/pol_h1i2p3a4 \
-H "X-API-Key: pk_live_abc123"Returns a single policy object.
PUT /policies/{policy_id}
Update an existing policy. All fields are optional; only provided fields are updated.
Example
curl -X PUT https://api.pii-redactor.dev/api/v1/policies/pol_h1i2p3a4 \
-H "X-API-Key: pk_live_abc123" \
-H "Content-Type: application/json" \
-d '{
"confidence_threshold": 0.8,
"llm_detection_enabled": false
}'Returns the updated policy object.
DELETE /policies/{policy_id}
Delete a policy. Jobs that previously used this policy are not affected.
Example
curl -X DELETE https://api.pii-redactor.dev/api/v1/policies/pol_h1i2p3a4 \
-H "X-API-Key: pk_live_abc123"{
"detail": "Policy deleted"
}