piidetectionapi.com
Home
Solutions - Fundamentals
What Is PII Detection? NER vs Regex vs Rules Accuracy, Precision & Recall PII in Test Data
Solutions - Compliance
GDPR Personal Data HIPAA PHI Detection CCPA / CPRA PCI DSS Card Data
Solutions - AI & LLM Safety
LLM Guardrails Chatbot PII Filtering RAG Pipelines
Solutions - Data Discovery & DLP
Data Loss Prevention Log File Scanning Support Tickets Email Scanning Documents & PDFs Database Discovery ETL & Streaming Pipelines
Industries - Financial
Banking Fintech Insurance
Industries - Healthcare
Healthcare Pharma & Clinical Trials Telehealth
Industries - Public Sector & Legal
Government & FOIA Law Enforcement Law Firms & eDiscovery Education (FERPA)
Industries - Technology
SaaS Platforms Cybersecurity & IR Telecommunications Gaming & Platforms
Industries - Other
HR & Recruiting Retail & E-commerce Call Centers & BPO Real Estate Travel & Hospitality Marketing & AdTech
How-to Guides - Identity & Contact
Detect Names Detect Email Addresses Detect Phone Numbers Detect Physical Addresses Detect Dates of Birth
How-to Guides - IDs & Financial
Detect SSNs Detect Passport Numbers Detect Drivers Licenses Detect Credit Card Numbers Detect Bank Accounts & IBAN
How-to Guides - Technical & Health
Detect IP & Device IDs Detect Medical Records & PHI
Resources
Pricing API Docs Supported Entities Languages About Contact Sign In Try the Live Demo Get Started
Healthcare Solutions

PII & PHI Detection for Healthcare

Find, classify, and locate protected health information across EHR notes, discharge summaries, lab reports, and patient messages. AI-powered detection tuned to the 18 HIPAA identifiers and clinical language — with Safe Harbor de-identification as the optional next step.

HIPAA 18 Identifiers HL7 / FHIR Text 150+ entity types 60+ languages GDPR-native

Why Healthcare Needs Automated PHI Detection

Healthcare organizations generate more free-text sensitive data than almost any other industry. Roughly 80% of clinically meaningful information lives in unstructured narrative: progress notes, discharge summaries, radiology impressions, pathology reports, nursing handoffs, and the growing flood of patient portal messages. A single discharge summary can carry a patient's name, medical record number, date of birth, home address, insurance member ID, diagnoses, medications, and the names of three treating physicians — none of it sitting in a neatly labeled database column.

That sprawl is exactly what makes protected health information so hard to govern. An EHR's structured fields are access-controlled, but the same identifiers are re-typed into transcription queues, copied into research extracts, pasted into help-desk tickets, and emailed between departments. Before a hospital, health system, or digital health vendor can de-identify, minimize, or share any of this text, someone has to answer the foundational question: which spans of which documents contain PHI, and what kind?

Our PII Detection API answers it programmatically. Transformer-based NER models read clinical text in context and return every sensitive entity with its type, exact character offsets, and a confidence score — then optionally return a de-identified copy of the input in the same call via mask_mode. Detection is the foundation; Safe Harbor redaction, research release, breach scoping, and portal moderation all become downstream engineering once the entities are located.

PHI is PII plus clinical context

Under HIPAA, health information becomes PHI when it is individually identifiable — so de-identification is fundamentally an identifier detection problem. The API returns structured entities (type, matched text, start/end offsets, confidence) covering both classic PII and clinical types like MEDICAL_RECORD_NUMBER, DIAGNOSIS, and PRESCRIPTION. See the API documentation for the full contract and the entity catalog for all 150+ types.

HIPAA, HITECH, and the Healthcare Privacy Stack

Every de-identification standard, breach rule, and data-sharing agreement in healthcare ultimately depends on knowing where identifiers live

HIPAA Privacy Rule — Safe Harbor

The Safe Harbor method (§164.514(b)(2)) requires removing all 18 categories of identifiers before data stops being PHI. Sixteen of the eighteen are text-detectable entities — names, geographic subdivisions, dates, MRNs, health plan numbers, device identifiers, and more. Automated detection is the only practical way to apply Safe Harbor to millions of narrative notes. Read our HIPAA 18 identifiers guide for the full mapping.

Expert Determination Support

The alternative de-identification path (§164.514(b)(1)) relies on a statistical expert certifying that re-identification risk is very small. Experts still need an entity inventory to reason about: which quasi-identifiers survive in the text, at what frequency, with what confidence. Structured detection output — counts by entity type, offsets, confidence scores — is precisely the evidence an expert determination is built on.

HITECH & Breach Notification

When an incident touches a file share or mailbox, the Breach Notification Rule clock starts. The hardest question is scoping: which patients' identifiers were actually in the exposed text? Running detection across the affected corpus produces a defensible, per-document inventory of names, MRNs, and insurance IDs in hours instead of weeks of manual review — directly informing the four-factor risk assessment.

42 CFR Part 2, GDPR & State Laws

Substance-use-disorder records carry stricter-than-HIPAA confidentiality under 42 CFR Part 2; GDPR treats health data as a special category requiring extra safeguards; and state laws from California's CMIA to Washington's My Health My Data extend protections to consumer health data outside HIPAA. Entity-level detection lets one pipeline enforce the strictest applicable rule per document. See the GDPR PII detection guide.

Healthcare Breaches Are the Most Expensive of Any Industry

Healthcare has topped IBM's Cost of a Data Breach study for more than a decade, with average incident costs approaching $10 million — nearly double the cross-industry average. OCR enforcement adds resolution agreements and corrective action plans on top, and the HHS "wall of shame" makes every 500-plus-record breach public. The organizations that fare worst are those that cannot quickly say which records, and which identifiers, an intruder could reach.

Continuous PHI detection changes that posture. Scanning note stores, export folders, transcription queues, and log streams as a matter of routine gives privacy officers a living map of where identifiers concentrate — evidence for the HIPAA Security Rule risk analysis, ammunition for data-minimization projects, and a pre-built baseline when incident response has to move fast.

The 18 HIPAA Identifiers, Mapped to API Entity Types

Safe Harbor de-identification is a checklist — and each text-borne item on it corresponds to entity types the API detects out of the box

HIPAA Identifier Category Examples in Clinical Text API Entity Types
1. Names Patients, relatives, physicians, nurses in note signatures and narratives PERSON_NAME
2. Geographic subdivisions smaller than a state Home addresses, cities, ZIP codes in registration and social history ADDRESS, CITY, ZIP_CODE, GPS_COORDINATES
3. Dates (except year) & ages over 89 Birth dates, admission/discharge dates, procedure dates, "92-year-old" DATE_OF_BIRTH, AGE
4–6. Phone, fax, email Callback numbers in nursing notes, portal reply addresses PHONE_NUMBER, EMAIL_ADDRESS
7–10. SSN, MRN, health plan & account numbers "MRN 4482913", member ID XQV448829901, guarantor account numbers SSN, MEDICAL_RECORD_NUMBER, HEALTH_INSURANCE_ID, FINANCIAL_ACCOUNT_NUMBER
11–12. Certificate/license & vehicle identifiers Driver's license in trauma notes, license plates in EMS run sheets DRIVERS_LICENSE_NUMBER, SERIAL_NUMBER
13–16. Device IDs, URLs, IPs Pacemaker serials, telehealth session URLs, portal access IPs in logs DEVICE_ID, SERIAL_NUMBER, URL, IP_ADDRESS
17. Biometric identifiers Fingerprint or voiceprint references in security and research records BIOMETRIC_DATA
18. Any other unique identifying number or code Study IDs tied to patients, tracking codes, employer references SERIAL_NUMBER, EMPLOYMENT, custom via custom_instruction
Full-face photographs are the exception

Identifier category 17–18 also covers photographic images, which are outside the scope of text scanning. For scanned documents and faxes, run OCR first and scan the extracted text — the workflow is covered in our document and PDF PII scanning guide.

Clinical and Administrative Entities the API Detects

Purpose-built healthcare entity types, alongside the full range of general PII that appears in the same documents

MEDICAL_RECORD_NUMBER
MRNs, encounter numbers
HEALTH_INSURANCE_ID
Member & policy IDs
DIAGNOSIS
Conditions, ICD references
PRESCRIPTION
Drugs, doses, sigs
TREATMENT
Procedures, therapies
DATE_OF_BIRTH / AGE
DOBs, ages over 89
PERSON_NAME
Patients, providers, kin
ADDRESS / ZIP_CODE
Home & facility locations
BLOOD_TYPE / MEDICAL_DATA
Labs, vitals, results
SSN / NATIONAL_ID
Registration & billing
EMAIL / PHONE
Contact identifiers
BIOMETRIC_DATA / DEVICE_ID
Implants, wearables

Built for the Way Clinical Text Actually Looks

Clinical narrative defeats naive detectors. Notes are dense with abbreviations — "pt", "hx", "s/p", "c/o" — and identifiers appear in fragments: "MR# 448-291-3", "DOB 4/12/61", "per Dr. O'Neal's office". Drug names look like surnames (Allegra, Lyrica), eponymous diseases contain real names (Parkinson, Crohn), and templated headers repeat patient identifiers dozens of times per document. Regex either drowns in false positives or misses everything unformatted.

Because our models are context-aware, they distinguish "Mrs. Parkinson was seen today" from "a history of Parkinson's disease", an MRN from a lab accession number, and a physician's name in a signature block from a hospital's brand name. Every detection carries a confidence score, so you can run a strict threshold for automated Safe Harbor pipelines and a looser one for human-reviewed discovery sweeps — and use exclude_entities to keep clinically necessary content like DIAGNOSIS when only identifiers must go.

Detection also works across 60+ languages, which matters for multilingual patient messages and interpreter-mediated notes — see the supported languages list. Accuracy on your own note types is measurable: the methodology is described in our precision, recall and F1 guide.

Healthcare PHI Detection Use Cases

Where hospitals, health systems, and digital health vendors deploy the API today

1

De-Identifying Records for Research & Analytics

Research data warehouses and analytics teams need clinical narrative without patient identity. Batch-scan notes, discharge summaries, and pathology reports; keep DIAGNOSIS and TREATMENT intact while masking the 18 identifiers. Consistent mask_mode: "hash" tokens preserve patient-level linkage across documents without revealing who the patient is.

Input
Maria Gonzalez (MRN 4482913, DOB 04/12/1961) admitted 3/2 for CHF exacerbation.
Detected & Masked
[PERSON_NAME] (MRN [MEDICAL_RECORD_NUMBER], DOB [DATE_OF_BIRTH]) admitted 3/2 for CHF exacerbation.
2

Patient Portal & Secure Messaging

Patients paste anything into portal messages: their SSN, a relative's diagnosis, insurance card numbers. Scanning messages at ingestion classifies what arrived, routes Part 2-sensitive content to restricted queues, and prevents identifiers from leaking into notification emails, push previews, and support tools that were never meant to hold PHI.

Input
Hi, this is Tom Reyes, member ID XQV448829901 — my son's strep results?
Detected & Masked
Hi, this is [PERSON_NAME], member ID [HEALTH_INSURANCE_ID] — my son's strep results?
3

Medical Transcription & Ambient Scribes

Dictation and ambient AI scribes convert conversations into text that is instantly full of PHI. Scanning transcripts before they reach QA vendors, model-training pipelines, or long-term storage lets transcription services honor BAA data-minimization commitments — and lets AI scribe vendors keep raw identifiers out of prompts sent to LLM providers.

Input
Patient Robert Chen, 72, of 42 Oak Street, presents with worsening dyspnea...
Detected & Masked
Patient [PERSON_NAME], [AGE], of [ADDRESS], presents with worsening dyspnea...
4

Claims Processing & Payer Workflows

Claims attachments, appeal letters, and prior-authorization notes mix member IDs, SSNs, and clinical justification in free text. Detection classifies identifiers at intake so downstream fraud analytics, utilization review, and offshore processing partners receive only the fields their role requires — with everything else masked in place.

Input
Appeal for claim 2291: member Alice Wu, SSN 456-78-9012, denied MRI L-spine.
Detected & Masked
Appeal for claim 2291: member [PERSON_NAME], SSN [SSN], denied MRI L-spine.
5

Incident Response & Breach Scoping

After a phishing incident or misdirected export, run detection across the exposed mailbox or file share to produce a per-document inventory of names, MRNs, and insurance IDs. That inventory drives the HITECH four-factor risk assessment, the patient notification list, and the OCR report — in hours, not weeks of paralegal review.

Input
Exposed file: "clinic_schedule.xlsx — J. Smith MRN 5521098, D. Okafor MRN 5521104..."
Detected
2 PERSON_NAME + 2 MEDICAL_RECORD_NUMBER → 2 patients added to notification scope
6

Health Chatbots & LLM Guardrails

Symptom checkers, triage bots, and internal clinical copilots must not send raw patient identifiers to model providers or retain them in prompt logs. A pre-flight detection call strips PHI from utterances in milliseconds while preserving the clinical question. See our LLM guardrails guide for integration patterns.

Input
I'm Jane Doe, DOB 2/9/1984 — can I take ibuprofen with lisinopril?
Detected & Masked
I'm [PERSON_NAME], DOB [DATE_OF_BIRTH] — can I take ibuprofen with lisinopril?
18
HIPAA Identifier Categories Covered
150+
Entity Types Detected
<200ms
Typical Response Time
50k
Chars per Request

Integrate PHI Detection into Clinical Systems

One JSON endpoint. Send text, get back classified entities with offsets and confidence — plus an optional de-identified copy

cURL — Scan a Clinical Note

# Detect PHI in a progress note before it leaves the EHR boundary
curl -X POST https://piidetectionapi.com/api/moderate.php \
  -H "Content-Type: application/json" \
  -d '{
    "api_key": "YOUR_API_KEY",
    "api_type": "pii_detection",
    "text": "Pt Maria Gonzalez, MRN 4482913, DOB 04/12/1961, seen by Dr. Patel for HTN follow-up. BP improved on lisinopril 20mg. Lives at 42 Oak St, Springfield. Callback 555-201-8890.",
    "entities": ["PERSON_NAME", "MEDICAL_RECORD_NUMBER", "DATE_OF_BIRTH", "ADDRESS", "PHONE_NUMBER", "PRESCRIPTION", "DIAGNOSIS"],
    "mask_mode": "replace",
    "threshold": 0.6
  }'
# Response
{
  "detected_entities": [
    {"type": "PERSON_NAME", "text": "Maria Gonzalez", "start": 3, "end": 17, "confidence": 0.97},
    {"type": "MEDICAL_RECORD_NUMBER", "text": "4482913", "start": 23, "end": 30, "confidence": 0.95},
    {"type": "DATE_OF_BIRTH", "text": "04/12/1961", "start": 36, "end": 46, "confidence": 0.96},
    {"type": "PERSON_NAME", "text": "Dr. Patel", "start": 56, "end": 65, "confidence": 0.94},
    {"type": "DIAGNOSIS", "text": "HTN", "start": 70, "end": 73, "confidence": 0.91},
    {"type": "PRESCRIPTION", "text": "lisinopril 20mg", "start": 102, "end": 117, "confidence": 0.93},
    {"type": "ADDRESS", "text": "42 Oak St, Springfield", "start": 128, "end": 150, "confidence": 0.92},
    {"type": "PHONE_NUMBER", "text": "555-201-8890", "start": 161, "end": 173, "confidence": 0.98}
  ],
  "anonymized_text": "Pt [PERSON_NAME], MRN [MEDICAL_RECORD_NUMBER], DOB [DATE_OF_BIRTH], seen by [PERSON_NAME] for [DIAGNOSIS] follow-up. BP improved on [PRESCRIPTION]. Lives at [ADDRESS]. Callback [PHONE_NUMBER].",
  "entities_detected": 8,
  "processing_time_ms": 192,
  "mask_mode_used": "replace",
  "status": 200
}

