Redact credit card numbers from text, JSON, and CSV
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
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"}'
Every hit in the response carries entity, text, start, and end. The offsets index into the text you sent, so you can apply the redactions to your own copy of the document. The full response schema is in the API reference.
Questions
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
- IBANsRedact International Bank Account Numbers with mod-97 validation across all SEPA countries.
- Bank account numbersRedact domestic bank account numbers that carry no checksum and no fixed format.
- Crypto wallet addressesRedact Bitcoin and Ethereum wallet addresses from text, JSON, and support transcripts.
Redact credit card numbers in production
Get an API key and send your first request in a minute. Plans start at $24/month.
See pricing