Learn how to automatically detect and redact street addresses, cities, zip codes, and location data from text and documents. Protect personal location information while maintaining data utility for geographic analysis.
Physical addresses are critical personally identifiable information (PII) that can pinpoint where individuals live, work, or conduct business. An address can be used to locate someone physically, send unwanted communications, or combine with other data for identity theft.
Anonymization API uses advanced natural language processing combined with geographic databases to detect addresses with 98.5% accuracy across multiple countries and formats.
Before Anonymization
After Anonymization
Whether you're processing medical records, customer databases, legal documents, or survey responses, our API ensures that location information is properly redacted while preserving the data's analytical value. We support multiple anonymization techniques from complete redaction to geographic generalization that maintains regional insights.
Detect addresses in US, UK, EU, Asia, and more
Identify street, city, state, zip separately
Preserve regional data while hiding specifics
Physical addresses present significant privacy and safety risks. An address reveals where a person can be physically located, potentially exposing them to harassment, stalking, home invasion, or targeted crimes.
Combined with other information like names or schedules, addresses create serious personal safety concerns.
Geographic data smaller than a state is one of the 18 HIPAA identifiers. Street address, city, and zip code must be removed for Safe Harbor de-identification. Only the first 3 digits of zip code may be retained (if population exceeds 20,000).
Home addresses are personal data under GDPR. Processing requires lawful basis and appropriate safeguards. Location data that can identify individuals requires explicit consent.
Physical address is personal information that consumers have the right to know about, delete, and opt-out of sale.
Student addresses in education records are protected and require consent for disclosure.
Address information in credit reports requires permissible purpose for access.
Address confidentiality programs protect survivors; improper disclosure can endanger lives.
Get started with address redaction in just a few lines of code. This example demonstrates the simplest way to detect and redact physical addresses from text using our API.
from anonymization import Client client = Client(api_key="your_api_key") result = client.anonymize( text="Ship to: 456 Elm Avenue, Suite 200, Boston, MA 02101", entity_types=["ADDRESS"] ) print(result.anonymized_text) # Output: Ship to: [ADDRESS]
const { AnonymizationClient } = require('@anonymization/api'); const client = new AnonymizationClient('your_api_key'); const result = await client.anonymize({ text: "Ship to: 456 Elm Avenue, Suite 200, Boston, MA 02101", entityTypes: ["ADDRESS"] }); console.log(result.anonymizedText); // Output: Ship to: [ADDRESS]
curl -X POST https://api.anonymizationapi.com/v2/anonymize \ -H "Authorization: Bearer your_api_key" \ -H "Content-Type: application/json" \ -d '{ "text": "Ship to: 456 Elm Avenue, Suite 200, Boston, MA 02101", "entity_types": ["ADDRESS"] }'
The API response includes detailed information about the detected address and its components:
{
"anonymized_text": "Ship to: [ADDRESS]",
"entities": [
{
"type": "ADDRESS",
"text": "456 Elm Avenue, Suite 200, Boston, MA 02101",
"start": 9,
"end": 51,
"confidence": 0.97,
"metadata": {
"street": "456 Elm Avenue",
"unit": "Suite 200",
"city": "Boston",
"state": "MA",
"zip": "02101",
"country": "US"
}
}
]
}
Addresses appear in many different formats depending on country, context, and writing style. Our API recognizes and handles all common variations.
The API can detect and redact individual address components separately:
# Detect full addresses (default) result = client.anonymize(text, entity_types=["ADDRESS"]) # Detect specific components result = client.anonymize(text, entity_types=[ "STREET_ADDRESS", # Street number and name "CITY", # City/town name "STATE", # State/province "ZIP_CODE", # Postal/zip code "COUNTRY" # Country name ]) # Keep city/state, redact only street-level detail result = client.anonymize( text="Lives at 123 Oak St, Boston, MA 02101", entity_types=["STREET_ADDRESS", "ZIP_CODE"] ) # Output: Lives at [STREET_ADDRESS], Boston, MA [ZIP_CODE]
The API recognizes various special address formats:
Choose the appropriate address anonymization technique based on your privacy requirements and analytical needs.
Completely replaces the entire address with a placeholder. Maximum privacy protection, suitable for most compliance requirements.
Preserves broader geographic information while removing specific location details. Useful for regional analysis while protecting individual addresses.
Keeps only the first 3 digits of zip codes (for areas with population over 20,000), meeting HIPAA Safe Harbor requirements.
Reduces address to state level only. Provides maximum geographic generalization while maintaining basic regional classification.
Replaces with a fake but realistic-looking address. Useful for test data or when maintaining address format is important.
# Full redaction (default) result = client.anonymize(text, entity_types=["ADDRESS"], mode="redact") # Geographic generalization - keep city/state result = client.anonymize(text, entity_types=["ADDRESS"], mode="generalize", options={"address_keep": ["city", "state"]}) # HIPAA-compliant zip truncation result = client.anonymize(text, entity_types=["ADDRESS"], mode="generalize", options={"address_hipaa_zip": True}) # State-level only result = client.anonymize(text, entity_types=["ADDRESS"], mode="generalize", options={"address_keep": ["state"]}) # Pseudonymization result = client.anonymize(text, entity_types=["ADDRESS"], mode="pseudonymize")
Even partial addresses can be identifying. A street name combined with a unique first name, or a zip code combined with age and gender, may be enough to identify individuals in sparse populations. Consider your full data context when choosing anonymization levels.
HIPAA-compliant address redaction for healthcare data:
medical_records = [
"Patient John Smith, 123 Oak St, Boston MA 02101, DOB: 03/15/1980",
"Home visit scheduled at 456 Elm Ave Apt 2B, Chicago IL 60601",
"Send prescriptions to P.O. Box 789, New York, NY 10001"
]
# HIPAA Safe Harbor compliant redaction
results = client.batch_anonymize(
items=[{"text": record} for record in medical_records],
entity_types=["PERSON", "ADDRESS", "DATE_OF_BIRTH"],
options={"address_hipaa_zip": True}
)
for r in results:
print(r.anonymized_text)
Keep geographic regions while protecting specific addresses:
customer_data = """ Customer: Jane Doe Address: 789 Pine Road, Suite 100, San Francisco, CA 94102 Delivery Notes: Leave at back door """ # Keep city and state for regional analysis result = client.anonymize( text=customer_data, entity_types=["PERSON", "ADDRESS"], mode="generalize", options={"address_keep": ["city", "state"]} ) print(result.anonymized_text) # Customer: [PERSON] # Address: [STREET], San Francisco, CA # Delivery Notes: Leave at back door
Handle international addresses with country-specific formatting:
international_text = """ US Office: 100 Broadway, New York, NY 10005 UK Office: 10 Downing Street, London SW1A 2AA Germany Office: Friedrichstrasse 123, 10117 Berlin """ result = client.anonymize( text=international_text, entity_types=["ADDRESS"], options={"address_countries": ["US", "GB", "DE"]} ) print(result.anonymized_text) # US Office: [ADDRESS] # UK Office: [ADDRESS] # Germany Office: [ADDRESS]
Redact residential addresses while keeping business locations:
# Allow-list known business addresses result = client.anonymize( text="Customer at 123 Oak St, Boston. Visit us at 1 Infinite Loop, Cupertino", entity_types=["ADDRESS"], options={ "allow_list": ["1 Infinite Loop, Cupertino"] } ) print(result.anonymized_text) # Customer at [ADDRESS]. Visit us at 1 Infinite Loop, Cupertino
Even generalized address data can be identifying when combined with other fields:
# Combine address redaction with other PII for complete protection result = client.anonymize( text=text, entity_types=[ "ADDRESS", "PERSON", "DATE_OF_BIRTH", "PHONE", "EMAIL" ] ) # In sparse populations, zip code + age + gender can be identifying # Consider more aggressive generalization for sensitive datasets
Addresses may appear incomplete or spread across multiple fields:
# Detect partial addresses and components result = client.anonymize( text="Lives in 02101", # Just a zip code entity_types=["ADDRESS", "ZIP_CODE"] ) # Enable aggressive partial detection result = client.anonymize( text=text, entity_types=["ADDRESS"], options={"address_detect_partial": True} )
Enable context analysis to distinguish addresses from similarly formatted text:
# Context helps distinguish "123 Main St" from "123 main points" result = client.anonymize( text=text, entity_types=["ADDRESS"], options={"use_context": True} )
For healthcare data, ensure addresses meet Safe Harbor requirements:
HIPAA Note: Use options={"address_hipaa_zip": True} to automatically apply Safe Harbor zip code rules. This will truncate to 3 digits for high-population areas and fully redact for low-population areas.
Before production, test with addresses in various formats you expect to encounter:
Our address detection achieves 98.5% accuracy on benchmark datasets covering US and international formats. Accuracy is highest for complete, well-formatted addresses and may be lower for partial addresses or unusual formats. Context-aware detection significantly reduces false positives.
Yes, the API supports address detection in multiple languages and scripts. For non-Latin scripts (Chinese, Arabic, Japanese), specify the language for better accuracy: options={"language": "ja"}.
The API handles multi-line addresses by default. It recognizes address components that span line breaks and treats them as a single address entity.
GPS coordinates (latitude/longitude) can be detected with: entity_types=["ADDRESS", "COORDINATES"]. Coordinates are often more precise than street addresses and should be treated as sensitive location data.
Landmark names (Empire State Building, Eiffel Tower) are detected when they appear as addresses or locations. Pure landmark mentions without address context can be detected with: entity_types=["LOCATION"].
If you need to verify addresses before redacting (e.g., for shipping validation), process the address first, then redact for storage. The API can return parsed address components without redacting, which you can use for validation.
ADDRESS refers to specific postal addresses (123 Main St). LOCATION includes broader geographic references (downtown Boston, near Central Park). For maximum protection, enable both: entity_types=["ADDRESS", "LOCATION"].
Protect location data with 98.5% accurate address detection. Support for 50+ countries and HIPAA-compliant options.
Get Started Free