PIIGuard / Detectors

Credit Card

Detects payment card numbers using Luhn algorithm validation and IIN (Issuer Identification Number) range matching. Covers Visa, Mastercard, American Express, Discover, and JCB. Test card numbers used in development are excluded.

Endpoint: POST /v1/pii/detect/card

Validation & Confidence

Luhn checksum + IIN prefix ranges. Test cards (e.g. 4111111111111111) are filtered.

Always 1.0. Severity: high.

Example

from instructeer.guards import PIIGuard

# api_key = os.environ["INSTRUCTEER_API_KEY"]
pii = PIIGuard(api_key="rg_your_key")
result = pii.detect_card("Charge card 4532015112830366 for the order")
// Response
{
  "entity_type": "CREDIT_CARD",
  "value": "4532015112830366",
  "severity": "high",
  "confidence": 1.0,
  "extra": { "normalized": "4532015112830366", "card_type": "visa" }
}

Reference

NetworkIIN rangeLength
Visa413, 16, 19
Mastercard51–55, 2221–272016
American Express34, 3715
Discover6011, 622126–622925, 644–649, 6516, 19
JCB3528–358916–19

Notes

  • Formats: Spaces and hyphens between groups are handled: 4532-0151-1283-0366
  • Test cards excluded: Common test card numbers (Stripe, Braintree, etc.) are filtered and not returned.