Skip to main content
PasteGuard detects PII with a small open-source service that pairs a deterministic regex/checksum layer with a semantic backend. Detection is language-agnostic: the semantic model finds names and places in mixed-language text — for example, an Italian name and city in a German letter — and structured identifiers (IBAN, credit card, email, IP) are matched by format or checksum, not by language.

How it works

  • Deterministic layer — regex candidates validated by checksum/format (python-stdnum, phonenumbers). Owns the structured identifiers; every match is validated, not guessed, and scores 1.0.
  • Semantic layer — a loaded backend for names, locations, and street addresses. GLiNER is currently the only enabled backend.
The detector speaks the /analyze HTTP contract, is configured through the detector_url setting, and runs as a separate service (see detector/). Backend selection does not change the deterministic layer or response contract.

Supported Entities

Names and locations use the multilingual model. IBAN, credit card, email, and IP work internationally. Phone numbers are + international-only by default; set phone_regions for local formats. VAT_CODE requires a country prefix and is validated with python-stdnum.

Languages and phone regions

Detection is multilingual and language-agnostic. PasteGuard does not auto-detect language. National-format phone numbers need country rules. Configure phone_regions only for regions your traffic uses.

Confidence Scoring

Semantic detections carry a confidence score (0.0–1.0); checksum-validated identifiers are always 1.0. The default request threshold is 0.7:
Each backend can apply its own confidence floors. See Semantic Backends and GLiNER.

Response Headers

When PII is detected: