common.skipToContent

API Referentie

Integreer anonymisatie in uw applicaties

Volledige REST API voor programmatic PII-detectie en anonymisatie.


Basis-URL

https://anonymize.today/api

Alle API-eindpunten zijn relatief ten opzichte van deze basis-URL. Bijvoorbeeld, het analyse-eindpunt is https://anonymize.today/api/presidio/analyze.


Authenticatie

Authenticeer API-verzoeken met behulp van Bearer-tokens:

Authorization: Bearer YOUR_API_TOKEN

Een API-token verkrijgen

  1. Log in op uw anonymize.today-account
  2. Ga naar Instellingen → Account → API-tokens
  3. Klik op Nieuwe Token Genereren
  4. Kopieer en bewaar uw token veilig (het wordt niet opnieuw weergegeven)

Beveiligingsopmerking

Exposeer uw API-token nooit in client-side code of openbare repositories. Gebruik omgevingsvariabelen en server-side verzoeken.

Token in verzoeken

TypeScript

const response = await fetch('https://anonymize.today/api/presidio/analyze', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.ANONYMIZE_API_TOKEN}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ text, entities }),
});

Python

import os
import requests

headers = {
    "Authorization": f"Bearer {os.environ['ANONYMIZE_API_TOKEN']}",
    "Content-Type": "application/json"
}

response = requests.post(
    "https://anonymize.today/api/presidio/analyze",
    headers=headers,
    json={"text": text, "entities": entities}
)

cURL

curl -X POST https://anonymize.today/api/presidio/analyze \
  -H "Authorization: Bearer $ANONYMIZE_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"text": "John Doe works at Acme Corp", "entities": ["PERSON", "ORGANIZATION"]}'

Rate Limieten

Eindpunt TypeSnelheidslimietBurst-toelating: 10 verzoeken
Authentication3 requests/second5 requests
Analysis & Anonymization30 requests/second50 requests
Presets & Settings10 requests/second20 requests

Wanneer de snelheid beperkt is, retourneert de API 429 Te Veel Verzoeken met een Retry-After-header die aangeeft wanneer u opnieuw kunt proberen.


Kern Eindpunten

Tekst Analyseren

Detecteer PII-entiteiten in tekst. Retourneert posities en types van gedetecteerde entiteiten.

Tekst Anonimiseren

Anonimiseer gedetecteerde PII-entiteiten met verschillende operators.

Tekst Deanonimiseren

Herstel versleutelde entiteiten naar hun oorspronkelijke waarden met behulp van dezelfde versleutelingssleutel.


Anonimiseringsoperators

OperatorBeschrijvingOmkeerbaarVoorbeeld
replaceVervangen door placeholderNoJohn → [PERSON]
maskDeels maskeren van karaktersNojohn@email.com → j***@email.com
redactVolledig verwijderenNoJohn → (empty)
hashEenrichtings SHA-256-hashNoJohn → a3f2b1c4...
encryptAES-256-GCM-versleutelingYesJohn → [ENC:...]

Operatorconfiguraties

// Replace operator
{ "type": "replace", "new_value": "[PERSON]" }

// Mask operator
{
  "type": "mask",
  "masking_char": "*",
  "chars_to_mask": 5,
  "from_end": false
}

// Hash operator
{ "type": "hash", "hash_type": "sha256" }

// Encrypt operator (requires encryption key in user settings)
{ "type": "encrypt" }

// Redact operator
{ "type": "redact" }

Voorinstellingen API


Entiteitstypen

anonymize.today ondersteunt 256 entiteitstypen in 10 categorieën:

Personal

PERSON, EMAIL_ADDRESS, PHONE_NUMBER

Financial

CREDIT_CARD, IBAN_CODE, SWIFT_CODE, CRYPTO

Location

LOCATION, ADDRESS, COORDINATES

Government

SSN, PASSPORT, DRIVER_LICENSE, NATIONAL_ID

Contact

URL, DOMAIN_NAME

Technical

IP_ADDRESS, MAC_ADDRESS

Temporal

DATE_TIME, AGE

Organizational

ORGANIZATION, JOB_TITLE

Medical

MEDICAL_LICENSE, HEALTH_ID

Custom

User-defined patterns

Bekijk de complete lijst van entiteitstypen in de documentatie van de Voorinstellingen. Presets documentation.


Ondersteunde Talen

De API ondersteunt 27 talen voor PII-herkenning:

CodeTaalEngine
enEnglishspaCy
deGermanspaCy
esSpanishspaCy
frFrenchspaCy
itItalianspaCy
ptPortuguesespaCy
nlDutchspaCy
plPolishspaCy
ruRussianspaCy
jaJapanesespaCy
zhChinesespaCy
koKoreanspaCy
arArabicTransformer
hiHindiTransformer
trTurkishTransformer

Aanvullende talen: Roemeens, Grieks, Kroatisch, Sloveens, Macedonisch, Zweeds, Deens, Noors, Fins, Oekraïens, Litouws, Catalaans


Foutafhandeling

Standaard HTTP-statuscodes:

StatusBetekenisBeschrijving
200OKRequest succeeded
201CreatedResource created successfully
400Bad Request400 - Ongeldig Verzoek (ongeldige parameters)
401Unauthorized401 - Niet Geautoriseerd (ongeldig of ontbrekend token)
402Payment RequiredInsufficient tokens
403ForbiddenAccess denied to resource
404Not FoundResource not found
429Too Many Requests429 - Rate Beperkt (te veel verzoeken)
500Internal Error500 - Serverfout (neem contact op met ondersteuning)

Foutantwoordformaat

{
  "error": {
    "code": "INSUFFICIENT_TOKENS",
    "message": "You need 5 tokens but only have 2 remaining",
    "details": {
      "required": 5,
      "available": 2
    }
  }
}

Volledige Voorbeelden

TypeScript/Node.js

import fetch from 'node-fetch';

const API_BASE = 'https://anonymize.today/api';
const API_TOKEN = process.env.ANONYMIZE_API_TOKEN;

async function analyzeAndAnonymize(text: string) {
  // Step 1: Analyze
  const analyzeResponse = await fetch(`${API_BASE}/presidio/analyze`, {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${API_TOKEN}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      text,
      entities: ['PERSON', 'EMAIL_ADDRESS', 'PHONE_NUMBER'],
      language: 'en',
    }),
  });

  const { results } = await analyzeResponse.json();

  if (results.length === 0) {
    return { text, anonymized: false };
  }

  // Step 2: Anonymize
  const anonymizeResponse = await fetch(`${API_BASE}/presidio/anonymize`, {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${API_TOKEN}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      text,
      analyzer_results: results,
      anonymizers: {
        DEFAULT: { type: 'replace', new_value: '[REDACTED]' },
      },
    }),
  });

  return anonymizeResponse.json();
}

// Usage
const result = await analyzeAndAnonymize('Contact John Doe at john@example.com');
console.log(result.text); // "Contact [REDACTED] at [REDACTED]"

Python

import os
import requests

API_BASE = "https://anonymize.today/api"
API_TOKEN = os.environ["ANONYMIZE_API_TOKEN"]

def analyze_and_anonymize(text: str) -> dict:
    headers = {
        "Authorization": f"Bearer {API_TOKEN}",
        "Content-Type": "application/json"
    }

    # Step 1: Analyze
    analyze_response = requests.post(
        f"{API_BASE}/presidio/analyze",
        headers=headers,
        json={
            "text": text,
            "entities": ["PERSON", "EMAIL_ADDRESS", "PHONE_NUMBER"],
            "language": "en"
        }
    )
    results = analyze_response.json()["results"]

    if not results:
        return {"text": text, "anonymized": False}

    # Step 2: Anonymize
    anonymize_response = requests.post(
        f"{API_BASE}/presidio/anonymize",
        headers=headers,
        json={
            "text": text,
            "analyzer_results": results,
            "anonymizers": {
                "DEFAULT": {"type": "replace", "new_value": "[REDACTED]"}
            }
        }
    )

    return anonymize_response.json()

# Usage
result = analyze_and_anonymize("Contact John Doe at john@example.com")
print(result["text"])  # "Contact [REDACTED] at [REDACTED]"

Related Documentation

Laatst bijgewerkt: maart 2026