Learn how to automatically detect and redact personal names from text, documents, and data streams using Anonymization API. Protect privacy while maintaining data utility with multiple anonymization techniques.
Personal names are one of the most common types of personally identifiable information (PII) found in text data. Names can appear in countless formats and contexts, from formal documents ("Mr. John William Smith III") to casual mentions ("Hey John!").
Anonymization API uses advanced natural language processing (NLP) to detect names with high accuracy across 50+ languages. Our AI models understand context, distinguishing between personal names and other uses of the same words (like "Paris" the city vs "Paris Hilton" the person).
Before Anonymization
After Anonymization
Detect names in English, Spanish, Chinese, Arabic, and more
AI understands when a word is used as a name vs other meaning
Sub-100ms response for instant anonymization
Redacting personal names from data is critical for multiple reasons across different industries and use cases. Understanding why name redaction matters helps you implement the right approach for your specific needs.
Names are personal data that must be protected. Anonymization allows data processing without consent requirements.
Patient names are protected health information (PHI) that must be de-identified before sharing.
Consumer names are personal information subject to disclosure and deletion rights.
Student names in education records require protection.
Tip: Even when names seem innocuous, combining them with other data points can lead to re-identification. Always consider the broader context of your data when deciding what to redact.
Get started with name redaction in just a few lines of code. This example shows the simplest way to redact names from text using our API.
from anonymization import Client client = Client(api_key="your_api_key") result = client.anonymize( text="Contact John Smith at [email protected]", entity_types=["PERSON"] ) print(result.anonymized_text) # Output: Contact [PERSON] at [email protected]
const { AnonymizationClient } = require('@anonymization/api'); const client = new AnonymizationClient('your_api_key'); const result = await client.anonymize({ text: "Contact John Smith at [email protected]", entityTypes: ["PERSON"] }); console.log(result.anonymizedText); // Output: Contact [PERSON] at [email protected]
curl -X POST https://api.anonymizationapi.com/v2/anonymize \ -H "Authorization: Bearer your_api_key" \ -H "Content-Type: application/json" \ -d '{ "text": "Contact John Smith at [email protected]", "entity_types": ["PERSON"] }'
The response includes both the anonymized text and metadata about detected entities:
{
"anonymized_text": "Contact [PERSON] at [email protected]",
"entities": [
{
"type": "PERSON",
"text": "John Smith",
"start": 8,
"end": 18,
"confidence": 0.98
}
]
}
Different situations call for different anonymization approaches. Choose the technique that best balances privacy protection with data utility for your use case.
Replaces names with a placeholder tag. Best for maximum privacy when the name itself carries no analytical value.
Partially obscures names while preserving length and some characters. Useful when you need to show that a name exists without revealing it fully.
Replaces names with consistent fake names. The same input name always maps to the same pseudonym within a session, preserving referential relationships.
Replaces names with generic descriptors based on context. Useful when you need to preserve the narrative structure.
# Using different anonymization modes # Redaction (default) result = client.anonymize(text, mode="redact") # Masking result = client.anonymize(text, mode="mask") # Pseudonymization result = client.anonymize(text, mode="pseudonymize") # Generalization result = client.anonymize(text, mode="generalize")
Redaction is permanent — we don't store the original names. If you need reversibility, use pseudonymization mode and securely store the mapping table that's returned in the response.
Process multiple texts efficiently in a single API call:
texts = [
"John Smith submitted the report.",
"Maria Garcia approved the request.",
"Contact Dr. James Wilson for details."
]
results = client.batch_anonymize(
items=[{"text": t} for t in texts],
entity_types=["PERSON"]
)
for r in results:
print(r.anonymized_text)
Adjust detection sensitivity based on your accuracy requirements:
# Higher threshold = fewer false positives, may miss some names result = client.anonymize( text=text, entity_types=["PERSON"], min_confidence=0.9 ) # Lower threshold = catches more names, may have false positives result = client.anonymize( text=text, entity_types=["PERSON"], min_confidence=0.6 )
Keep first names while redacting last names, or vice versa:
# Redact only last names result = client.anonymize( text="John Smith and Sarah Johnson", entity_types=["PERSON_LAST_NAME"] ) # Output: John [LAST_NAME] and Sarah [LAST_NAME] # Redact only first names result = client.anonymize( text="John Smith and Sarah Johnson", entity_types=["PERSON_FIRST_NAME"] ) # Output: [FIRST_NAME] Smith and [FIRST_NAME] Johnson
Names alone may not be enough to protect privacy. Consider redacting names alongside emails, phone numbers, and addresses for comprehensive protection:
result = client.anonymize( text=text, entity_types=["PERSON", "EMAIL", "PHONE", "ADDRESS"] )
Our API automatically detects titles (Dr., Mr., Mrs., Prof.) associated with names. You can choose to include or exclude these in the redaction:
# Include titles in redaction result = client.anonymize( text="Dr. Sarah Johnson is available.", options={"include_titles": True} ) # Output: [PERSON] is available. # Preserve titles result = client.anonymize( text="Dr. Sarah Johnson is available.", options={"include_titles": False} ) # Output: Dr. [PERSON] is available.
Always review a sample of anonymized output before deploying to production. Check for:
If your analysis requires tracking the same person across mentions, use pseudonymization mode with a session ID to ensure consistent fake names:
result = client.anonymize( text=text, mode="pseudonymize", session_id="my-analysis-session-123" )
Some words can be both names and common nouns (like "Rose" or "Hunter"). Our AI uses context to determine the most likely interpretation, but you can adjust the confidence threshold if needed.
Names from different cultures follow different patterns. Our models are trained on names from 50+ countries and handle various formats.
Common nicknames (Bob for Robert, Liz for Elizabeth) are detected as names. For custom nicknames or aliases specific to your domain, you can add them using custom entity definitions.
Note: Very short or unusual names may occasionally be missed. If you have domain-specific names (like product codenames that look like names), consider adding them to your custom entity list.
Our name detection achieves 98.5% accuracy on standard benchmarks. Accuracy may vary depending on language, domain, and text quality. For specialized domains (legal, medical), accuracy is often higher due to structured name formats.
Yes, we support name detection in 50+ languages. The API auto-detects language by default, or you can specify the language explicitly for better accuracy with mixed-language content.
If common words are being incorrectly flagged as names, try increasing the confidence threshold. You can also provide an allow-list of terms that should never be redacted.
The API treats all names consistently regardless of whether they're real people, fictional characters, or historical figures. If you need different handling for specific categories, use custom rules.
Redaction is permanent - we don't store the original names. If you need reversibility, use pseudonymization mode and securely store the mapping table that's returned in the response.
Get your free API key and protect personal names in your data within minutes.
Get Started Free