Python — De-Identify a Batch of Records

import requests

API_URL = "https://piidetectionapi.com/api/moderate.php"

SAFE_HARBOR_KEEP_CLINICAL = {
    "api_key": "YOUR_API_KEY",
    "api_type": "pii_detection",
    # mask identifiers, keep DIAGNOSIS/TREATMENT for research value
    "exclude_entities": ["DIAGNOSIS", "TREATMENT",
                         "PRESCRIPTION", "MEDICAL_DATA"],
    "mask_mode": "hash",  # consistent tokens keep patient linkage
    "threshold": 0.7,
}

def deidentify(discharge_summaries):
    cleaned = []
    for doc_id, text in discharge_summaries:
        resp = requests.post(
            API_URL,
            json={**SAFE_HARBOR_KEEP_CLINICAL, "text": text},
            timeout=30,
        )
        resp.raise_for_status()
        data = resp.json()
        cleaned.append({
            "doc_id": doc_id,
            "text": data["anonymized_text"],
            # audit trail: counts only, never raw matches
            "entities_removed": data["entities_detected"],
        })
    return cleaned

JavaScript — Gate a Portal Message

// Node.js: scan patient portal messages before routing
async function screenPortalMessage(message) {
  const res = await fetch(
    "https://piidetectionapi.com/api/moderate.php",
    {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({
        api_key: process.env.PII_API_KEY,
        api_type: "pii_detection",
        text: message,
        entities: ["PERSON_NAME", "SSN",
                   "HEALTH_INSURANCE_ID",
                   "MEDICAL_RECORD_NUMBER",
                   "DATE_OF_BIRTH", "PHONE_NUMBER"],
        mask_mode: "replace",
        threshold: 0.6
      })
    }
  );
  const data = await res.json();

  // Policy: SSNs never belong in portal messages — alert privacy team
  const ssn = data.detected_entities
    .filter(e => e.type === "SSN");
  return {
    flagged: ssn.length > 0,
    safePreview: data.anonymized_text,  // for notification emails
    entities: data.detected_entities
  };
}
Choosing a mask mode for clinical data

"replace" keeps reviewer-readable placeholders like [MEDICAL_RECORD_NUMBER]; "redact" removes spans entirely for minimum-necessary disclosures; "hash" substitutes consistent tokens so the same patient maps to the same value across documents — essential for longitudinal research datasets. Full parameter reference in the API documentation; try all three on a sample note in the live demo.

HL7, FHIR, and the Interoperability Blind Spot

Interoperability standards structure a lot of healthcare data, but they also carry free text everywhere: HL7 v2 OBX-5 result comments and NTE segments, CDA narrative blocks, and FHIR resources like DocumentReference, DiagnosticReport.conclusion, Observation.note, and Communication.payload. Structured de-identification tools that only strip named fields leave these narrative payloads untouched — which is exactly where clinicians write the identifying details.

The integration pattern is straightforward: as messages flow through your interface engine (Mirth/NextGen Connect, Rhapsody, an Intersystems production, or a custom FHIR pipeline), extract the text-bearing fields, POST them to the API, and write back either the entity list for tagging or the anonymized_text for de-identified feeds. Character offsets make surgical replacement inside the original segment trivial, and sub-200ms latency keeps interface queues healthy.

