Support: support@tinplate.dev · Zero-Retention Edge Security Support Trust Center DPA GitHub Issues
AI Safety & Agents Live on Hub

PII Redactor API — Mask Personal Data Before Sending Prompts to LLMs

Mask emails, phones, IBANs, cards, and EU IDs with reversible tokens before LLM calls. Stateless PII redaction API that masks emails, phones, IBANs, SSNs, credit cards, and EU national IDs with reversible HMAC tokens before LLM calls.

Additional endpoints in this module: POST /v1/pii-redactor/restore

Interactive Sandbox · No API Key Required 200 OK · Ready
POST /v1/pii-redactorinput
200 OK sample / live responsejson
{
  "ok": true,
  "data": {
    "redacted_text": "Customer [PII_EMAIL_1] (IBAN [PII_IBAN_1]) requested a refund.",
    "findings": [
      {
        "type": "EMAIL",
        "start": 9,
        "end": 32,
        "token": "[PII_EMAIL_1]",
        "locale": "GLOBAL",
        "validated": false
      },
      {
        "type": "IBAN",
        "start": 39,
        "end": 67,
        "token": "[PII_IBAN_1]",
        "locale": "EU",
        "validated": true
      }
    ],
    "counts": {
      "EMAIL": 1,
      "IBAN": 1
    },
    "total_redacted": 2,
    "tokens": {
      "[PII_EMAIL_1]": "janos.kovacs@example.hu",
      "[PII_IBAN_1]": "HU42117730161111101800000000"
    }
  },
  "meta": {
    "request_id": "req_pii_01",
    "ms": 1
  }
}
OpenAPI 3.0.3 Get All-Access Key ($29/mo) No signup. No payload storage.
Quickstart Code Examples
curl -X POST "https://api.tinplate.dev/v1/pii-redactor" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $TINPLATE_KEY" \
  -d '{"text":"Customer janos.kovacs@example.hu (IBAN HU42117730161111101800000000) requested a refund.","mode":"token"}'
import { TinplateClient } from "@tinplate/sdk";

const tinplate = new TinplateClient({
  apiKey: process.env.TINPLATE_API_KEY!,
});

const { data, meta } = await tinplate.call("/v1/pii-redactor", {
  "text": "Customer janos.kovacs@example.hu (IBAN HU42117730161111101800000000) requested a refund.",
  "mode": "token"
});
console.log(`[${meta.ms} ms]`, data);
import requests

response = requests.post(
    "https://api.tinplate.dev/v1/pii-redactor",
    headers={
        "Content-Type": "application/json",
        "Authorization": "Bearer YOUR_TINPLATE_KEY",
    },
    json={
  "text": "Customer janos.kovacs@example.hu (IBAN HU42117730161111101800000000) requested a refund.",
  "mode": "token"
}
)
print(response.json())
const response = await fetch("https://api.tinplate.dev/v1/pii-redactor", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer YOUR_TINPLATE_KEY",
  },
  body: JSON.stringify({
  "text": "Customer janos.kovacs@example.hu (IBAN HU42117730161111101800000000) requested a refund.",
  "mode": "token"
}),
});
const result = await response.json();
console.log(result);
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "tinplate_pii_redactor",
    "arguments": {
      "text": "Customer janos.kovacs@example.hu (IBAN HU42117730161111101800000000) requested a refund.",
      "mode": "token"
    }
  }
}
OpenAPI 3.0.3 Schema Contract

Request Parameters & Response Schema Reference

Request Body Parameters (POST /v1/pii-redactor)

ParameterType & ConstraintsDescription
text required string
minLen: 1, maxLen: 262144
Input text to scan and redact (max 256 KB).
locales optional string[] Locale packs to enable (defaults to ['GLOBAL', 'EU']).
mode optional "token" | "mask" 'token' returns reversible [PII_<TYPE>_N] tokens + caller-only tokens map; 'mask' returns [REDACTED:<TYPE>] with an empty tokens map.
types optional string[] Optional whitelist of PII entity types to redact.

