Call Privacy APIs Directly
HTTP endpoints. Bearer token auth. Curl, Python, Node.js examples. Synchronous API. No SDK needed: any HTTP client works. Full REST semantics.
Base Endpoints
Base URL: https://anonym.legal/api/presidio
Auth: Authorization: Bearer YOUR_API_KEY
Text endpoints (analyze, anonymize, deanonymize, batch) take a POST with a JSON body and answer with JSON. The image endpoint takes multipart/form-data. The entity catalog is a GET.
Endpoint Reference
/analyze
Detect PII entities in text
POST /api/presidio/analyze
Authorization: Bearer KEY
Content-Type: application/json
{
"text": "My email is john@example.com and SSN is 123-45-6789",
"language": "en"
}
Response:
{
"results": [
{
"entity_type": "EMAIL_ADDRESS",
"start": 12,
"end": 28,
"score": 0.99
},
{
"entity_type": "US_SSN",
"start": 40,
"end": 51,
"score": 0.99
}
]
}
/anonymize
Redact PII from text
POST /api/presidio/anonymize
Authorization: Bearer KEY
Content-Type: application/json
{
"text": "My email is john@example.com and SSN is 123-45-6789",
"language": "en",
"analyzer_results": [
{ "entity_type": "EMAIL_ADDRESS", "start": 12, "end": 28, "score": 0.99 },
{ "entity_type": "US_SSN", "start": 40, "end": 51, "score": 0.99 }
],
"operators": {
"EMAIL_ADDRESS": { "type": "replace", "new_value": "<EMAIL>" },
"US_SSN": { "type": "replace", "new_value": "<SSN>" }
}
}
Response:
{
"text": "My email is <EMAIL> and SSN is <SSN>",
"items": [ ... ],
"tokens_charged": 2
}
/batch
Detect PII in several texts in one call
POST /api/presidio/batch
Authorization: Bearer KEY
Content-Type: application/json
{
"texts": [
"SSN: 123-45-6789",
"Email: alice@test.com"
],
"language": "en"
}
Response:
{
"results": [
{ "index": 0, "results": [ { "entity_type": "US_SSN", "start": 5, "end": 16, "score": 0.99 } ] },
{ "index": 1, "results": [ { "entity_type": "EMAIL_ADDRESS", "start": 7, "end": 21, "score": 0.99 } ] }
],
"failedIndexes": [],
"total": 2,
"language": "en",
"tokens_charged": 2
}
Maximum texts per call: 5 (Basic), 10 (Pro), 50 (Business)
/image
Detect or redact PII in a PNG or JPEG image
POST /api/presidio/image
Authorization: Bearer KEY
Content-Type: multipart/form-data
file: document.png
mode: analyze | redact
language: en
Response (mode=analyze, JSON):
{
"entities": [
{ "entity_type": "PERSON", "score": 0.95, "left": 120, "top": 80, "width": 140, "height": 24 }
],
"processing_time": 0.83,
"tokens_charged": 4
}
Response (mode=redact): the redacted image as image/png
/deanonymize
Reverse text that was anonymized with the encrypt operator
POST /api/presidio/deanonymize
Authorization: Bearer KEY
Content-Type: application/json
{
"text": "Contact ENC:base64... today",
"anonymizer_results": [
{ "entity_type": "EMAIL_ADDRESS", "start": 8, "end": 21 }
],
"deanonymizers": {
"EMAIL_ADDRESS": { "type": "decrypt", "key": "YOUR_16_24_OR_32_CHAR_KEY" }
}
}
Response:
{
"text": "Contact john@example.com today",
"items": [ ... ],
"tokens_charged": 1
}
GET /api/public/entities
List publicly shared custom entity definitions (no authentication)
GET /api/public/entities?page=1&limit=20&search=employee
Response:
{
"success": true,
"entities": [
{ "id": "...", "name": "...", "description": "...", "data": { ... } }
],
"pagination": { "page": 1, "limit": 20, "total": 1, "totalPages": 1 }
}
Code Examples
Python
import requests
response = requests.post(
'https://anonym.legal/api/presidio/analyze',
headers={
'Authorization': 'Bearer YOUR_KEY'
},
json={
'text': 'SSN: 123-45-6789',
'language': 'en'
}
)
results = response.json()['results']
Node.js (Fetch)
const response = await fetch(
'https://anonym.legal/api/presidio/analyze',
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
text: 'SSN: 123-45-6789',
language: 'en'
})
}
);
const data = await response.json();
cURL
curl -X POST \
https://anonym.legal/api/presidio/analyze \
-H 'Authorization: Bearer YOUR_KEY' \
-H 'Content-Type: application/json' \
-d '{
"text": "SSN: 123-45-6789",
"language": "en"
}'
Error Handling
401 Unauthorized
Invalid or missing API key. Check token in Authorization header.
400 Bad Request
Invalid request body. Check JSON syntax and required fields.
429 Too Many Requests
Rate limit exceeded. Wait before retrying. Check Retry-After header.
500 Server Error
Unexpected error. Retry with exponential backoff. Contact support if persistent.
503 Service Unavailable
Maintenance or temporary outage. Retry later.
504 Gateway Timeout
Request took too long. Consider batch size or file size. Contact support.
Pricing Model
Token Consumption
- Cost depends on text length and the entities found
- Analyze: 2 + 1 per 1,000 characters + 0.2 per entity type + 0.1 per finding, then ×0.5, rounded up
- Anonymize: 1 + 0.2 per operation + 0.2 per 1,000 characters + 0.1 per finding (+0.8 with encryption), then ×0.5
- Batch: same per-text rates, up to 5 / 10 / 50 texts per call (Basic / Pro / Business)
- Current rates: anonym.legal/docs/token-system
Free Tier
- 200 free tokens per 30 days (web app)
- API access from Basic (€3/month)
- Public docs access
- Community support
- No credit card required
Watch the API In Action
See PII detection and anonymization via REST API and MCP Server
Also from anonym.legal