> For the complete documentation index, see [llms.txt](https://docs.tonic.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tonic.ai/textual/tonic-textual-api/textual-rest-api/entity-linking.md).

# Entity linking

Use the Tonic Textual REST API to link entity values.

## Group entities

> Group entities together based on the original text

```json
{"openapi":"3.1.1","info":{"title":"Textual API","version":"vDev"},"tags":[{"name":"Synthesis","description":"Group detected entities for consistent synthesis across documents."}],"security":[{}],"paths":{"/api/Synthesis/group":{"post":{"tags":["Synthesis"],"summary":"Group entities","description":"Group entities together based on the original text","responses":{"200":{"description":"Returns grouped entities","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/GroupResponse"}},"application/json":{"schema":{"$ref":"#/components/schemas/GroupResponse"}},"text/json":{"schema":{"$ref":"#/components/schemas/GroupResponse"}}}}},"requestBody":{"content":{"application/json":{"schema":{"description":"Request to group detected entities using entity linking.","allOf":[{"$ref":"#/components/schemas/GroupRequest"}]}},"text/json":{"schema":{"description":"Request to group detected entities using entity linking.","allOf":[{"$ref":"#/components/schemas/GroupRequest"}]}},"application/*+json":{"schema":{"description":"Request to group detected entities using entity linking.","allOf":[{"$ref":"#/components/schemas/GroupRequest"}]}}}}}}},"components":{"schemas":{"GroupResponse":{"type":"object","description":"Response containing entity groups produced by entity linking.","properties":{"groups":{"type":"array","items":{"$ref":"#/components/schemas/EntityGroup"}}},"additionalProperties":false},"EntityGroup":{"type":"object","properties":{"pii_type":{"description":"The type of personally identifiable information (PII) detected, such as NAME_GIVEN, EMAIL_ADDRESS, or CREDIT_CARD.","enum":["NUMERIC_VALUE","LANGUAGE","MONEY","PRODUCT","EVENT","LAW","US_PASSPORT","MEDICAL_LICENSE","DATE_TIME","US_BANK_NUMBER","NRP","US_SSN","IP_ADDRESS","ORGANIZATION","PHONE_NUMBER","US_ITIN","LOCATION","LOCATION_ADDRESS","LOCATION_CITY","LOCATION_STATE","LOCATION_ZIP","LOCATION_COUNTRY","CREDIT_CARD","EMAIL_ADDRESS","IBAN_CODE","URL","NAME_GIVEN","NAME_FAMILY","GENDER_IDENTIFIER","OCCUPATION","PERSON_AGE","DOB","CC_EXP","CVV","MICR_CODE","HEALTHCARE_ID","NUMERIC_PII","LOCATION_COMPLETE_ADDRESS","US_ROUTING_TRANSIT_NUMBER"],"allOf":[{"$ref":"#/components/schemas/PiiTypeEnum"}]},"entities":{"type":"array","items":{"$ref":"#/components/schemas/NerEntity"}},"representative":{"type":"string"}},"additionalProperties":false},"PiiTypeEnum":{"type":"string","description":"The type of personally identifiable information (PII) detected, such as NAME_GIVEN, EMAIL_ADDRESS, or CREDIT_CARD.","enum":["NUMERIC_VALUE","LANGUAGE","MONEY","PRODUCT","EVENT","LAW","US_PASSPORT","MEDICAL_LICENSE","DATE_TIME","US_BANK_NUMBER","NRP","US_SSN","IP_ADDRESS","ORGANIZATION","PHONE_NUMBER","US_ITIN","LOCATION","LOCATION_ADDRESS","LOCATION_CITY","LOCATION_STATE","LOCATION_ZIP","LOCATION_COUNTRY","CREDIT_CARD","EMAIL_ADDRESS","IBAN_CODE","URL","NAME_GIVEN","NAME_FAMILY","GENDER_IDENTIFIER","OCCUPATION","PERSON_AGE","DOB","CC_EXP","CVV","MICR_CODE","HEALTHCARE_ID","NUMERIC_PII","LOCATION_COMPLETE_ADDRESS","US_ROUTING_TRANSIT_NUMBER"]},"NerEntity":{"type":"object","description":"A detected named entity with its position, label, confidence score, and optional surrounding context.","properties":{"start":{"type":"integer","description":"Character offset where the entity starts in the text","format":"int32"},"end":{"type":"integer","description":"Character offset where the entity ends in the text","format":"int32"},"pythonStart":{"type":"integer","description":"Character offset where the entity starts (Python indexing)","format":"int32"},"pythonEnd":{"type":"integer","description":"Character offset where the entity ends (Python indexing)","format":"int32"},"label":{"type":"string","description":"The entity type label (e.g., NAME_GIVEN, EMAIL_ADDRESS)"},"text":{"type":"string","description":"The detected entity text"},"score":{"type":"number","description":"Confidence score between 0 and 1","format":"double"},"language":{"type":"string","description":"The language of the detected entity"},"exampleRedaction":{"type":"string","description":"An example of what the redacted replacement text looks like"},"head":{"type":"string","description":"Text immediately preceding the entity"},"tail":{"type":"string","description":"Text immediately following the entity"},"subNerEntities":{"type":"array","description":"Sub-entities detected within this entity","items":{"$ref":"#/components/schemas/NerEntity"}}},"additionalProperties":false},"GroupRequest":{"type":"object","description":"Request to group detected entities using entity linking.","properties":{"entities":{"type":"array","items":{"$ref":"#/components/schemas/NerEntity"}},"original_text":{"type":"string"}},"additionalProperties":false}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.tonic.ai/textual/tonic-textual-api/textual-rest-api/entity-linking.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
