Snipget.ai

Redact credit card numbers from text

Exact
money_credit_card_redact

Deterministic and authoritative — the canonical answer for this input.

Mask a credit card number, keeping the last `keep_last` digits visible. Only digits are counted; separators (-, space) are preserved. Use for safe logging of PCI-scoped data. Input with no digits at all has nothing to mask and passes through unchanged with `card_shaped: false` at reduced confidence (0.5), so a no-op is never silent. Processing multiple inputs? Use `money_credit_card_redact_batch` to do up to 1000 in one call.

Parameters

valuestringrequired

Credit card number to redact.

keep_lastintegeroptional

Call it

curl -X POST https://api.snipget.ai/v1/money/credit-card/redact \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{"value":"4532015112830366","keep_last":4}'

The Batch tab sends up to 1000 inputs in one call via /v1/money/credit-card/redact/batch.

Example response

{
  "input": "4532015112830366",
  "redacted": "************0366",
  "card_shaped": true
}

FAQ

Why use this for card numbers?

It produces the standard masked card display (last four digits visible) that customers expect on receipts and order pages, while keeping the full number out of your logs and screens. Spaces and dashes are kept where they were, so the masked value still looks like the original card format.

Does it check whether the card number is valid?

No. It only masks the digits, it does not validate the card or detect the brand. If you need to confirm a card passes the checksum or identify Visa vs Mastercard, use the credit card classify tool instead.

Is the masking always the same?

Yes. This is an exact, deterministic tool, so a given card number always masks the same way. It is the canonical result and it is one-way, so the masked value cannot be reversed to the real number.

Can I show a different number of digits?

Yes. The keep_last option controls how many trailing digits stay visible (default 4). Use 0 to mask the entire number.

What if I send a short value or blank?

It does not throw an error. A value with fewer digits than keep_last is fully masked, and an empty value returns an empty string.

What if the value has no digits at all?

There is nothing to mask, so it passes through unchanged — and the result says so with card_shaped false and reduced confidence (0.5), so you can catch values that were never card numbers before logging them.

Related tools