Sanitext

Detect and Redact Names in Text

Sanitext detects names in text using the FIRSTNAME and LASTNAME labels, plus PREFIX for titles like "Dr." Send text to POST /v1/detect to get entity spans with byte offsets and a confidence score, or POST /v1/redact to mask each name as [FIRSTNAME] or [LASTNAME]. Works in 30+ languages.

Names are the most common kind of PII in real text, and the hardest to match with a simple list. Sanitext detects first names, last names, and titles in context across 30+ languages, then returns precise spans or masked text through two API calls.

Name labels Sanitext returns

LabelWhat it matchesExample inputRedacted as
FIRSTNAMEGiven or first nameMaria[FIRSTNAME]
LASTNAMEFamily or last nameGarcia[LASTNAME]
PREFIXTitle or honorific before a nameDr.[PREFIX]

bash

# Detect names and get spans with byte offsets + score
curl https://api.sanitext.app/v1/detect \
  -H "Authorization: Bearer $SANITEXT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "Please email Dr. Maria Garcia about the order."}'

# Response
# {
#   "spans": [
#     { "label": "PREFIX",    "start": 13, "end": 16, "text": "Dr.",    "score": 0.97 },
#     { "label": "FIRSTNAME", "start": 17, "end": 22, "text": "Maria",  "score": 0.99 },
#     { "label": "LASTNAME",  "start": 23, "end": 29, "text": "Garcia", "score": 0.98 }
#   ]
# }

# Or redact in one call
curl https://api.sanitext.app/v1/redact \
  -H "Authorization: Bearer $SANITEXT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "Please email Dr. Maria Garcia about the order."}'

# Response
# { "text": "Please email [PREFIX] [FIRSTNAME] [LASTNAME] about the order." }

FAQ

What labels does Sanitext use for names?+

Sanitext returns FIRSTNAME for given names and LASTNAME for family names. Titles in front of a name, like Dr. or Sra., come back as PREFIX. This lets you redact a full name or just one part, depending on what you need.

Can I redact only last names and keep first names?+

Yes. Call POST /v1/detect, then act only on spans labeled LASTNAME. You replace those byte ranges yourself and leave FIRSTNAME spans untouched. The redact endpoint masks all detected names, so use detect when you want selective control.

Does name detection work in non-English text?+

Yes. Name detection runs in 30+ languages, including Spanish two-surname names, Dutch particle surnames, German, French, and non-Latin scripts. You do not set a language flag. One endpoint reads mixed-language text as it comes.

Will it catch every name?+

No tool catches 100%. Names that are also common words, rare spellings, or names without surrounding context can be missed or over-flagged. Use the per-span score to set a threshold and add review for high-risk text. Sanitext is a redaction aid, not an anonymization guarantee.

Redact names in 60 seconds

Sign up, grab an API key, and curl your first text. The free tier gives you 300K characters with no card. See plans on /pricing or test names live in /playground.

Get your free API key