PIIGuard / Detectors

Bank Routing & Account

Detects US ABA routing numbers and US-style bank account numbers. Routing numbers are checksum-validated — confidence is always 1.0. Account numbers are context-aware — confidence depends on nearby keywords and adjacency to a routing number.

Endpoint: POST /v1/pii/detect/bank

Validation & Confidence

Routing: ABA 3-7-1 checksum + prefix range (01–12, 21–32, 61–72, 80). Account: 4–17 digits, context/adjacency scoring.

Routing: always 1.0, high. Account with context or adjacent routing: 1.0. Account with no context: 0.5.

Example

from instructeer.guards import PIIGuard

# api_key = os.environ["INSTRUCTEER_API_KEY"]
pii = PIIGuard(api_key="rg_your_key")
result = pii.detect_bank("MICR 021000021 0001234567890 for payroll")
// Response
[
  { "entity_type": "US_BANK_ROUTING_NUMBER", "value": "021000021", "confidence": 1.0,
    "extra": { "checksum_passed": true, "has_adjacent_account": true, "adjacent_account_digits": "0001234567890" } },
  { "entity_type": "US_BANK_ACCOUNT_NUMBER", "value": "0001234567890", "confidence": 1.0,
    "extra": { "has_adjacent_routing": true, "paired_routing_digits": "021000021" } }
]

Reference

ConditionConfidenceSuggested action
Routing number (any)1.0Block / redact
Account + context keyword or adjacent routing1.0Block / redact
Account, no context0.5Log or human review
Repeating-digit account (is_suspicious_pattern)1.0Flag for review

Notes

  • IBAN / SWIFT: Out of scope for this detector. Use /detect/iban for international account numbers.
  • Suspicious pattern: Accounts like 11111111 are flagged with is_suspicious_pattern: true — likely test data or placeholders.