Calling the REST API from JavaScript and Python
Source: anonym.community research
Summary
Developers integrating PII anonymization into data pipelines call the REST API directly from their own code. The API takes JSON over HTTPS with a Bearer token, so any HTTP client works: fetch in Node.js and requests in Python. There is no SDK package. The client code is a few lines per endpoint; error handling and retries stay in the caller's code.
Evidence & Data Points
- Endpoints: POST /api/presidio/analyze, /anonymize, /deanonymize, /batch and /image.
- Batch limit per call: 5 texts (Basic), 10 (Pro), 50 (Business).
Solution
The Solution: How anonym.legal Addresses This
JavaScript (Node.js)
Send POST /api/presidio/analyze with fetch, the header Authorization: Bearer YOUR_API_KEY and a JSON body with text and language. The response holds results with entity_type, start, end and score. Pass them as analyzer_results to POST /api/presidio/anonymize.
Python
The same two calls with requests.post(...) and .json().
Several texts at once
POST /api/presidio/batch takes an array of texts per call. Code examples for Python, Node.js and cURL: anonym.digital/sdk/.
Compliance Context
Compliance Mapping
This integration pattern supports GDPR Article 25 (data protection by design — anonymize PII before it moves on in a pipeline) and GDPR Article 28 (processor obligations — the integration is a small, documented set of HTTPS calls). Keep API keys out of source code.