Masking APIsIdentify and Mask (Auto-Detect)

Identify and Mask (Auto-Detect)

Automatically detect and mask all PII in free-form text. Entity types, tokens, and detection rules are all driven by your active policy.

{
"mask": [
{
"value": " Sarah Connors, a 34-year-old Caucasian woman residing at 12 Elm Street, Springfield, IL 62704, recently enrolled in TrendyShop’s premium membership program. During her visit to the Springfield location, her vehicle with registration number IL-4598-RM was logged into the parking system. Sarah, who holds a driving license numbered DL-IL-1987-20976, also registered her credit card (4532 7896 4512 3456) to enjoy 10% cashback on purchases. Additionally, her phone number (217-555-2020) and email address (sarah.connors88@example.com) and her company contact is www.xyz.com"
}
]
}
{
  "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 for free-form text where entity types are unknown in advance. Protecto scans the text, detects sensitive entities based on the active policy, and returns a masked version with entity tags.d

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 free-form text inputs to analyze and mask.

body
mask[].valuestring
Required

Free-form text containing potentially sensitive data.

Response fields

token_valuestring
Required

The full input text with all detected entities replaced by tokens wrapped in entity tags.

individual_tokensarray

Array of each individual entity detected and masked.

toxicity_analysisobject

Toxicity scores for the input text. Returned when enabled by policy.

Notes

  • Detection and masking behavior are entirely policy-driven — no entity types or token names are required in the request.

  • The exact tokenized output depends on the active policy.

  • This mode is available on the trial environment.