Appearance
Text Anonymization
Synchronous endpoint for anonymizing plain text.
Endpoint
POST /anonymize/textTry it live (desktop). The API Playground docked on the right is already set to this endpoint — enter your API key once and hit Send. Collapse it with the arrow; reopen it from the Playground tab on the edge.
Request
Headers
| Header | Value |
|---|---|
Content-Type | application/json |
Authorization | Bearer <token> (hosted demo only) |
Body
json
{
"text": "My name is John Doe and my email is john@example.com. The building is nearby.",
"entities": "PERSON_NAME,EMAIL_ADDRESS",
"start_index": 0,
"custom_entities": [
{"original": "building", "placeholder": "SECRET"}
]
}Parameters
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
text | string | Yes | — | Text content to anonymize |
entities | string | No | all | Comma-separated entity type names |
start_index | int | No | 0 | Starting index for placeholder numbering |
custom_entities | array | No | [] | Custom entity definitions |
Response
200 OK
json
{
"anonymized_text": "My name is [PERSON_NAME_1] and my email is [EMAIL_ADDRESS_2]. The [SECRET_3] is nearby.",
"map": {
"John Doe": "[PERSON_NAME_1]",
"john@example.com": "[EMAIL_ADDRESS_2]",
"building": "[SECRET_3]"
},
"entities": 3
}Response Fields
| Field | Type | Description |
|---|---|---|
anonymized_text | string | Text with entities replaced by placeholders |
map | object | Original value to placeholder mapping |
entities | int | Total count of entities detected and replaced |
Examples
Default (All Entities)
json
{
"text": "Contact Sarah at sarah@company.com or call +1-555-1234."
}Response:
json
{
"anonymized_text": "Contact [PERSON_NAME_1] at [EMAIL_ADDRESS_2] or call [PHONE_NUMBER_3].",
"map": {
"Sarah": "[PERSON_NAME_1]",
"sarah@company.com": "[EMAIL_ADDRESS_2]",
"+1-555-1234": "[PHONE_NUMBER_3]"
},
"entities": 3
}Entity Filtering
json
{
"text": "John lives in New York and works at Google.",
"entities": "ORGANIZATION"
}Response:
json
{
"anonymized_text": "John lives in New York and works at [ORGANIZATION_1].",
"map": {
"Google": "[ORGANIZATION_1]"
},
"entities": 1
}Custom Start Index
json
{
"text": "Email Jane at jane@co.com.",
"start_index": 10
}Response:
json
{
"anonymized_text": "Email [PERSON_NAME_11] at [EMAIL_ADDRESS_12].",
"map": {
"Jane": "[PERSON_NAME_11]",
"jane@co.com": "[EMAIL_ADDRESS_12]"
},
"entities": 2
}Custom Entities Only
json
{
"text": "The launch of Operation Skyfall is June 1st.",
"custom_entities": [
{"original": "Operation Skyfall", "placeholder": "PROJECT"}
]
}Response:
json
{
"anonymized_text": "The launch of [PROJECT_1] is [DATE_2].",
"map": {
"Operation Skyfall": "[PROJECT_1]",
"June 1st": "[DATE_2]"
},
"entities": 2
}Error: Missing Required Field
400 Bad Request:
json
{
"detail": "text field is required"
}