Skip to Content

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

FieldTypeDescription
idstringUnique policy identifier
namestringHuman-readable name
descriptionstringOptional description
pii_typesstring[]PII entity types to detect
confidence_thresholdnumberMinimum confidence score (0.0-1.0)
redaction_methodstringOne of mask, hash, pseudonymize
languagestringLanguage code (e.g. en, es)
llm_detection_enabledbooleanEnable LLM-based NER in addition to Presidio
created_atstringISO 8601 timestamp
updated_atstringISO 8601 timestamp

Redaction Methods

MethodDescriptionExample Output
maskReplace with entity type label<PERSON>
hashReplace with a deterministic hasha1b2c3d4e5
pseudonymizeReplace with a reversible pseudonymPerson_7f3a

POST /policies

Create a new policy.

Request Body

FieldTypeRequiredDescription
namestringYesPolicy name
descriptionstringNoDescription
pii_typesstring[]YesPII types to detect
confidence_thresholdnumberNoConfidence threshold (default: 0.5)
redaction_methodstringNoRedaction method (default: mask)
languagestringNoLanguage code (default: en)
llm_detection_enabledbooleanNoEnable 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" }