Response data Object Fields (200 OK)

FieldTypeDescription
redacted_text string Field 'redacted_text'
findings object[] Field 'findings'
counts object Field 'counts'
total_redacted integer Field 'total_redacted'
tokens object Reversible token map returned only to the caller (never stored server-side). Empty in 'mask' mode.

What PII Redactor API Detects & Validates

  • Email addresses (plus [at]/[dot] obfuscation), international & Hungarian (06/+36) phones, IPv4/IPv6, and MAC addresses
  • Credit cards (Luhn-validated) and IBAN numbers (MOD 97-10 checksum verified)
  • US SSN, UK NIN, German Steuer-ID, Hungarian TAJ (9-digit) & Adóazonosító jel (10-digit) with checksums, Spanish DNI/NIE, French NIR, Polish PESEL
  • Reversible placeholder tokens ([PII_EMAIL_1]) or deterministic HMAC-SHA256 pseudonymization
  • Stateless restoration via POST /v1/pii-redactor/restore using caller-held map
Honest Engineering Boundaries

Known Limitations & Test Verification

Release: v1.0.39 · Verified: 16 November 2026 · Portfolio Median: 0.318 ms in-Worker V8 compute (add 15–65 ms HTTPS RTT) · See Full Portfolio Benchmarks →

  • Deterministic pattern + checksum detector; does not perform open-ended NER on arbitrary person names without structured context.
  • Restoration requires keeping the returned redaction map in your own session state (Tinplate stores nothing).
  • Tested suite v1.0.4 (14 November 2026): 100% precision on Luhn/IBAN/EU national ID checksum fixtures.

Direct All-Access & Marketplace Plans

Direct Polar All-Access Keys unlock all 42 APIs (49 endpoints), /v1/pipeline, and /mcp on api.tinplate.dev: Pro ($29/mo · 120 req/min · 100k/mo · 128 KB) or Team ($79/mo · 300 req/min · 500k/mo · 256 KB).

PlanMonthly PriceIncluded RequestsRate LimitMax PayloadBest For
BASIC$0.00 / mo500 / month10 req / min64 KBEvaluation & CI smoke tests
PRO$9.99 / mo15,000 / month60 req / min128 KBSolo devs & production apps
ULTRA$29.99 / mo100,000 / month300 req / min256 KBGrowing SaaS & multi-agent pipelines
MEGA$79.99 / mo500,000 / month1,000 req / min256 KBHigh-volume enterprise workloads

Frequently Asked Questions

How do I restore redacted placeholders after the LLM responds?

Keep the entities map returned by /v1/pii-redactor in your application memory and send the LLM output plus that map to POST /v1/pii-redactor/restore.

Does it validate checksums to prevent false positives?

Yes. Credit cards require Luhn validation, IBANs require ISO 13616 MOD-97 verification, and national IDs validate check digits before masking.

Is any personal data logged or retained?

Never. Workers Observability and invocation logs are disabled in wrangler.toml (observability.enabled = false).

Zero Payload Logging

Data Handling, Privacy & Proxy Disclosure

100% stateless V8 isolate execution. Raw PII and redaction maps are never written to disk, KV, D1, or console logs.

Worker Zero-Logging Guarantee: Cloudflare Workers Observability and invocation logging are disabled (observability.enabled = false, head_sampling_rate = 0, invocation_logs = false). Requests via RapidAPI or Zyla traverse marketplace proxies; use a Direct Bearer Key for zero-intermediary routing.

Related Tinplate APIs

POST /v1/prompt-guard Live

Prompt Injection Detection API

Catch prompt injections, role hijacks, and encoded jailbreaks in user inputs and RAG chunks.

POST /v1/secret-scanner Tier 1

Log Redact & Secret Scanner API

Detect and mask leaked API keys, JWTs, and private keys in logs, diffs, and prompts.

POST /v1/hallucination-diff AI Safety & Agents

Deterministic Hallucination Diff API

Fast first filter to catch unsupported numbers, dates, and names in LLM answers vs RAG sources.