# Redact credit card numbers

> Redact card numbers from text and JSON with Luhn validation, so only real card numbers are flagged and order IDs are left alone.

Canonical: https://bitbanger.in/entities/credit-card
Last updated: 2026-10-27

Category: Financial data · Entity type: `financial.credit_card`

Card numbers follow a shape that also matches long order IDs and tracking numbers. Redactly runs a Luhn checksum before reporting one, which keeps precision high without flagging every 16-digit string.

## How Redactly detects credit card numbers

- Matched by regex for 13 to 19 digits with optional spaces or hyphens, then confirmed with the Luhn checksum.
- The checksum is the gate: a 16-digit order number that fails Luhn is not reported as a card.
- Only the number is redacted; the surrounding transaction text is preserved.

## Why redact credit card numbers?

Storing a card number in a ticket or log puts you in PCI DSS scope you never intended to enter.

## Example request

```bash
curl -X POST https://api.bitbanger.in/v1/redact \
  -H "X-API-Key: rdct_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"text": "Charge failed for card 4242 4242 4242 4242, please retry.", "style": "replace"}'
```

## FAQ

**Does Redactly redact credit card numbers automatically?**

Yes. Send text to the API and every detected type is redacted, including credit card numbers. To redact only this type, pass the value financial.credit_card in the entities filter. No training or configuration is required.

**What happens to credit card numbers after redaction?**

With style set to replace, each match becomes [financial.credit_card] — the entity type in square brackets. Setting style to mask replaces every character with a block character, and remove deletes the span entirely.

## Related entity types

- [IBANs](https://bitbanger.in/entities/iban) — Redact International Bank Account Numbers with mod-97 validation across all SEPA countries.
- [Bank account numbers](https://bitbanger.in/entities/bank-account) — Redact domestic bank account numbers that carry no checksum and no fixed format.
- [Crypto wallet addresses](https://bitbanger.in/entities/crypto-wallet) — Redact Bitcoin and Ethereum wallet addresses from text, JSON, and support transcripts.

Try it on your own text: https://bitbanger.in/entities/credit-card
