Skip to main content

API Reference

Base URL: https://api.openanonymiser.commonground.nu Swagger UI: {BASE}/api/v1/docs OpenAPI JSON: {BASE}/api/v1/openapi.json


GET /api/v1/health

Liveness check.

curl -s {BASE}/api/v1/health

Response:

{"ping": "pong"}

POST /api/v1/analyze

Detecteer PII-entiteiten in tekst. Geeft posities, types en confidence scores terug zonder de tekst te wijzigen.

Request

VeldTypeVerplichtStandaardBeschrijving
textstringTe analyseren tekst
languagestringnlTaalcode (nl, en)
entitiesstring[]standaard setFilter op entiteittypes

Voorbeeld

curl -s -X POST {BASE}/api/v1/analyze \
-H "Content-Type: application/json" \
-d '{
"text": "Jan Jansen woont in Amsterdam. IBAN: NL91ABNA0417164300.",
"language": "nl",
"entities": ["PERSON", "LOCATION", "IBAN"]
}'

Response

{
"pii_entities": [
{"entity_type": "PERSON", "text": "Jan Jansen", "start": 0, "end": 10, "score": 0.85},
{"entity_type": "LOCATION", "text": "Amsterdam", "start": 20, "end": 29, "score": 0.85},
{"entity_type": "IBAN", "text": "NL91ABNA0417164300", "start": 37, "end": 55, "score": 0.6}
],
"text_length": 56,
"processing_time_ms": 12,
"language": "nl"
}

POST /api/v1/anonymize

Anonimiseer PII in tekst. Gebruikt Presidio's AnonymizerEngine voor vervanging.

Request

VeldTypeVerplichtStandaardBeschrijving
textstringTe anonimiseren tekst
languagestringnlTaalcode (nl, en)
entitiesstring[]standaard setFilter op entiteittypes
anonymization_strategystringreplaceZie strategies

Anonymization strategies

StrategieResultaat
replaceVervangt door <ENTITY_TYPE> (standaard)
redactVerwijdert de waarde (lege string)
hashSHA-256 hash van de originele waarde
maskMaskeert eerste 6 tekens met *

Voorbeeld

curl -s -X POST {BASE}/api/v1/anonymize \
-H "Content-Type: application/json" \
-d '{
"text": "Mail Jan op jan@example.com of bel 0612345678.",
"language": "nl",
"anonymization_strategy": "replace"
}'

Response

{
"original_text": "Mail Jan op jan@example.com of bel 0612345678.",
"anonymized_text": "Mail <PERSON> op <EMAIL> of bel <PHONE_NUMBER>.",
"entities_found": [
{"entity_type": "PERSON", "text": "Jan", "start": 5, "end": 8, "score": 0.85},
{"entity_type": "EMAIL", "text": "jan@example.com","start": 12, "end": 27, "score": 0.6},
{"entity_type": "PHONE_NUMBER", "text": "0612345678", "start": 35, "end": 45, "score": 0.6}
],
"text_length": 46,
"processing_time_ms": 11,
"anonymization_strategy": "replace"
}

Ondersteunde entiteittypes

Standaard entities

Wanneer entities niet meegegeven wordt, worden deze types gedetecteerd:

PERSON · LOCATION · ORGANIZATION · PHONE_NUMBER · EMAIL · IBAN · BSN · DATE_TIME

Alle ondersteunde types

EntiteitMethodeScoreBeschrijving
PERSONSpaCy NER0.85Persoonsamen
LOCATIONSpaCy NER0.85Plaatsnamen, landen (incl. GPE)
ORGANIZATIONSpaCy NER0.85Organisatienamen
PHONE_NUMBERPattern0.60NL mobiel en vast
EMAILPattern0.60E-mailadressen
IBANPattern0.60NL IBAN + internationaal (niet-NL)
BSNPattern0.60Burgerservicenummer (9 cijfers)
VAT_NUMBERPattern0.60BTW-nummer (NLxxxxxxxBxx)
ID_NOPattern0.55–0.60Paspoort / identiteitskaart
CASE_NOPattern0.45–0.60Zaak-/dossiernummers
DATE_TIMEPattern0.45–0.50Datumnotaties
LICENSE_PLATEPattern0.50Nederlandse kentekens
IP_ADDRESSPattern0.50IPv4-adressen
DRIVERS_LICENSEPattern0.45Rijbewijsnummer (10 cijfers)
KVK_NUMBERPattern0.45KvK-nummer (8 cijfers)

Let op: lage scores (≤ 0.50) hebben een verhoogd risico op false positives. Gebruik entities-filter om ruis te beperken. SpaCy NER kan ook false positives geven op korte/ambigue tokens.


Voorbeeld: alle entiteittypes in één call

curl -s -X POST {BASE}/api/v1/analyze \
-H "Content-Type: application/json" \
-d '{
"text": "Jan Jansen (BSN: 111222333) woont in Amsterdam. Gemeente Utrecht is zijn werkgever. Mail: jan@example.com, Tel: 0612345678. IBAN: NL91ABNA0417164300. Rijbewijs: 1234567890. Paspoort: AB1234561. KvK: 12345678. BTW: NL123456789B01. Kenteken: AB-12-CD. IP: 192.168.1.1. Zaak: Z-2023-12345. Datum: 15-03-2023.",
"language": "nl",
"entities": ["PERSON","LOCATION","ORGANIZATION","PHONE_NUMBER","EMAIL","IBAN","BSN","DATE_TIME","ID_NO","DRIVERS_LICENSE","VAT_NUMBER","KVK_NUMBER","LICENSE_PLATE","IP_ADDRESS","CASE_NO"]
}'

Verwacht resultaat (afgekorte weergave):

{
"pii_entities": [
{"entity_type": "PERSON", "text": "Jan Jansen", "score": 0.85},
{"entity_type": "LOCATION", "text": "Amsterdam", "score": 0.85},
{"entity_type": "LOCATION", "text": "Utrecht", "score": 0.85},
{"entity_type": "BSN", "text": "111222333", "score": 0.60},
{"entity_type": "EMAIL", "text": "jan@example.com", "score": 0.60},
{"entity_type": "PHONE_NUMBER", "text": "0612345678", "score": 0.60},
{"entity_type": "IBAN", "text": "NL91ABNA0417164300", "score": 0.60},
{"entity_type": "ID_NO", "text": "AB1234561", "score": 0.60},
{"entity_type": "VAT_NUMBER", "text": "NL123456789B01", "score": 0.60},
{"entity_type": "CASE_NO", "text": "Z-2023-12345", "score": 0.55},
{"entity_type": "LICENSE_PLATE","text": "AB-12-CD", "score": 0.50},
{"entity_type": "IP_ADDRESS", "text": "192.168.1.1", "score": 0.50},
{"entity_type": "DATE_TIME", "text": "15-03-2023", "score": 0.50},
{"entity_type": "DRIVERS_LICENSE","text": "1234567890", "score": 0.45},
{"entity_type": "KVK_NUMBER", "text": "12345678", "score": 0.45}
],
"text_length": 305,
"processing_time_ms": 12,
"language": "nl"
}

Troubleshooting

  • Validation Error: controleer verplichte velden en JSON-syntax.
  • "No matching recognizers": gevraagd entiteittype bestaat niet — zie tabel hierboven.
  • Geen entiteiten gevonden: probeer zonder entities filter, of controleer language.
  • Dubbele matches op zelfde span: Presidio retourneert meerdere types per span als scores verschillen. Filter op het gewenste type of gebruik een hogere score als drempel.
  • NER false positives: SpaCy NER (score 0.85) kan korte/ambigue tokens verkeerd taggen. Vergelijk met pattern-erkende waarden (lagere scores) voor verificatie.