Quickstart
Create an API key in the console (scopes anonymize and rehydrate), then anonymize text. Keep the returned session_id: it is the conversation whose mappings live in the vault.
curl https://api.zanitize.nada.software/v1/anonymize \
-H "X-API-Key: $ZANITIZE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "Email Jane Doe at jane@acme.com", "surrogate_mode": "realistic"}'Send the anonymized text to any model. Then restore the originals in the model's answer with the same session:
curl https://api.zanitize.nada.software/v1/rehydrate \
-H "X-API-Key: $ZANITIZE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "Sure, I will email Maria Lopez today.", "session_id": "ses_123"}'Authentication
Send your key as X-API-Key: zk_live_... or Authorization: Bearer zk_live_.... Keys belong to one tenant and carry scopes such as anonymize, rehydrate, detect, proxy, mcp and files. Full keys are shown once; rotate them from the console.
Context headers
X-Zanitize-Session: conversation id (vault scopeconversation)X-Zanitize-Scope:request,conversationortenantX-Zanitize-Policy: policy id to applyX-Zanitize-Shadow: true: evaluate the policy without changing contentX-Zanitize-Surrogates:realistic(default),tokenoruniverse(Fun mode)X-Zanitize-Locale,X-Zanitize-App,X-Zanitize-Universe
LLM gateway
Change your SDK's base URL. Zanitize anonymizes messages, system prompts and tool results, calls the provider, and rehydrates text and tool-call arguments in the response, including streams.
OpenAI (Python)
from openai import OpenAI
client = OpenAI(
base_url="https://api.zanitize.nada.software/v1/proxy/openai/v1",
default_headers={"X-API-Key": os.environ["ZANITIZE_API_KEY"],
"X-Zanitize-Session": "ticket-4812"},
)
resp = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Summarize Jane Doe's ticket"}],
stream=True,
)Anthropic (Python)
import anthropic
client = anthropic.Anthropic(
base_url="https://api.zanitize.nada.software/v1/proxy/anthropic",
default_headers={"X-API-Key": os.environ["ZANITIZE_API_KEY"]},
)
msg = client.messages.create(
model="claude-sonnet-4-5", max_tokens=1024,
messages=[{"role": "user", "content": "Draft a reply to Jane Doe"}],
)Provider credentials come from your tenant configuration or are passed through from the request (Authorization for OpenAI, x-api-key for Anthropic).
MCP proxy
Register an upstream MCP server in the console, then point your MCP client at https://api.zanitize.nada.software/v1/mcp/<server_id> (Streamable HTTP). On tools/call Zanitize rehydrates arguments going to the tool and anonymizes the results going back to the model.
{
"mcpServers": {
"crm-via-zanitize": {
"type": "http",
"url": "https://api.zanitize.nada.software/v1/mcp/crm",
"headers": { "Authorization": "Bearer zk_live_..." }
}
}
}The console's MCP page generates this configuration for Claude Desktop, Cursor and other clients.
Policies
Policies are versioned YAML. Rules are evaluated in order and the first match wins. Criteria include entity_types, JSONPath fields, tools globs and tool_direction, apps, routes, destination_providers and destination_models.
Actions: allow, redact, mask, pseudonymize, tokenize, generalize, date_shift, hash, block. A block returns 422 policy_blocked unless the policy is in shadow mode.
id: default
default_action: pseudonymize
scope: conversation
ttl_seconds: 86400
surrogate_mode: realistic
shadow: false
allow_list: ["Acme Support"]
rules:
- id: mask-cards
entity_types: [CREDIT_CARD]
action: mask
params: {keep_last: 4}
- id: block-ssn-external
entity_types: [SSN]
destination_providers: ["openai"]
action: blockFiles
POST /v1/files/anonymize accepts multipart/form-data with .txt, .md, .csv, .json, .pdf, .docx, .png or .jpg. PDF/DOCX and OCR depend on optional server extras; without them the API answers 501 not_configured.
curl https://api.zanitize.nada.software/v1/files/anonymize \
-H "X-API-Key: $ZANITIZE_API_KEY" \
-F file=@contract.pdf -F output=textVault and retention
Mappings are encrypted per tenant. Inspect a session's counts with GET /v1/vault/sessions/{id}, crypto-shred it with DELETE, or shred the whole tenant with POST /v1/vault/shred. Retention (TTL) is set per policy and in tenant settings.
Errors
Every error has the same body:
{"error": {"code": "policy_blocked", "message": "SSN may not be sent to openai", "request_id": "req_..."}}401invalid credentials,403scope or role denied422 policy_blockeda policy blocked the content429 rate_limitedwithRetry-After501 not_configuredoptional integration missing,502 upstream_errorfrom a provider