Secured
Concepts

Entity Types

Reference table of all 44 EntityType values supported by @secured-ai/core.

Overview

@secured-ai/core defines 44 entity types as a TypeScript string union. Every detected entity is assigned one of these types, and you use them when configuring replacement pools, writing custom patterns, and filtering results.

import type { EntityType } from '@secured-ai/core'

The types are split into two groups:

  • Sensitive types (29) — treated as PII by obfuscate() and included in sensitiveEntities
  • Informational types (15) — detected by detect() but not automatically obfuscated

Sensitive types

These 29 types are classified as sensitive. obfuscate() will replace any entity of these types with a fake value.

TypeDescriptionExampleDetecting engine(s)
PERSONFull name of a natural personJane DoeNLP, ML
EMAILEmail addressjane@example.comRegex
PHONEPhone number (various formats)555-867-5309Regex
SSNUS Social Security Number123-45-6789Regex
CREDIT_CARDCredit or debit card number4111 1111 1111 1111Regex
CVVCard verification value427Regex
ORGOrganisation or company nameAcme CorpNLP, ML
GPEGeopolitical entity (city, country, state)New YorkNLP, ML
LOCNon-GPE location (building, landmark)Golden Gate BridgeNLP, ML
ADDRESSStreet address123 Main St, SpringfieldRegex
ZIP_CODEPostal code90210Regex
DATECalendar dateJanuary 15, 1985Regex, NLP
TAX_IDTax identification number12-3456789Regex
ACCOUNT_NUMBERBank account number000123456789Regex
INVOICE_NUMBERInvoice or billing referenceINV-2024-0042Regex
REFERENCE_IDGeneric reference identifierREF-US-1234Regex, Custom
MEDICAL_IDMedical record numberMRN-00123456Regex
INSURANCE_IDInsurance policy numberPOL-4521-ABCRegex
CASE_NUMBERLegal or support case numberCASE-2024-00789Regex
LEGAL_CITATIONLegal case citationBrown v. Board of EducationRegex
DRIVER_LICENSEDriver's license numberDL-1234567Regex
PASSPORTPassport numberA12345678Regex
IP_ADDRESSIPv4 or IPv6 address192.168.1.1Regex
MAC_ADDRESSNetwork hardware address00:1A:2B:3C:4D:5ERegex
URLWeb URLhttps://example.com/user/123Regex
ROUTING_NUMBERUS bank routing number021000021Regex
IBANInternational Bank Account NumberGB29NWBK60161331926819Regex
EINEmployer Identification Number12-3456789Regex

Informational types

These 15 types are detected by detect() and appear in result.entities, but are not in sensitiveEntities and are not replaced by obfuscate() by default.

TypeDescriptionExampleDetecting engine(s)
CREDIT_CARD_EXPIRYCard expiry date12/28Regex
TIMETime of day3:45 PMRegex
NORPNationality, religion, or political groupAmerican, BuddhistNLP
FACFacility nameJFK AirportNLP
PRODUCTProduct or service nameiPhone 15 ProNLP
EVENTNamed eventWorld War II, Super BowlNLP
WORK_OF_ARTTitle of a creative workThe Great GatsbyNLP
LAWNamed law or regulationGDPR, HIPAANLP
LANGUAGELanguage nameSpanish, MandarinNLP
QUANTITYMeasurement or quantity500 metres, 3 kilogramsNLP
CARDINALCardinal numberforty-twoNLP
ORDINALOrdinal numberfirst, thirdNLP
PERCENTPercentage87%NLP
MISCMiscellaneous named entityVariousML
CUSTOMUser-defined entity typeDomain-specificCustom

Using entity types in code

Filtering detection results

import type { EntityType } from '@secured-ai/core'

const result = await client.detect(text)

const namesOnly = result.entities.filter(
  (e) => e.type === 'PERSON'
)

const financialPII = result.entities.filter(
  (e): e is typeof e & { type: EntityType } =>
    ['CREDIT_CARD', 'IBAN', 'ROUTING_NUMBER', 'ACCOUNT_NUMBER'].includes(e.type)
)

Custom replacement pools by type

const client = new PrivacyClient({
  baseUrl: 'https://dev-api.securedai.com',
  sdkAccessToken: import.meta.env.VITE_SECURED_SDK_ACCESS_TOKEN,
  replacementPools: {
    PERSON: ['Alex Taylor', 'Jordan Lee', 'Morgan Smith'],
    EMAIL: ['user@redacted.example'],
    PHONE: ['800-555-0100'],
    SSN: ['000-00-0000'],
  },
})

Custom patterns with specific types

client.addPattern({
  name: 'employee-id',
  pattern: /\bEMP-\d{6}\b/,
  entityType: 'REFERENCE_ID',  // classify as a sensitive REFERENCE_ID
  confidence: 0.97,
})

Notes on CUSTOM

The CUSTOM type is a catch-all for user-defined patterns. Note that CUSTOM is not in the sensitive types list — entities matched with entityType: 'CUSTOM' will appear in detect() results but will not be replaced by obfuscate(). Use a built-in sensitive type (like REFERENCE_ID or CASE_NUMBER) if you want automatic obfuscation.

On this page