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
| Network | IIN range | Length |
|---|---|---|
| Visa | 4 | 13, 16, 19 |
| Mastercard | 51–55, 2221–2720 | 16 |
| American Express | 34, 37 | 15 |
| Discover | 6011, 622126–622925, 644–649, 65 | 16, 19 |
| JCB | 3528–3589 | 16–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.