PIIGuard

Detects personally identifiable information in free-form text. Rule-based and deterministic — same input, same output on every run. 13 detector types covering financial identifiers, government IDs, contact info, and more.

pip install instructeer

Python client library — instructeer on GitHub →

Detectors

DetectorEndpointDetects
Person Name/v1/pii/detect/personGiven names, surnames, and full names
Email/v1/pii/detect/emailEmail addresses (RFC 5321/5322)
Phone Number/v1/pii/detect/phoneUS phone numbers (NANP validated)
SSN/v1/pii/detect/ssnUS Social Security Numbers
Credit Card/v1/pii/detect/cardPayment cards (Luhn validated, major networks)
Bank Routing & Account/v1/pii/detect/bankUS ABA routing numbers and bank account numbers
IBAN/v1/pii/detect/ibanInternational bank account numbers (MOD-97 validated)
IP Address/v1/pii/detect/ipIPv4 and IPv6 addresses
URL/v1/pii/detect/urlURLs including paths and query parameters
Date of Birth/v1/pii/detect/dobDates flagged as date-of-birth (requires context)
Date/v1/pii/detect/dateAll dates including generic ones
Driver's License/v1/pii/detect/dlUS driver's licenses (50+ state formats)
Passport/v1/pii/detect/passportUS passport numbers (NGP and legacy formats)
Physical Address/v1/pii/detect/addressUS street addresses (state + ZIP validated)

Authentication

Pass your API key in the X-API-Key header on every request.

X-API-Key: rg_your_key

Response Format

All endpoints return the same structure. summary.max_severity gives you an immediate actionable signal without parsing individual detections.

{
  "detections": [
    {
      "entity_type": "EMAIL_ADDRESS",
      "value": "john@example.com",
      "start": 8,
      "end": 24,
      "severity": "medium",
      "confidence": 1.0,
      "extra": {}
    }
  ],
  "summary": {
    "total": 1,
    "max_severity": "medium",
    "by_type": { "EMAIL_ADDRESS": 1 },
    "by_severity": { "medium": 1 }
  }
}

Severity: high | medium | low. Confidence: 0.0–1.0. Checksum-validated entities (credit card, SSN, IBAN, routing) always return 1.0. Full confidence guide →

Endpoints

POST/v1/pii/detect/allDetect All

Run all detectors in one request. Applies noise-reducing confidence thresholds by default.

from instructeer.guards import PIIGuard

# api_key = os.environ["INSTRUCTEER_API_KEY"]
pii = PIIGuard(api_key="rg_your_key")
result = pii.detect_all("Contact john@example.com, SSN 123-45-6789")
print(result.summary.total, result.summary.max_severity)

Optional params: detectors (list), min_confidence (float), confidence_thresholds (object), use_default_thresholds (bool)

POST/v1/pii/detect/allDetect All — filtered

Run specific detectors only.

from instructeer.guards import PIIGuard

pii = PIIGuard(api_key="rg_your_key")
result = pii.detect_all("Contact john@example.com", detectors=["email", "phone"])
POST/v1/pii/detect/emailDetect Email
from instructeer.guards import PIIGuard

pii = PIIGuard(api_key="rg_your_key")
result = pii.detect_email("Contact john@example.com please")
POST/v1/pii/detect/phoneDetect Phone
from instructeer.guards import PIIGuard

pii = PIIGuard(api_key="rg_your_key")
result = pii.detect_phone("Call me at 555-867-5309")
POST/v1/pii/detect/ssnDetect SSN
from instructeer.guards import PIIGuard

pii = PIIGuard(api_key="rg_your_key")
result = pii.detect_ssn("SSN: 123-45-6789")
POST/v1/pii/detect/cardDetect Credit Card
from instructeer.guards import PIIGuard

pii = PIIGuard(api_key="rg_your_key")
result = pii.detect_card("Visa: 4532015112830366")
POST/v1/pii/detect/bankDetect Bank Routing & Account

Detects ABA routing numbers (checksum-validated) and bank account numbers (context-aware).

from instructeer.guards import PIIGuard

pii = PIIGuard(api_key="rg_your_key")
result = pii.detect_bank("Routing: 021000021 Account: 123456789")

Bank detector details →

POST/v1/pii/detect/ibanDetect IBAN
from instructeer.guards import PIIGuard

pii = PIIGuard(api_key="rg_your_key")
result = pii.detect_iban("IBAN: GB82 WEST 1234 5698 7654 32")
POST/v1/pii/detect/ipDetect IP Address

Detects IPv4 and IPv6 addresses. Private/RFC 1918 addresses are flagged with lower severity.

from instructeer.guards import PIIGuard

pii = PIIGuard(api_key="rg_your_key")
result = pii.detect_ip("Request from 192.168.1.1 and 2001:db8::1")
POST/v1/pii/detect/urlDetect URL
from instructeer.guards import PIIGuard

pii = PIIGuard(api_key="rg_your_key")
result = pii.detect_url("Visit https://example.com/profile?id=123")
POST/v1/pii/detect/dobDetect Date of Birth

Detects dates of birth only — requires context words like 'DOB:', 'born on', 'date of birth'. Generic dates without context are not returned.

from instructeer.guards import PIIGuard

pii = PIIGuard(api_key="rg_your_key")
result = pii.detect_dob("DOB: 01/15/1985")
POST/v1/pii/detect/dateDetect Date (all dates)

Returns all dates including generic ones. Use /dob when you only want dates flagged as date-of-birth.

from instructeer.guards import PIIGuard

pii = PIIGuard(api_key="rg_your_key")
result = pii.detect_date("Meeting 2024-03-15, born 01/15/1985")
POST/v1/pii/detect/dlDetect Driver's License

US driver's licenses only. Confidence is context-dependent — alpha-numeric formats score higher than digit-only.

from instructeer.guards import PIIGuard

pii = PIIGuard(api_key="rg_your_key")
result = pii.detect_dl("DL: A1234567")
POST/v1/pii/detect/passportDetect Passport

US passports. NGP format (letter + 8 digits) preferred. Legacy 9-digit format requires context.

from instructeer.guards import PIIGuard

pii = PIIGuard(api_key="rg_your_key")
result = pii.detect_passport("Passport: A12345678")
POST/v1/pii/detect/addressDetect Address

US physical addresses. Validates state abbreviation and ZIP code format.

from instructeer.guards import PIIGuard

pii = PIIGuard(api_key="rg_your_key")
result = pii.detect_address("Ship to 123 Main St, Springfield, IL 62701")
POST/v1/pii/detect/personDetect Person Name

Lexicon-based. Covers ~3.3M given names and 164K surnames from US, Canada, Mexico, and Argentina government datasets.

from instructeer.guards import PIIGuard

pii = PIIGuard(api_key="rg_your_key")
result = pii.detect_person("Contact James Wilson please")

Person name detector details →