Token-based data masking is a powerful technique that enables users to customize the masking of sensitive data according to their specific requirements. In this blog post, we will explore how to use token-based data masking with Protecto.ai. We’ll cover the endpoint, request method, payload, response, advantages, and various customization options available.
Note: Check our supporting Token
Endpoint and Authentication: #
To use Protecto.ai’s token-based masking, you need to send a PUT request to the following endpoint:
| Method | Route | Headers |
| PUT | /api/vault/mask | For authentication, include the following token in the request headers:
{“Authorization”: “Bearer <AUTH_TOKEN>”} |
Note: To obtain the <auth token>, please refer to the Step-by-Step Guide to Obtain Your Auth Token.
Request Payload: #
Here’s an example of a request payload to mask sensitive data with tokenName.
Request Payload:
{
"mask": [
{ "value": "John", "token_name": "Text Token" },
{ "value": "15/8/2010", "token_name": "Numeric Token" },
{ "value": "john.doe@example.com", "token_name": "Text Token" },
]
}
Parameters for the Request Payload:
- value (string): The sensitive data value to be masked.
- token_name (string): The token to be used for masking the sensitive data.
Response: #
Upon successful masking, you will receive a response with the masked data. Here’s an example of a response:
Response:
{
"data": [
{
"value": "John",
"token_name": "Text Token",
"token_value": "v4e1"
},
{
"value": "15/8/2010",
"token_name": "Numeric Token",
"token_value": "768403609"
},
{
"value": "john.doe@example.com",
"token_name": "Text Token",
"token_value": "n8O35AjHWq"
},
{
"value": "2026-06-30",
"token_name": "Date Token",
"token_value": "0010-05-11"
},
{
"value": "TN",
"token_name": "State Token",
"token_value": "DE"
},
{
"value": "John",
"token_name": "Person token",
"token_value": "Shilo"
}
],
"success": true,
"error": {
"message": ""
}
}
Response Parameters:
- token_value (string): The generated token that replaces the sensitive data.
Advantage :
Token-based masking offers several advantages for data protection:
- Customization: Users can customize the masking of sensitive data according to their specific needs and preferences.
- Token Types:Users can choose from various token types, such as text-based tokens, alphanumeric tokens, or a combination of both, to match the context of the data being masked.
- Token Length:Users have the flexibility to define the desired length of the tokens. For example, tokens can be set to a specific number of characters or digits, ensuring they fit the data format.
- Case Sensitivity: can opt for case-sensitive or case-insensitive masking, allowing for precise control over how the data is obscured.