Skip to content
Webfold Docs
Esc
↑↓navigate↵open⌘Jpreview

Detect and redact PII in a block of text.

If PII_SVC_TOKEN is set on the server, this endpoint requires Authorization: Bearer <token>. Otherwise it is open.

POST/redact
Authorization

Optional — this operation also accepts unauthenticated requests.

AuthorizationBearer token (opaque) · header

Opaque token compared in constant time against PII_SVC_TOKEN. Only required when the server has the env var set.

Request body
requiredapplication/json
textstringrequired

The text to scan and redact.

Responses
200

Redaction succeeded.

redacted_textstringrequired

Input with every detected span replaced by [ENTITY_TYPE].

findingsFinding[]required

One entry per detected span, sorted by start, non-overlapping (overlap resolution: longer span wins).

Show properties
Array of Finding
entity_typestringrequired

Label of the detected entity. Stable identifiers from the deterministic passes — EMAIL_ADDRESS, IP_ADDRESS (IPv4/IPv6), PHONE_NUMBER, CREDIT_CARD, the Australian IDs AU_TFN / AU_ABN / AU_MEDICARE, the international IDs from pii-core::intl (US_SSN, IBAN, UK_NHS, FR_NIR, DE_STEUER_ID, IN_AADHAAR, JP_MYNUMBER, … see crates/pii-core/src/intl.rs for the full set), the credential labels PRIVATE_KEY / API_KEY / JWT / SECRET, and the identity labels PERSON / USERNAME / HOST — or any label emitted by the GLiNER-PII model.

startintegerrequired

Byte offset (inclusive) into the request text.

min 0
endintegerrequired

Byte offset (exclusive) into the request text.

min 0
scorenumber<float>required

1.0 for checksum/regex/secret/identity hits; 0.9 for IPs and shape-only IDs; ≈0.6 for NER hits.

min 0 · max 1
400

Body was not the expected { "text": "..." } JSON shape.

string
401

Bearer auth required but missing or wrong.

string
Try it
Server
Authorization (optional)
Bodyapplication/json
Request
curl -X POST 'http://127.0.0.1:7780/redact' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "text": "email [email protected], TFN 123456782, call 0412 345 678"
}'
Response
{
  "redacted_text": "email [EMAIL_ADDRESS], TFN [AU_TFN], call [PHONE_NUMBER]",
  "findings": [
    {
      "entity_type": "EMAIL_ADDRESS",
      "start": 6,
      "end": 26,
      "score": 1
    },
    {
      "entity_type": "AU_TFN",
      "start": 32,
      "end": 41,
      "score": 1
    },
    {
      "entity_type": "PHONE_NUMBER",
      "start": 48,
      "end": 60,
      "score": 0.9
    }
  ]
}