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 "Authorization: Bearer YOUR_API_KEY" \3 -H "Content-Type: application/json" \4 -d '{5 "text" : "Max Mustermann wohnt in Berlin und seine E-Mail ist max@example.com" ,6 "language" : "de" 7 }'The anonymized text contains placeholders for detected entities.
{
"job_id": "11111111-1111-4111-8111-111111111111",
"status": "processing",
"message": "Job created. Use /api/status/{job_id} to check status.",
"zdr": false
}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), up to 100 MB |
Multipart Upload
Up to 100 MB per file
1curl -X POST https://app.anymize.ai/api/ocr \2 -H "Authorization: Bearer YOUR_API_KEY" \3 -F "file=@document.pdf" Returns a job ID. Processing runs asynchronously — check status with the Status API.
{
"job_id": "11111111-1111-4111-8111-111111111111",
"status": "processing",
"message": "Document submitted for OCR and anonymization. Use /api/status/{job_id} to check status."
}{
"error": "FILE_TOO_LARGE",
"code": "FILE_TOO_LARGE",
"maxBytes": 104857600
}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 shaped [[<Type>-<HASH>]],6where <Type> is the PII category (person, email, iban, telephone_number,7address, ...) and <HASH> is a short random code.89FORBIDDEN:10- Writing "[Name anonymisiert]" or "[anonymized]" 11- Describing WHAT the placeholder is instead of USING it12- Writing a double-bracket token that was NOT in the user's message — the hash13 is a database key, so an invented one resolves to nothing. Never copy a hash14 out of these instructions.1516REQUIRED:17- Copy each placeholder character-for-character from the user's message18- Use it inline like the real value: "Herr <placeholder> hat..." 19- Need a value the user never gave you? Use SINGLE brackets ([Name]).2021WHY: After your response, placeholders get replaced with real values.22BEFORE RESPONDING: Check that every double-bracket token also appears, character-for-character, in the user's message.Automatically injected
1curl -X POST https://app.anymize.ai/api/v1/llm-anonymous/chat/completions \2 -H "Authorization: Bearer YOUR_API_KEY" \3 -H "Content-Type: application/json" \4 -d '{5 "model" : "fountain-1 .0 " ,6 "messages" : [7 {"role" : "user" , "content" : "Schreibe eine E-Mail an Max Mustermann, max@example.com, wegen dem Termin am 15 . Januar." }8 ],9 "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": "44444444-4444-4444-8444-444444444444",
"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 "Authorization: Bearer YOUR_API_KEY" \3 -H "Content-Type: application/json" \4 -d '{5 "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": "11111111-1111-4111-8111-111111111111",
"count": 6,
"hash_pairs": [
{
"original": "Max Mustermann",
"hash": "A1B2C3",
"prefix_name": "Person",
"placeholder": "[[Person-A1B2C3]]"
},
{
"original": "Berlin",
"hash": "D4E5F6",
"prefix_name": "Location",
"placeholder": "[[Location-D4E5F6]]"
},
{
"original": "Acme GmbH",
"hash": "G7H8I9",
"prefix_name": "Organization",
"placeholder": "[[Organization-G7H8I9]]"
},
{
"original": "15.03.1990",
"hash": "J1K2L3",
"prefix_name": "Date",
"placeholder": "[[Date-J1K2L3]]"
},
{
"original": "max@example.com",
"hash": "M4N5P6",
"prefix_name": "Email",
"placeholder": "[[Email-M4N5P6]]"
},
{
"original": "+49 170 1234567",
"hash": "Q7R8S9",
"prefix_name": "Phone",
"placeholder": "[[Phone-Q7R8S9]]"
}
]
}Placeholders are categorized by type: PERSON, ADDRESS, PHONE, EMAIL, etc.
[[Person-HASH]][[Location-HASH]][[Organization-HASH]][[Date-HASH]][[Email-HASH]][[Phone-HASH]][[Address-HASH]][[IBAN-HASH]][[ID-HASH]]Zero Data Retention
1curl https://app.anymize.ai/api/status/11111111 -1111 -4111 -8111 -111111111111 /strings \2 -H "Authorization: Bearer YOUR_API_KEY" Typical scenarios where hash pairs are useful: