Detection uses GLiNER, a state-of-the-art AI model trained specifically for PII detection.Tip: Use policy="strict" for maximum detection or adjust score_threshold for your needs.
What languages are supported?
15+ languages with automatic detection:Native Support (Highest Accuracy):
import timetry: result = client.tokenize(text)except APIError as e: if e.status_code == 429: # Rate limited - wait and retry time.sleep(60) result = client.tokenize(text)
Not recommended - API keys should stay server-side.❌ Bad (API key exposed):
// Client-side code - NEVER do thisconst client = new Blindfold({ apiKey: 'sk-...' });
✅ Good (Server-side API route):
// Clientfetch('/api/protect', { method: 'POST', body: JSON.stringify({ text: userInput })});// Server (Next.js API route)import { Blindfold } from '@blindfold/sdk';export async function POST(req) { const client = new Blindfold({ apiKey: process.env.BLINDFOLD_API_KEY // Server-side only }); const { text } = await req.json(); const result = await client.tokenize(text); return Response.json(result);}
Use edge functions, serverless functions, or backend API routes.
How do I restore tokenized data?
Use the mapping returned from tokenize():
# Step 1: Tokenizeprotected = client.tokenize("John Doe, john@example.com")print(protected.text)# "< person_1>, <email_address_1>"print(protected.mapping)# {"<person_1>": "John Doe", "<email_address_1>": "john@example.com"}# Step 2: Send protected text to AIai_response = send_to_ai(protected.text)# Step 3: Detokenize AI responseoriginal = client.detokenize( text=ai_response, mapping=protected.mapping)print(original.text)# "Hello John Doe, I received your message at john@example.com"
Important:
Store mapping securely (Redis, encrypted DB, session)
Set expiration (e.g., 24 hours)
Without mapping, data cannot be restored
What's the difference between tokenize, mask, and redact?
Choose the right method for your use case:
Method
Reversible
Example
Use Case
Tokenize
✅ Yes
<person_1>
AI processing, chatbots
Mask
❌ No
***3456
Display to users
Redact
❌ No
“ (removed)
Permanent removal
Hash
❌ No
ID_a3f8b9
Analytics, matching
Encrypt
✅ Yes
gAAAAABh...
Secure storage
Synthesize
❌ No
Jane Smith (fake)
Testing, demos
Example workflows:
# AI Chatbot → Use tokenize (reversible)protected = client.tokenize(user_input)ai_response = send_to_ai(protected.text)final = client.detokenize(ai_response, protected.mapping)# Display to User → Use mask (show last 4)masked = client.mask("Card: 4532-7562-9102-3456")# "Card: ***************3456"# Audit Logs → Use redact (permanent)logged = client.redact("User SSN: 123-45-6789")# "User SSN: "# Analytics → Use hash (consistent IDs)hashed = client.hash("user@example.com")# "ID_a3f8b9c2d4e5f6g7" (always same for same input)
Does Blindfold work with all AI providers?
Yes! Blindfold is provider-agnostic. The pattern is always the same: tokenize, send to AI, detokenize.
Code examples for every major AI provider and framework
Can I use Blindfold without an API key?
Yes! All SDKs include local mode with 80+ regex-based entity types, zero dependencies, and no API key required.In local mode, no data ever leaves your infrastructure — everything runs in-process with no network calls.
from blindfold import Blindfold# No API key neededclient = Blindfold()result = client.tokenize("Contact john@example.com or call +1-555-1234")
Local mode vs Cloud API:
Local Mode
Cloud API
Entity types
80+ (regex-based)
60+ NLP + 80+ regex
API key
Not needed
Required
Data privacy
Never leaves your infrastructure
Processed in EU/US, not stored
Names & addresses
Not supported
NLP-powered detection
Compliance policies
Not available
GDPR, HIPAA, PCI DSS
Audit logs
Not available
Full audit trail
Upgrade path: When you need NLP-powered detection (names, addresses, organizations), compliance policies, or audit logs, add an API key to switch to the Cloud API.