---
title: "Group similar entities and synthesize replacements"
method: POST
path: "/api/Synthesis/group_synthesis"
tags: ["Synthesis"]
---

# Group similar entities and synthesize replacements

`POST /api/Synthesis/group_synthesis`

Group entities together based on the original text and generate synthetic replacements, returning redacted text with all entities in the same group receiving the same replacement value

## Request body

- GroupSynthesisRequest
  - `entities` NerEntity[]
    - `start` integer — Character offset where the entity starts in the text
    - `end` integer — Character offset where the entity ends in the text
    - `pythonStart` integer — Character offset where the entity starts (Python indexing)
    - `pythonEnd` integer — Character offset where the entity ends (Python indexing)
    - `label` string — The entity type label (e.g., NAME_GIVEN, EMAIL_ADDRESS)
    - `text` string — The detected entity text
    - `score` number, double — Confidence score between 0 and 1
    - `language` string, nullable — The language of the detected entity
    - `exampleRedaction` string, nullable — An example of what the redacted replacement text looks like
    - `head` string, nullable — Text immediately preceding the entity
    - `tail` string, nullable — Text immediately following the entity
    - `subNerEntities` NerEntity[], nullable — Sub-entities detected within this entity
  - `original_text` string
  - `generator_setup` object, nullable — A dictionary mapping entity type names to their transformation type (e.g. Redaction, Synthesis, Off).

## Response `200`

Returns grouped entities with replacements

- GroupSynthesisResponse
  - `redacted_text` string
  - `replacements` Replacement[]
    - `start` integer
    - `end` integer
    - `newStart` integer
    - `newEnd` integer
    - `pythonStart` integer, nullable
    - `pythonEnd` integer, nullable
    - `label` string
    - `text` string
    - `newText` string, nullable
    - `score` number, double
    - `language` string, nullable
    - `exampleRedaction` string, nullable
    - `jsonPath` string, nullable
    - `xmlPath` string, nullable
    - `head` string, nullable
    - `tail` string, nullable

---

[API](https://skmtc.net/tonic/apis/textual-api.md) · [All operations](https://skmtc.net/tonic/apis/textual-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/tonic/textual-api/revisions/41da8739a690/schema)