The same approach covers CCDA exports for HIEs, FHIR bulk-data extracts feeding research environments, and event streams replicated into analytics platforms — see our guide to PII detection in ETL and streaming pipelines for Kafka and Spark patterns that apply directly to HL7 feeds.

On-Premise Deployment for Hospitals & Health Systems

Many provider organizations operate under policies — or state regulations — that prohibit PHI from leaving their network, even transiently and even under a BAA. For them, the same detection engine that powers the cloud API is available as an on-premise deployment: containerized, running entirely inside your data center or private cloud VPC, with no external calls and no data retention. The API contract is identical, so pipelines built against the cloud endpoint move to the internal endpoint by changing a URL.

For teams that can use the cloud API, requests are processed transiently over TLS, infrastructure is GDPR-native audited, and standard vendor security-review and BAA processes are supported. A common hybrid pattern: digital-health subsidiaries and research groups use the cloud endpoint for speed, while the flagship hospital runs on-premise for EHR-adjacent workloads — one codebase, two deployment targets.

Getting started is incremental. Point the API at a sample of your own notes in the live demo, measure entity-level accuracy on text you know, then get a free API key and wire a single pipeline — most teams start with portal messages or a research extract. Scale up on a usage-based plan, and contact us when you are ready to scope the on-premise architecture.

Healthcare PHI Detection FAQ

Common questions from privacy officers, clinical informatics, and health-tech engineering teams

Does detecting and masking the 18 identifiers make our data legally de-identified?

Detection is the engine of Safe Harbor de-identification, but the standard also requires that you have no actual knowledge the remaining information could identify the individual — and rare diagnoses or unusual events can still be identifying in context. Most organizations pair automated detection with a sampling-based human QA step, and use the API's entity inventory as input to an Expert Determination when they need to retain dates or geography. Our HIPAA PHI detection guide walks through both paths.

Can we keep diagnoses and medications while removing patient identity?

Yes — that is the most common research configuration. Use exclude_entities to skip DIAGNOSIS, TREATMENT, PRESCRIPTION, and MEDICAL_DATA so clinical content survives, while names, MRNs, dates of birth, and contact details are masked. The reverse also works: request only clinical entity types when you want to index what a document is about without touching identity.

How does the API handle physician names versus patient names?

Both are detected as PERSON_NAME, because HIPAA's Safe Harbor requires removing all names, not only the patient's. If your policy permits retaining provider names — common in internal quality-review workflows — use custom_instruction with natural language such as "do not flag clinician names that appear in signature blocks or after Dr. titles", and validate the behavior on your own notes in the demo.

Will you sign a BAA, and what happens to the text we send?

We support standard business associate agreement and vendor due-diligence processes. Requests are processed transiently over TLS and are not retained after the response is returned; infrastructure is GDPR-native audited. Organizations whose policies prohibit any external transmission of PHI can run the identical engine on-premise inside their own network — contact us for deployment details.

Can it process HL7 v2 messages or FHIR resources directly?

The API accepts text, so the standard pattern is to extract narrative-bearing fields — OBX-5 comments, NTE segments, CDA narrative, FHIR note and conclusion elements — in your interface engine, scan them, and write results back into the message. Because responses include exact character offsets, replacement inside the original field is lossless. Most integrations are a few dozen lines of channel code; see the API documentation for the contract.

What throughput can it sustain for a backlog of millions of notes?

Each request accepts up to 50,000 characters and typically returns in under 200ms, so parallel workers process millions of notes per day; long documents are chunked by section and results merged by offset. Historical de-identification backlogs usually run as nightly batch jobs, while portal messages and scribe transcripts are scanned inline. See pricing for volume tiers.

Related Resources

Go deeper on the identifiers and regulations that matter most in healthcare

Find Every Identifier in Your Clinical Text

Paste a de-identified sample note into the live demo and watch the API classify every entity in under a second. All 18 HIPAA identifier categories, GDPR-ready, cloud or on-premise.