Masking APIsMask with Format

Mask with Format

Mask sensitive values while preserving the structure of the original — such as phone number punctuation or email domain format.

{
  "mask": [
    {
      "value": "(408)- 426 - 9989",
      "format": "Phone Number",
      "token_name": "Numeric Token"
    },
    {
      "value": "kumar@fss.com",
      "format": "Email Address",
      "token_name": "Text Token"
    }
  ]
}
{
  "data": [
    {
      "value": "(408)- 426 - 9989",
      "format": "Phone Number",
      "token_name": "Numeric Token",
      "token_value": "(07432)- 29915 - 56713"
    },
    {
      "value": "kumar@fss.com",
      "format": "Email Address",
      "token_name": "Text Token",
      "token_value": "LEFQS@WJoZudg"
    }
  ],
  "success": true,
  "error": { "message": "" }
}

Use this when the structure of the value must be preserved, such as punctuation in phone numbers or domains in email addresses. The masked output will look like a valid value of the same type.

Endpoint

MethodRouteHeaders
PUT/api/vault/mask{"Authorization": "Bearer <AUTH_TOKEN>"}

To get the Authkey please contact help@protecto.ai

Request body

body
maskarray
Required

List of values to mask with format preservation.

body
mask[].valuestring
Required

The raw sensitive value to mask.

body
mask[].formatstring
Required

The format to apply. Must be a supported format name (e.g., Phone Number, Email Address, URL). See Supported Formats for the full list.

body
mask[].token_namestring
Required

The token type to use alongside the format.

Notes

  • Format names are case- and spelling-sensitive. An invalid name returns a format name not defined error.

  • Format-masked output preserves the structure (length, character pattern, separators) but not the content.

  • See Supported Formats for all valid format names.

  • See Errors & Limits for the full list of error responses.