Anonymize text
Replaces or transforms detected PII in text using the supplied analysis results and configured anonymization operators.
/anonymizeAnonymizeText requests PII transformation from the internal Presidio APIServicev1.0.0Presidio APIExternal HTTP sidecar API for detecting PII in text and anonymizing detected
entities in the Chat and Rating AI agent pi...SubscribesAnalyzeText, AnonymizeText +3APIsOpenAPIOwnerplatform-engineering-teamDiagramOpen docs Anonymizer sidecar (POST /anonymize) using entity spans produced by Analyze textCommandv1.0.0Analyze textDetects PII entities in one text string or a batch, returning entity types, text offsets, confidence scores, and optiona...Ownerplatform-engineering-teamSchemaDiagramOpen docs. In BookWorm, Chat APIServicev1.0.0Chat APIInternal HTTP host for BookWorm's interactive multi-agent chat workflow,
agent discovery, and session persistence.
Ownerai-capabilities-teamDiagramRepositoryOpen docs and Rating APIServicev1.0.0Rating APIInternal HTTP and A2A gRPC service for collecting, listing, deleting, and
summarizing customer feedback for Catalog book...PublishesFeedbackCreatedIntegrationEvent, FeedbackDeletedIntegrationEventSubscribesCreateFeedback, DeleteFeedback +3APIsOpenAPI, AsyncAPIOwnercatalog-experience-teamDiagramRepositoryOpen docs call this endpoint to replace detected PII spans with <PII>.
Overview
| Property | Value |
|---|---|
| Bounded Context | Data Privacy (External Integration) |
| Owner Service | Presidio APIServicev1.0.0Presidio APIExternal HTTP sidecar API for detecting PII in text and anonymizing detected
entities in the Chat and Rating AI agent pi...SubscribesAnalyzeText, AnonymizeText +3APIsOpenAPIOwnerplatform-engineering-teamDiagramOpen docs (presidio-anonymizer) |
| Protocol / Format | HTTP POST /anonymize, application/json request and response |
| Gateway Endpoint | Internal sidecar POST /anonymize (not exposed via API Gateway) |
| Authentication & Authorization | None (internal service-to-service network boundary) |
| Idempotency / Concurrency | Stateless and naturally idempotent |
| Rate Limit / Caching | None (sidecar) |
| Contract Version | 1.0.0 |
Pass analyzer_results computed against the exact same text string. Stale character offsets cause Presidio Anonymizer to corrupt unrelated substrings or reject the request.
Request & Response Contract
Request Body (application/json)
| Name | Type | Required | Constraints | Description |
|---|---|---|---|---|
text | string | Yes | Exact string analyzed by Analyze textCommandv1.0.0Analyze textDetects PII entities in one text string or a batch, returning entity types, text offsets, confidence scores, and optiona...Ownerplatform-engineering-teamSchemaDiagramOpen docs | Original text containing PII spans to transform |
analyzer_results | object[] | Yes | Each item requires start (>= 0), end (> start), score (0.0-1.0), entity_type | PII detections returned by POST /analyze |
anonymizers | object | No | Map of DEFAULT or entity type to operator (replace, redact, mask, hash, encrypt) | Per-entity or fallback operator configuration (BookWorm defaults to replace with "<PII>") |
Success Response (200 OK)
| Name | Type | Required | Constraints | Description |
|---|---|---|---|---|
text | string | Yes | — | Transformed text after applying configured operators |
items | object[] | No | Each item includes start, end, entity_type, and optional operator / text | Applied operator metadata |
Behavior & Side Effects
- Stateless transformation: Transforms the supplied string in memory and stores no data.
- Default replacement: BookWorm configures the
DEFAULToperator as{"type": "replace", "new_value": "<PII>"}for all detected entities. - PII logging restriction: Raw
textrequest bodies must never be logged.
Error Responses
| Status / Code | Condition | Client Recovery Action |
|---|---|---|
400 Bad Request | Invalid request JSON payload | Fix the request body; do not retry unchanged |
422 Unprocessable Entity | Invalid input (e.g., empty text or invalid operator configuration) | Correct the input fields and retry |
Related Documentation
- Presidio APIServicev1.0.0Presidio APIExternal HTTP sidecar API for detecting PII in text and anonymizing detected entities in the Chat and Rating AI agent pi...SubscribesAnalyzeText, AnonymizeText +3APIsOpenAPIOwnerplatform-engineering-teamDiagramOpen docs — Overview of the Presidio Analyzer and Anonymizer sidecars.
- Analyze textCommandv1.0.0Analyze textDetects PII entities in one text string or a batch, returning entity types, text offsets, confidence scores, and optiona...Ownerplatform-engineering-teamSchemaDiagramOpen docs — Generate
analyzer_resultsspans before callingAnonymizeText. - Get anonymizersQueryv1.0.0Get anonymizersReturns the names of the built-in anonymization operators supported by Presidio Anonymizer.Ownerplatform-engineering-teamSchemaDiagramOpen docs — List supported anonymization operators.
Anonymize text schema
Request to transform text using previously detected PII entities.
Text to anonymize.
Optional operators keyed by DEFAULT or a PII entity type.
PII detections returned by the Analyzer.