Anonymization
Anonymize text and files, anonymous LLM chat with automatic de-anonymization.
Anonymize text and files, anonymous LLM chat with automatic de-anonymization.
Automatically mask personally identifiable information (PII) in any text.
/api/anonymizeSend the text to anonymize in the request body.
| Parameter | Type | Description |
|---|---|---|
textrequired | string | The text to be anonymized. |
language | string | Language of the text (e.g. de, en). Improves detection accuracy. |
1curl -X POST https://app.anymize.ai/api/anonymize \2 -H #86efac">"Authorization: Bearer YOUR_API_KEY" \3 -H #86efac">"Content-Type: application/json" \4 -d '{5 #86efac">"text": "Max Mustermann wohnt in Berlin und seine E-Mail ist max@example.com",6 #86efac">"language": "de"7 }'The anonymized text contains placeholders for detected entities.
{
"job_id": "job_abc123def456",
"status": "processing",
"message": "Anonymization job created"
}Need to anonymize files?
Upload documents or images for OCR processing and automatic anonymization.
/api/ocrThe following file formats are supported for OCR processing.
| Parameter | Type | Description |
|---|---|---|
filerequired | File | Document or image file (PDF, PNG, JPG, TIFF) |
language | string | Language for OCR and anonymization (de, en, fr, es, it) |
Multipart Upload
1curl -X POST https://app.anymize.ai/api/ocr \2 -H #86efac">"Authorization: Bearer YOUR_API_KEY" \3 -F #86efac">"file=@document.pdf" \4 -F #86efac">"language=de"Returns a job ID. Processing runs asynchronously — check status with the Status API.
{
"job_id": "job_ocr789xyz012",
"status": "processing",
"message": "OCR and anonymization job created"
}File anonymization runs through a 3-step pipeline.
Check processing status
Combine chat and anonymization in a single request — your data is masked before reaching the model.
/api/v1/llm-anonymous/chat/completionshttps://app.anymize.ai/api/v1/llm-anonymousHere's how anonymous chat processes your request:
Higher Latency
Same parameters as Chat Completions plus anonymization options.
| Parameter | Type | Description |
|---|---|---|
modelrequired | string | Model ID — all chat models are supported. |
messagesrequired | array | Array of messages (system, user, assistant). |
language | string | Text language for better PII detection. |
stream | boolean | Enable SSE streaming. |
In anonymous chat, personal data is automatically replaced with placeholders in the format [[Type-HASH]]. For de-anonymization to work, the model must preserve these placeholders exactly.
Wrong
Dear [name redacted], I am writing to you regarding...
Correct
Dear Mr. [[Person-ABC123]], I am writing to you regarding...
Without the right system prompt, the model often writes 'an anonymized person' or '[name redacted]' instead of using the placeholder [[Person-ABC123]]. This makes de-anonymization impossible.
The anonymous endpoint automatically appends the following part to your system prompt. It is added to your own system prompt, not replacing it:
1## CRITICAL RULE: ANONYMIZATION PLACEHOLDERS23THIS IS THE MOST IMPORTANT RULE. VIOLATING IT MAKES YOUR RESPONSE USELESS.45The user's messages contain anonymized placeholders in format [[Type-HASH]]:6- [[Person-QSEZB6]] = a person's name7- [[email-BE2966]] = an email address8- [[iban-5B7BCF]] = a bank account9- [[telephone_number-F29732]] = a phone number10- [[Adress-NT9DQE]] = an address1112FORBIDDEN:13- Writing "[Name anonymisiert]" or "[anonymized]"14- Describing WHAT the placeholder is instead of USING it15- Inventing NEW [[Type-HASH]] placeholders1617REQUIRED:18- Copy [[Person-QSEZB6]] exactly as-is19- Write "Herr [[Person-QSEZB6]] hat..." (use it like a real name)2021WHY: After your response, placeholders get replaced with real values.22BEFORE RESPONDING: Check that every [[Placeholder-HASH]] appears exactly as written.Automatically injected
1curl -X POST https://app.anymize.ai/api/v1/llm-anonymous/chat/completions \2 -H #86efac">"Authorization: Bearer YOUR_API_KEY" \3 -H #86efac">"Content-Type: application/json" \4 -d '{5 #86efac">"model": "fountain-1.0",6 #86efac">"messages": [7 {#86efac">"role": "user", "content": "Schreibe eine E-Mail an Max Mustermann, max@example.com, wegen dem Termin am 15. Januar."}8 ],9 #86efac">"language": "de",10 }'The response contains the de-anonymized text and metadata.
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"model": "fountain-1.0",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Sehr geehrter Herr Max Mustermann,\n\nich schreibe Ihnen bezüglich unseres Termins am 15. Januar..."
},
"finish_reason": "stop"
}
],
"_anymize": {
"anonymized": true,
"job_id": "job_anon_456def",
"language": "de"
}
}Response header
Zero Data Retention
Anonymous chat consumes credits for two services:
Replace placeholders with original data — reverse the anonymization.
/api/deanonymizeSend the anonymized text and job ID to restore the original data.
| Parameter | Type | Description |
|---|---|---|
textrequired | string | The text with placeholders to de-anonymize. |
Placeholder format
1curl -X POST https://app.anymize.ai/api/deanonymize \2 -H #86efac">"Authorization: Bearer YOUR_API_KEY" \3 -H #86efac">"Content-Type: application/json" \4 -d '{5 #86efac">"text": "Sehr geehrter [[Person-QSEZB6]], Ihre Adresse [[Adress-NT9DQE]] wurde aktualisiert."6 }'The de-anonymized text contains the original data in place of placeholders.
{
"text": "Sehr geehrter Max Mustermann, Ihre Adresse Berliner Str. 42, 10115 Berlin wurde aktualisiert.",
"replacements": 2
}Zero Data Retention
Common de-anonymization errors and what they mean.
{
"error": {
"message": "No hash pairs found for the given placeholders",
"type": "not_found_error",
"code": "hash_pairs_not_found"
}
}Retrieve the mapping table between placeholders and original data.
/api/status/{jobId}/strings| Parameter | Type | Description |
|---|---|---|
jobIdrequired | string | The job ID of the anonymization job. |
The response contains an array of pairs with placeholder and original value.
{
"job_id": "job_abc123def456",
"hash_pairs": [
{
"original": "Max Mustermann",
"hash": "[PERSON-1]",
"prefix_name": "Person",
"placeholder": "PERSON-1"
},
{
"original": "Berlin",
"hash": "[LOCATION-1]",
"prefix_name": "Location",
"placeholder": "LOCATION-1"
},
{
"original": "Acme GmbH",
"hash": "[ORGANIZATION-1]",
"prefix_name": "Organization",
"placeholder": "ORGANIZATION-1"
},
{
"original": "15.03.1990",
"hash": "[DATE-1]",
"prefix_name": "Date",
"placeholder": "DATE-1"
},
{
"original": "max@example.com",
"hash": "[EMAIL-1]",
"prefix_name": "Email",
"placeholder": "EMAIL-1"
},
{
"original": "+49 170 1234567",
"hash": "[PHONE-1]",
"prefix_name": "Phone",
"placeholder": "PHONE-1"
}
],
"total": 6
}Placeholders are categorized by type: PERSON, ADDRESS, PHONE, EMAIL, etc.
[PERSON-N][LOCATION-N][ORGANIZATION-N][DATE-N][EMAIL-N][PHONE-N][ADDRESS-N][IBAN-N][ID-N]Zero Data Retention
1curl https://app.anymize.ai/api/status/job_abc123def456/strings \2 -H #86efac">"Authorization: Bearer YOUR_API_KEY"Typical scenarios where hash pairs are useful: