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 instructeerPython client library — instructeer on GitHub →
Detectors
| Detector | Endpoint | Detects |
|---|---|---|
| Person Name | /v1/pii/detect/person | Given names, surnames, and full names |
| /v1/pii/detect/email | Email addresses (RFC 5321/5322) | |
| Phone Number | /v1/pii/detect/phone | US phone numbers (NANP validated) |
| SSN | /v1/pii/detect/ssn | US Social Security Numbers |
| Credit Card | /v1/pii/detect/card | Payment cards (Luhn validated, major networks) |
| Bank Routing & Account | /v1/pii/detect/bank | US ABA routing numbers and bank account numbers |
| IBAN | /v1/pii/detect/iban | International bank account numbers (MOD-97 validated) |
| IP Address | /v1/pii/detect/ip | IPv4 and IPv6 addresses |
| URL | /v1/pii/detect/url | URLs including paths and query parameters |
| Date of Birth | /v1/pii/detect/dob | Dates flagged as date-of-birth (requires context) |
| Date | /v1/pii/detect/date | All dates including generic ones |
| Driver's License | /v1/pii/detect/dl | US driver's licenses (50+ state formats) |
| Passport | /v1/pii/detect/passport | US passport numbers (NGP and legacy formats) |
| Physical Address | /v1/pii/detect/address | US street addresses (state + ZIP validated) |
Authentication
Pass your API key in the X-API-Key header on every request.
X-API-Key: rg_your_keyResponse 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
/v1/pii/detect/allDetect AllRun 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)
/v1/pii/detect/allDetect All — filteredRun 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"])/v1/pii/detect/emailDetect Emailfrom instructeer.guards import PIIGuard
pii = PIIGuard(api_key="rg_your_key")
result = pii.detect_email("Contact john@example.com please")/v1/pii/detect/phoneDetect Phonefrom instructeer.guards import PIIGuard
pii = PIIGuard(api_key="rg_your_key")
result = pii.detect_phone("Call me at 555-867-5309")/v1/pii/detect/ssnDetect SSNfrom instructeer.guards import PIIGuard
pii = PIIGuard(api_key="rg_your_key")
result = pii.detect_ssn("SSN: 123-45-6789")/v1/pii/detect/cardDetect Credit Cardfrom instructeer.guards import PIIGuard
pii = PIIGuard(api_key="rg_your_key")
result = pii.detect_card("Visa: 4532015112830366")/v1/pii/detect/bankDetect Bank Routing & AccountDetects 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")/v1/pii/detect/ibanDetect IBANfrom instructeer.guards import PIIGuard
pii = PIIGuard(api_key="rg_your_key")
result = pii.detect_iban("IBAN: GB82 WEST 1234 5698 7654 32")/v1/pii/detect/ipDetect IP AddressDetects 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")/v1/pii/detect/urlDetect URLfrom instructeer.guards import PIIGuard
pii = PIIGuard(api_key="rg_your_key")
result = pii.detect_url("Visit https://example.com/profile?id=123")/v1/pii/detect/dobDetect Date of BirthDetects 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")/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")/v1/pii/detect/dlDetect Driver's LicenseUS 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")/v1/pii/detect/passportDetect PassportUS 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")/v1/pii/detect/addressDetect AddressUS 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")/v1/pii/detect/personDetect Person NameLexicon-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")