API Implementation Guide
Complete step-by-step guide for integrating anonym.today API into your applications. Bearer token authentication, code examples, and live testing.
Authentication
Bearer Token (JWT)
Base URL
https://anonym.today
Entity Types
256+ supported
Languages
27 supported
Step-by-Step Implementation
Follow these steps to integrate anonym.today API into your application.
Create an Account
Sign up for an anonym.today account to get access to the API.
Details
- Go to https://anonym.today/auth/signup
- Create account with email or OAuth provider
- Verify your email address
- Choose a subscription plan (Free tier available)
Generate API Token
Create a persistent API token for authentication.
Details
- Go to Settings in the app sidebar
- Navigate to Security section
- Click "Manage" next to API Keys
- Click "Generate API Token"
- Copy the token immediately (shown once)
- Store in environment variable or secure vault
Code Example
// Navigate to Settings > Security > API Keys
// Click "Generate API Token"
// Copy and securely store your token
// Token format (JWT):
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ1c2VyX2lkIiwiZW1haWwiOiJ5b3VyQGVtYWlsLmNvbSIsImlhdCI6MTcwNDAwMDAwMCwidHlwZSI6ImFwaV90b2tlbiJ9.signatureConfigure Authentication
Set up Bearer token authentication in your application.
Details
- Never hardcode tokens in source code
- Use environment variables for token storage
- Token is passed via Authorization header
- Format: "Bearer YOUR_TOKEN"
Code Example
// Environment variable setup
ANONYM_API_TOKEN=your_jwt_token_here
ANONYM_API_BASE_URL=https://anonym.today
// JavaScript/TypeScript Configuration
const config = {
baseUrl: process.env.ANONYM_API_BASE_URL || 'https://anonym.today',
headers: {
'Authorization': `Bearer ${process.env.ANONYM_API_TOKEN}`,
'Content-Type': 'application/json',
},
};Make Your First API Call
Test the integration with a simple analyze request.
Details
- Use POST method for analyze endpoint
- Specify language code (en, de, fr, etc.)
- Optionally filter by entity types
- Response includes detected entities with positions
Code Example
// Analyze text for PII entities
const response = await fetch('https://anonym.today/api/presidio/analyze', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
text: 'John Smith lives at 123 Main Street, Berlin.',
language: 'en',
entities: ['PERSON', 'LOCATION', 'EMAIL_ADDRESS'],
}),
});
const data = await response.json();
console.log(data.results);
// Returns: [{ entity_type: 'PERSON', text: 'John Smith', ... }, ...]Anonymize Detected Entities
Apply protection methods to the detected PII.
Details
- 5 operator types: replace, mask, redact, hash, encrypt
- Configure per entity type
- Encrypt operator requires encryption key
- Response includes anonymized text and operation details
Code Example
// Anonymize text with operators
const response = await fetch('https://anonym.today/api/presidio/anonymize', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
text: 'John Smith lives at 123 Main Street, Berlin.',
language: 'en',
operators: {
PERSON: { type: 'replace', new_value: '[REDACTED]' },
LOCATION: { type: 'mask', masking_char: '*', chars_to_mask: 5 },
},
}),
});
const data = await response.json();
console.log(data.text);
// Returns: "[REDACTED] lives at ****Main Street, *****."Complete Client Libraries
Copy-paste ready client implementations for your language.
// anonym-client.js - Full JavaScript/TypeScript Integration
class AnonymClient {
constructor(apiToken, baseUrl = 'https://anonym.today') {
this.baseUrl = baseUrl;
this.headers = {
'Authorization': `Bearer ${apiToken}`,
'Content-Type': 'application/json',
};
}
async analyze(text, language = 'en', entities = null) {
const response = await fetch(`${this.baseUrl}/api/presidio/analyze`, {
method: 'POST',
headers: this.headers,
body: JSON.stringify({
text,
language,
...(entities && { entities }),
}),
});
if (!response.ok) {
throw new Error(`API Error: ${response.status}`);
}
return response.json();
}
async anonymize(text, language, operators) {
const response = await fetch(`${this.baseUrl}/api/presidio/anonymize`, {
method: 'POST',
headers: this.headers,
body: JSON.stringify({ text, language, operators }),
});
if (!response.ok) {
throw new Error(`API Error: ${response.status}`);
}
return response.json();
}
async getProfile() {
const response = await fetch(`${this.baseUrl}/api/user/profile`, {
headers: this.headers,
});
return response.json();
}
async getTokenBalance() {
const response = await fetch(`${this.baseUrl}/api/tokens/balance`, {
headers: this.headers,
});
return response.json();
}
}
// Usage
const client = new AnonymClient(process.env.ANONYM_API_TOKEN);
const result = await client.analyze(
'Contact John at john@example.com',
'en',
['PERSON', 'EMAIL_ADDRESS']
);
console.log(result);API Endpoints Reference
Quick reference for all available API endpoints.
| Method | Endpoint | Description | Auth | Rate Limit |
|---|---|---|---|---|
| POST | /api/presidio/analyze | Detect PII entities in text | Bearer Token | Based on plan |
| POST | /api/presidio/anonymize | Anonymize detected entities | Bearer Token | Based on plan |
| POST | /api/presidio/deanonymize | Restore encrypted entities | Bearer Token | Based on plan |
| GET | /api/user/profile | Get user profile info | Bearer Token | 100/min |
| GET | /api/tokens/balance | Get token balance | Bearer Token | 100/min |
| GET | /api/user/api-token | Get API token info | Session Only | 10/min |
| POST | /api/entities | Create custom entity | Bearer Token | 50/min |
| GET | /api/presets | List saved presets | Bearer Token | 100/min |
Live API Testing
Test the API directly from your browser. Enter your token and try it out.
Virtual Function Test
Test the API directly from this page. Enter your API token and try the endpoints.
Roadmap & Upcoming Features
Features we're working on for future releases.
OAuth 2.0 Flow
Planned- OAuth 2.0 Authorization Code flow
- Client ID and Secret management
- OAuth scopes for granular permissions
- Refresh token support
- OAuth consent screen customization
Webhook Integration
Planned- Webhook endpoints for async notifications
- Batch job completion webhooks
- Usage threshold alerts
- Webhook signature verification
SDK Libraries
In Development- Official npm package (@anonym.today/client)
- Official Python package (anonym-today)
- Official Go package
- Official .NET package
Advanced Features
Planned- Streaming API for large documents
- Async batch processing API
- Multi-tenant organization support
- Custom model training endpoints
Ready to Integrate?
Get started with 100 free tokens. No credit card required.