Users can now define prefixes and suffixes for entities in their policies.
The policy name should be used during masking/unmasking to generate tokens with the specified prefix and suffix.
Prerequisite: Create the Policy and Update the Prefix and suffix in the Metadata API
Mask API #
METHOD: PUT
Route: /api/vault/mask
For authentication, include the following token in the request headers:
Headers: {“Authorization”: “Bearer <AUTH_TOKEN>”}
Request Payload: #
Here’s an example of a request payload
{
"policy_name": "Add Prefix Suffix Policy",
"mask":[{"value": "Sarah Johnson recently moved to 456 Elm Avenue, Boston, and you can reach her at (555) 987-6543"}]}
Response:
{
"data": [
{
"value": "Sarah Johnson recently moved to 456 Elm Avenue, Boston, and you can reach her at (555) 987-6543",
"token_value": "{Person Name cn1AU PevBCff} recently moved to <ADDRESS>YwvEh WZIN6 nES7LM, y8Tdm5</ADDRESS>, and you can reach her at {Personal PhoneNumber (14720) 09570-47785}",
"toxicity_analysis": {
"toxicity": 0.0006517292349599302,
"severe_toxicity": 0.00011591568909352645,
"obscene": 0.00017911863687913865,
"threat": 0.00012024409079458565,
"insult": 0.00017571910575497895,
"identity_attack": 0.00013655266957357526
},
"individual_tokens": [
{
"value": "Sarah Johnson",
"pii_type": "PERSON",
"token": "cn1AU PevBCff",
"prefix": "{Person Name ",
"suffix": "}",
"start_pos": 0,
"end_pos": 13
},
{
"value": "456 Elm Avenue, Boston",
"pii_type": "ADDRESS",
"token": "YwvEh WZIN6 nES7LM, y8Tdm5",
"prefix": "<ADDRESS>",
"suffix": "</ADDRESS>",
"start_pos": 32,
"end_pos": 54
},
{
"value": "(555) 987-6543",
"pii_type": "PHONE_NUMBER",
"token": "(14720) 09570-47785",
"prefix": "{Personal PhoneNumber ",
"suffix": "}",
"start_pos": 81,
"end_pos": 95
}
]
}
],
"success": true,
"error": {
"message": ""
}
}
UnMask #
METHOD: PUT
Route: api/vault/unmask
For authentication, include the following token in the request headers:
Headers: {“Authorization”: “Bearer <AUTH_TOKEN>”}
Request Payload: #
Here’s an example of a request payload
{ "policy_name": "Add Prefix Suffix Policy", "unmask": [ { "token_value": "cn1AU PevBCff" } ] }
Response: #
{
"data": [
{
"value": "Person Name Sarah Johnson",
"token_value": "Person Name cn1AU PevBCff",
"toxicity_analysis": {
"toxicity": 0.0007764528272673488,
"severe_toxicity": 0.0001102458918467164,
"obscene": 0.00018323531548958272,
"threat": 0.00010840075265150517,
"insult": 0.00018199537589680403,
"identity_attack": 0.00013704980665352196
}
}
],
"success": true,
"error": {
"message": ""
}
}