SDK — DEVELOPERS

Privacy SDK — Python, Node.js, cURL Examples

Analyze, anonymize, encrypt, decrypt PII via REST API. Token-based pricing (200 free tokens). Bearer token auth. Sub-200ms response time. Code examples for Python, Node.js, JavaScript, cURL.

SDK & Code Examples

🐍 Python SDK

pip install anonym-legal
# Coming soon

import anonymize

client = anonymize.Client(
    api_key="YOUR_API_KEY",
    base_url="https://anonym.legal/api"
)

result = client.analyze(
    text="John Smith, SSN 123-45-6789",
    language="en"
)
print(result.entities)

📦 Node.js SDK

npm install @anonym-legal/sdk
# Coming soon

const { AnonymClient } = require(
  "@anonym-legal/sdk"
);

const client = new AnonymClient({
  apiKey: process.env.API_KEY
});

const result = await client.analyze({
  text: "Jane Doe, email jane@ex.com",
  language: "en"
});
console.log(result.entities);

API Endpoints

📋 /analyze

Detect & extract PII entities from text. Returns entity types, positions, confidence scores.

🔒 /anonymize

Replace detected PII with redactions, masks, hashes, or encryption. Returns anonymized text.

🔓 /decrypt

Decrypt previously encrypted PII. Requires decryption key. Bearer token auth.

cURL Example: Analyze

curl -X POST https://anonym.legal/api/presidio/analyze \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "John Smith works at Acme Corp",
    "language": "en"
  }'

# Response
{
  "entities": [
    {
      "type": "PERSON",
      "value": "John Smith",
      "start": 0,
      "end": 10,
      "score": 0.95
    },
    {
      "type": "ORGANIZATION",
      "value": "Acme Corp",
      "start": 21,
      "end": 30,
      "score": 0.88
    }
  ]
}

Token-Based Pricing

Free Plan

200 tokens/month. 1 token per 100 characters analyzed. Ideal for learning & testing.

Pro Plan

€3/1,000 tokens. Scale to 100K+ characters/month. Priority support.

Use Case: AI Pipeline Integration

LLM Privacy Layer

from langchain.chat_models import ChatOpenAI
from anonym_legal import AnonymClient

client = AnonymClient(api_key=KEY)
llm = ChatOpenAI(model="gpt-4")

# Customer input with PII
user_input = "My name is John, SSN 123-45-6789"

# Sanitize before LLM
sanitized = client.anonymize(
    text=user_input,
    method="mask"
)

# Safe to send to LLM
response = llm.predict(text=sanitized)

Watch the API In Action

See PII detection and anonymization via REST API and MCP Server

Get Started with API

Sign up for free API key. 200 tokens included. Code examples in Python, Node.js, cURL. Sub-200ms response time.

Get API Key

Also from anonym.legal

Enterprise Deployment → Anonymization Methods → Compliance Presets → EU Entity Coverage →

Frequently Asked Questions

Install via pip: pip install anonym-legal. Import and initialize: from anonym import Client; client = Client(api_key='your-token'). Call client.anonymize(text='John Smith, SSN 123-45-6789') to get anonymized output.

Currently Python and Node.js SDKs are available, plus cURL for any language. The REST API works with any HTTP client — Go (net/http), Java (OkHttp/HttpClient), Ruby (Net::HTTP), PHP (Guzzle), C# (HttpClient), Rust (reqwest).

Bearer token authentication. Generate your API token at anonym.legal/app/admin. Pass it as Authorization: Bearer YOUR_TOKEN header. The SDK handles authentication automatically when initialized with your token.