Sanitext

Detect and redact postal addresses with the ADDRESS label

Sanitext detects postal addresses using the ADDRESS label. POST text to /v1/detect and it returns each address as a span with byte offsets, a confidence score, and the matched text. POST to /v1/redact and each address is replaced inline with [ADDRESS]. It works across 30+ languages.

A postal address is one of the most identifying pieces of personal data in free text. Sanitext finds it with one API call and masks it for you. This page explains what the ADDRESS label catches, how the spans work, the edge cases to expect, and how it behaves across languages.

ADDRESS label at a glance

PropertyValue
LabelADDRESS
Endpoints/v1/detect and /v1/redact
Span fieldslabel, start, end (byte offsets), score, text
Redaction mask[ADDRESS]
Languages30+
ThresholdOptional, default 0.5
Data handlingNo raw-text retention; runs on our own infra

What counts as a postal address?

The ADDRESS label covers the mailing address as a single span. That means the street name and number, the unit or apartment, the city or town, the region or state, the postal code, and the country when they appear together.

Sanitext treats the whole address as one entity rather than splitting it into separate fields. So "742 Evergreen Terrace, Springfield, IL 62704" returns one ADDRESS span, not three. This keeps redaction clean and avoids leaving half an address behind.

  • —Street and house number (e.g. 221B Baker Street)
  • —Unit, suite, floor, or apartment markers
  • —City, town, region, state, or province
  • —Postal or ZIP code
  • —Country name when written with the address

How does postal address detection work?

You send raw text to POST /v1/detect with your API key. Sanitext runs the text through an open-weights model we host on our own Cloudflare infrastructure, so the text never goes to a third-party LLM.

For every address it finds, you get back a span: the label ADDRESS, the start and end byte offsets, a confidence score between 0 and 1, and the exact matched text. Byte offsets mean you can slice or highlight the address in your own copy of the string without guessing where it sits.

Set an optional threshold (default 0.5) to drop low-confidence spans. POST the same body to /v1/redact and Sanitext returns the text with each address swapped for [ADDRESS] in place.

Which address formats and edge cases are tricky?

Addresses are messy. Sanitext handles the common ones well, but you should test against your own data before production. These are the cases to watch.

  • —Partial addresses: just a city and postal code, or a street with no city, may score lower or split
  • —PO boxes and care-of lines that lack a street number
  • —Addresses inside running prose versus on their own line in a form
  • —Postal codes that look like other numbers (a UK postcode vs a product code)
  • —Country-specific order: house number before street (US) vs after (much of Europe)
  • —A standalone ZIP or postcode with no street may be missed or flagged as ADDRESS depending on context

Does it work in other languages?

Yes. The same ADDRESS label works across 30+ languages, so a German Straße, a Spanish calle, or a French rue is detected the same way as an English street.

Address conventions differ by country: postal code position, the order of street and number, and which line holds the city all change. Coverage and accuracy vary by language and format, so verify against real samples for each market you serve. See the multilingual page for the full language list.

bash

# Detect postal addresses
curl https://privacy-filter-api.hi-892.workers.dev/v1/detect \
  -H "Authorization: Bearer pf_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"Ship it to 742 Evergreen Terrace, Springfield, IL 62704."}'

# Response
# {
#   "entities": [
#     { "label": "ADDRESS", "start": 11, "end": 56,
#       "score": 0.97, "text": "742 Evergreen Terrace, Springfield, IL 62704" }
#   ],
#   "count": 1, "ms": 34
# }

# Redact the same text
curl https://privacy-filter-api.hi-892.workers.dev/v1/redact \
  -H "Authorization: Bearer pf_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"Ship it to 742 Evergreen Terrace, Springfield, IL 62704."}'

# Response
# { "redacted": "Ship it to [ADDRESS].",
#   "entities": [ ... ], "count": 1, "ms": 29 }

FAQ

Does Sanitext return one span per address or one per field?+

One span per address. The street, city, region, postal code, and country are returned together as a single ADDRESS entity with one set of byte offsets, so redaction does not leave a fragment of the address behind.

Can it detect addresses with the country-specific order?+

Yes. The model handles both the US style (number before street) and the European style (number after street), plus city and postal-code positions that vary by country. Accuracy varies by format, so test against your own data first.

Is redacting addresses with Sanitext enough for compliance?+

No. Sanitext is a redaction and data-minimization aid, not an anonymization or compliance guarantee. A postal address combined with other data can still be re-identifying. Treat output as a strong first pass and apply your own review and controls.

Will a lone postal code or city be detected?+

Sometimes. A full address scores highest. A standalone postal code or city with no street may score lower, be missed, or still be flagged as ADDRESS depending on surrounding context. Use the threshold to tune sensitivity for your data.

Redact postal addresses in 60 seconds

Sign up free for a one-time 300K characters, no card needed. Grab your API key and curl /v1/redact to mask addresses across 30+ languages. See plans on the pricing page.

Get your free API key