Redact PII from text
Exacttext_redactDeterministic and authoritative — the canonical answer for this input.
Mask an arbitrary value, keeping `keep_start` characters on the left and `keep_end` characters on the right. Middle is replaced with asterisks. At least one character is always masked — a keep window that would cover the whole value still redacts one. Use for generic secret/token masking. Processing multiple inputs? Use `text_redact_batch` to do up to 1000 in one call.
Parameters
valuestringrequiredValue to redact.
keep_startintegeroptionalkeep_endintegeroptionalCall it
curl -X POST https://api.snipget.ai/v1/text/redact \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{"value":"supersecret","keep_start":2,"keep_end":2}'The Batch tab sends up to 1000 inputs in one call via /v1/text/redact/batch.
Example response
{
"input": "supersecret",
"redacted": "su*******et"
}FAQ
When would I use this over the email or card maskers?
Use it for any sensitive value that is not a standard email, phone, card, or SSN, such as API keys, account numbers, tokens, or reference codes. It keeps a few characters on each end so the value is still recognizable while the middle is hidden.
Does it find secrets inside a block of text?
No. It masks the single value you pass in, it does not scan a paragraph for sensitive data. Pass one value per call, or use the batch version for a list.
Is the masking deterministic?
Yes. This is an exact, deterministic tool, so the same value with the same settings always masks identically. It is the canonical result and it is one-way, so the mask cannot be reversed.
How do I control how much shows?
Set keep_start for the leading characters and keep_end for the trailing characters (both default 2). For example 'supersecret' with 2 and 2 becomes 'su*******et'.
What if the value is shorter than what I asked to keep?
It does not error. The keep window is capped so at least one character is always masked: asking to keep as many or more characters than the value has reveals all but one (trimming the end first) rather than masking everything or revealing it whole. A single-character value is fully masked, and an empty value returns an empty string.