ByteChef LogoByteChef
AutomationWorkflowsAIAI AgentGuardrails

PII

Rule-based detection of personal data such as emails, phone numbers, credit cards, IBANs, and regional ID numbers.

PII finds personally identifiable information with regular expressions. It runs in the preflight stage, needs no model, and returns the same result for the same text every time. Attach it under Check for Violations to block text that contains personal data, or under Sanitize Text to replace each value with a <ENTITY_TYPE> placeholder.

Properties

PropertyTypeDefaultDescription
Validate InputBooleantrueCheck the user input before it is sent to the model.
Validate OutputBooleantrueCheck the model response before it is returned.
TypeStringALLAll scans for every entity type. Selected scans only the types in Entities. Required.
EntitiesArray of stringsNoneThe entity types to scan for. Shown only when Type is Selected. At least one is required when Type is Selected; an empty list is an execution failure.

Entity types

RegionEntity types
GlobalEMAIL_ADDRESS, PHONE_NUMBER, CREDIT_CARD, IP_ADDRESS (IPv4), IBAN_CODE, CRYPTO (Bitcoin address), DATE_TIME (ISO-8601 date or date-time), LOCATION (street address ending in Street, Avenue, Road, and similar), MEDICAL_LICENSE
United StatesUS_SSN, US_BANK_NUMBER, US_DRIVER_LICENSE, US_ITIN, US_PASSPORT
United KingdomUK_NHS, UK_NINO
SpainES_NIF, ES_NIE
ItalyIT_FISCAL_CODE, IT_VAT_CODE, IT_DRIVER_LICENSE, IT_PASSPORT, IT_IDENTITY_CARD
PolandPL_PESEL
SingaporeSG_NRIC_FIN, SG_UEN
AustraliaAU_ABN, AU_ACN, AU_TFN, AU_MEDICARE
IndiaIN_AADHAAR, IN_PAN, IN_PASSPORT, IN_VEHICLE_REGISTRATION, IN_VOTER
FinlandFI_PERSONAL_IDENTITY_CODE

Detection checks the format only. It does not validate checksums, so any value with the right shape matches.

Results

  • Under Check for Violations (piiCheck): one violation listing the matched entity types in info.entityTypes, with matchCount set to the number of matched values.
  • Under Sanitize Text (piiSanitize): each match is replaced with <ENTITY_TYPE>, for example <EMAIL_ADDRESS> or <US_SSN>. When PII overlaps a match from Secret Keys, URLs, or Keywords, the longer match wins.

Examples

Block any personal data:

{ "name": "pii_1", "type": "pii/v1/piiCheck", "parameters": { "type": "ALL" } }

Mask only a few types:

{
  "name": "pii_1",
  "type": "pii/v1/piiSanitize",
  "parameters": {
    "type": "SELECTED",
    "entities": ["EMAIL_ADDRESS", "PHONE_NUMBER", "IBAN_CODE", "IT_FISCAL_CODE", "UK_NINO"]
  }
}

False positives

With Type set to All, several broad patterns match ordinary numbers and codes:

Entity typeMatches
US_BANK_NUMBERAny run of 8 to 17 digits, such as order numbers.
US_SSN, AU_TFNAny run of 9 digits.
PL_PESELAny run of 11 digits.
PHONE_NUMBERThree digits, three digits, then four to six digits, with optional +, parentheses, and -, ., or space separators.
DATE_TIMEAny ISO-8601 date, such as 2026-01-31.
MEDICAL_LICENSETwo capital letters followed by six digits.

If your text contains such values, set Type to Selected and choose only the types you need.

Limitations

  • There is no entity type for names of people.
  • Values written in a free form, such as a street address that does not end in a street suffix, are not detected. LLM PII asks a model to find the same entity types and does not depend on a fixed format.
  • Only IPv4 addresses are detected.
  • For identifiers specific to your business, add Custom Regex to the same parent.

How is this guide?

Last updated on

On this page