PII Detection & Redaction
Three endpoints that together give you a full round-trip: detect entities, replace them with placeholders, then restore the originals on the way out.
/v1/pii/analyse) is useful for deciding between those paths at request time.Typical workflow
For most use cases you'll combine redact and restore:
- Call
/v1/pii/redacton the input text. Keep the mapping. - Use the redacted text with whatever you want — an external LLM, a log sink, etc.
- Call
/v1/pii/restorewith the response and the mapping to get the original values back.
If you just want to know what PII is in a piece of text without modifying it, use /v1/pii/analyse.
If you're using our chat completions, the anonymise processor does the redact/restore round-trip automatically — no manual wiring needed.
Analyse text for PII
/v1/pii/analyseDetect PII entities in text. Returns entities with type, span and confidence score.
Request
textrequiredstring- Text to analyse.
languagestring- Language code. Defaults to service default or "nl".
score_thresholdnumber- Minimum confidence (0-1). Defaults to 0.7.
service_idstring- Optional. Route to a specific PII service (see GET /v1/services). Falls back to the org’s default PII service when omitted.
{
"text": "Jan Jansen woont in Amsterdam.",
"language": "nl",
"score_threshold": 0.7
}Response · 200
has_piiboolean- True when at least one entity was found above the threshold.
entitiesarray- Entities with type, text, start, end (character offsets) and score.
entity_types_foundstring[]- Distinct entity types present in the result.
{
"has_pii": true,
"entities": [
{ "type": "PERSON", "text": "Jan Jansen", "start": 0, "end": 10, "score": 0.95 },
{ "type": "LOCATION", "text": "Amsterdam", "start": 20, "end": 29, "score": 0.92 }
],
"entity_types_found": ["PERSON", "LOCATION"]
}Redact PII
/v1/pii/redactReplace PII entities with numbered placeholders like <PERSON_1>, <LOCATION_1>. Returns the redacted text and a mapping you can use to restore.
Request
Same body as /v1/pii/analyse, including the optional service_id routing override.
{
"text": "Jan Jansen woont in Amsterdam.",
"language": "nl"
}Response · 200
redacted_textstring- Original text with entities replaced by <TYPE_N> placeholders.
mappingobject- Object mapping each placeholder back to the original value. Keep this if you want to restore later.
entities_redactednumber- Number of entities replaced.
{
"redacted_text": "<PERSON_1> woont in <LOCATION_1>.",
"mapping": {
"<PERSON_1>": "Jan Jansen",
"<LOCATION_1>": "Amsterdam"
},
"entities_redacted": 2
}Restore PII
/v1/pii/restoreApply a mapping to restore redacted placeholders back to their original values.
Request
textrequiredstring- Text containing placeholders — typically output from another service that you want to de-anonymise.
mappingrequiredobject- Placeholder → original-value map, from a prior /v1/pii/redact response.
{
"text": "<PERSON_1> woont in <LOCATION_1>.",
"mapping": {
"<PERSON_1>": "Jan Jansen",
"<LOCATION_1>": "Amsterdam"
}
}Response · 200
restored_textstring- Text with all matched placeholders replaced.
replacements_madenumber- Number of placeholders successfully replaced.
{
"restored_text": "Jan Jansen woont in Amsterdam.",
"replacements_made": 2
}