For your apps · Maskflare SDKs & API
Mask and Unmask Sensitive Data From Your Own Code
What your app sends
Summarize the ticket from
Ada Lovelace (ada@example.com)
about invoice DE89 3704 0044 0532 0130 00
and suggest a reply.
What OpenAI receives
Summarize the ticket from
mf_mask_170b (mf_mask_5e1d)
about invoice mf_mask_2f6c
and suggest a reply.
574
Built-in detectors for personal data and secrets
47
Country packs, checksum-validated where the format has one
9
AI providers behind one gateway, plus the desktop agent and proxy
Sound familiar?
Why the usual answers fall short
“We have a regex for emails.”
And IBANs, national IDs, API keys and names? Each country's ID has its own checksum.
“We hash everything.”
Then nobody can read the support reply back to the customer. Masking is reversible when you need it.
“We'll mask it in the gateway.”
Great for model calls. Your logs and data pipelines never go through it.
Not every place personal data leaks is a model call. Logs, support exports, analytics events and evaluation datasets all collect the same names and account numbers.
Writing your own detection for each of those means maintaining regexes and checksums in several languages, and deciding where the mapping back to real values lives.
How Maskflare SDKs & API works
Call mask with any text and get back the masked output plus the tokens. Store, log or send the masked text. When you need the real values, call unmask with the tokens or unmask_text with a whole string. Deterministic mode gives the same value the same token, which keeps search and embeddings working over masked data. The SDKs use a redaction-purpose key that can't call the forwarding routes, so a leaked SDK key can't spend your provider budget.
Benefits
Python and TypeScript
pip install maskflare, or the zero-dependency TypeScript SDK for Node 18+, Deno, Bun and Workers.
Reversible for 30 days
Tokens resolve back to real values for 30 days, then expire.
Deterministic mode
Same value, same token, for RAG, search and joins over masked data.
Sensitive wrapper
Wrap values in Sensitive so they never print in your own logs or tracebacks.
LiteLLM guardrail
maskflare[litellm] drops into an existing LiteLLM proxy as a pre- and post-call guardrail.
Exact Data Match CLI
maskflare[edm] hashes your customer records locally and uploads only keyed hashes.
Capabilities
Python
MaskFlare and AsyncMaskFlare clients with mask, unmask and unmask_text; deterministic=True; Sensitive; extras for LiteLLM and EDM.
TypeScript
MaskFlare client with mask, unmask and unmaskText; zero dependencies; server-side runtimes.
REST API
The same mask, unmask and match operations over HTTP for any other language or system.
Set it up
import os
from maskflare import MaskFlare
client = MaskFlare(api_key=os.environ["MASKFLARE_API_KEY"])
result = client.mask("Contact ada@example.com for details")
# result.output: "Contact mf_mask_170b8521c1b944b3beb9ca02b328efbe for details"
original = client.unmask([t.token for t in result.tokens])
# {"170b8521c1b944b3beb9ca02b328efbe": "ada@example.com"}import { MaskFlare } from '@maskflare/sdk';
const client = new MaskFlare({
apiKey: process.env.MASKFLARE_API_KEY!,
baseUrl: process.env.MASKFLARE_BASE_URL!,
});
const { output, tokens } = await client.mask('Contact ada@example.com for details');
// output: "Contact mf_mask_170b8521c1b944b3beb9ca02b328efbe for details"guardrails:
- guardrail_name: maskflare
litellm_params:
guardrail: maskflare.integrations.litellm.MaskflareGuardrail
mode: [pre_call, post_call]
default_on: true
api_key: os.environ/MASKFLARE_API_KEY
fail_policy: closedWhat it does not do
We'd rather you hear it from us.
- The TypeScript SDK runs server-side. Don't ship a Maskflare key to a browser.
- Tokens expire after 30 days. If you need values back later, keep your own encrypted copy or use format-preserving encryption as the rule action.
Explore related capabilities
See how Maskflare applies the same masking rules to related AI and data-protection workflows.
Related guides and explainers
- How to keep personal data out of your OpenAI API calls
- PII masking in a LiteLLM proxy with the Maskflare guardrail
- How to restore masked personal data in LLM responses
- PII Redaction API: How to Evaluate One
- Developer quickstart
- Data Redaction vs Data Masking: What's the Difference?
- What Is Reversible Tokenization?
- What Is an AI Gateway?
- What Is an LLM Guardrail?
Frequently asked questions
How do I install the SDKs?
pip install maskflare for Python, and the @maskflare/sdk package for TypeScript. Both need a Maskflare API key.
Can I unmask values later?
Yes, for 30 days after the token was created, using the API key's organization. After that the token expires.
What is deterministic mode?
With deterministic=True the same value always becomes the same token, so you can search, join and embed masked text consistently.
Do I need the gateway as well?
Not for masking your own text. Use the gateway when you want model calls masked and restored automatically without code changes.
See it on your own data
Try Maskflare free.
Bring your hardest prompts.
28-day free trial or 10,000 requests, whichever comes first. Point one app at the gateway or enroll a few laptops,
and watch what gets masked. Or talk to us first.
- SOC 2 Type II: In progress
- ISO 27001: In progress
- EU hosting by default · on-premises available
- Prompts and files never stored
- Never used to train AI models
- GDPR · nDSG · DPA available
- Trust center →