Python SDK
The AnotiAI PII Masker SDK for Python provides easy integration for masking and unmasking personally identifiable information (PII) in your applications.
Installation
pip install anotiai-pii-masker
Quick Start
from anotiai_pii_masker import WhosePIIGuardian
# Initialize with your API key
guardian = WhosePIIGuardian(api_key="your_anotiai_api_key")
# Mask PII in text
result = guardian.mask_text("My email is john@example.com")
print(result["masked_text"]) # "My email is [REDACTED_EMAIL_1]"
# Unmask when needed
unmasked = guardian.unmask_text(result["masked_text"], result["pii_map"])
print(unmasked["unmasked_text"]) # "My email is john@example.com"
Features
- PII Detection and Masking: Automatically detect and mask emails, phone numbers, names, addresses, and more.
- Batch Processing: Process multiple texts efficiently.
- Safe Chat: Chat with LLMs while automatically masking PII.
- Streaming Support: Handle streaming responses.
- Local Fallback: Fallback to local processing if cloud fails.
Next Steps
- API Reference - Detailed method documentation
- Examples - Code examples and best practices
- Error Handling - How to handle errors
Supported PII Types
- Email, Phone Number, Person (names)
- Credit Card, SSN, Passport
- Address, URL, IP Address
- License Plate, Crypto Address
- API Key, Date/Time
- And more...