Mask with Policy
Apply a named policy to masking requests to control entity detection scope, anonymization vs pseudonymization, and custom entity wrappers.
{
"policy_name": "Anonymization-policy-1",
"mask": [
{
"value": "John Doe lives at 123 Maple Street"
}
]
}
curl -X PUT https://protecto-trial.protecto.ai/api/vault/mask \
-H "Authorization: Bearer YOUR_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"policy_name": "Anonymization-policy-1",
"mask": [
{
"value": "John Doe lives at 123 Maple Street"
}
]
}'
import requests
response = requests.put(
"https://protecto-trial.protecto.ai/api/vault/mask",
headers={
"Authorization": "Bearer YOUR_AUTH_TOKEN",
"Content-Type": "application/json"
},
json={
"policy_name": "Anonymization-policy-1",
"mask": [
{"value": "John Doe lives at 123 Maple Street"}
]
}
)
{
"data": [
{
"value": "John Doe, residing at 123 Maple Street, Apt 456, Springfield, owns a device with MAC address 00:1A:2B:3C:4D:5E, works at Acme Corp, and frequently visits https://www.example.com.",
"token_value": "<PER>VJYe 03W</PER>, residing at <ADDRESS>0ht B4P2z D1l7uy</ADDRESS>, <ADDRESS>0XV 0fg</ADDRESS>, <ADDRESS>KfybCji45d</ADDRESS>, owns a device with MAC address <IPA>7CxOK</IPA>, works at <ORG>GlltwgANru VYDveuLcod</ORG>, and frequently visits https://www.example.com.",
"toxicity_analysis": {
"toxicity": 0.0005806910921819508,
"severe_toxicity": 0.0001257194671779871,
"obscene": 0.00019038282334804535,
"threat": 0.0001222223654622212,
"insult": 0.00017815201135817915,
"identity_attack": 0.00014199208817444742
},
"individual_tokens": [
{
"value": "John Doe",
"pii_type": "PERSON",
"token": "VJYe 03W",
"prefix": "<PER>",
"suffix": "</PER>",
"start_pos": 0,
"end_pos": 8
},
{
"value": "123 Maple Street",
"pii_type": "ADDRESS",
"token": "0ht B4P2z D1l7uy",
"prefix": "<ADDRESS>",
"suffix": "</ADDRESS>",
"start_pos": 22,
"end_pos": 38
},
{
"value": "Apt 456",
"pii_type": "ADDRESS",
"token": "0XV 0fg",
"prefix": "<ADDRESS>",
"suffix": "</ADDRESS>",
"start_pos": 40,
"end_pos": 47
},
{
"value": "Springfield",
"pii_type": "ADDRESS",
"token": "KfybCji45d",
"prefix": "<ADDRESS>",
"suffix": "</ADDRESS>",
"start_pos": 49,
"end_pos": 60
},
{
"value": "00:1A:2B:3C:4D:5E",
"pii_type": "IP_ADDRESS",
"token": "7CxOK",
"prefix": "<IPA>",
"suffix": "</IPA>",
"start_pos": 93,
"end_pos": 110
},
{
"value": "Acme Corp",
"pii_type": "ORG",
"token": "GlltwgANru VYDveuLcod",
"prefix": "<ORG>",
"suffix": "</ORG>",
"start_pos": 121,
"end_pos": 130
}
],
"excluded_entities": [
{
"value": "https://www.example.com",
"pii_type": "URL",
"start_pos": 154,
"end_pos": 177
}
]
}
],
"success": true,
"error": {
"message": ""
}
}
Use this when masking behavior must follow policy-defined metadata — such as which entities to detect, anonymization vs pseudonymization rules, or custom prefix/suffix wrappers.
Endpoint
| Method | Route | Headers |
|---|---|---|
| PUT | /api/vault/mask | {"Authorization": "Bearer <AUTH_TOKEN>"} |
To get the Authkey please contact help@protecto.ai
Request body
The name of the policy to apply. The policy must exist in your namespace. If omitted, the default namespace policy applies.
List of free-form text inputs to mask under the specified policy.
Free-form text to mask.
Notes
-
policy_nameis explicitly supported for auto-detect masking. -
Policies control which entity types are detected, how values are tokenized, and whether unmasking is permitted.
-
Changing a policy updates behavior for all future requests using that policy name — without changing client code.
-
See Policies for a conceptual overview, and Policy Management for admin operations.\
Last updated 1 day ago
Built with Documentation.AI