# Entity linking

Use the REST API to link entity values.

## Group entities

> Group entities together based on the original text

```json
{"openapi":"3.0.4","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","requestBody":{"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/GroupRequest"}],"description":"Request to group detected entities using entity linking."}},"text/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/GroupRequest"}],"description":"Request to group detected entities using entity linking."}},"application/*+json":{"schema":{"allOf":[{"$ref":"#/components/schemas/GroupRequest"}],"description":"Request to group detected entities using entity linking."}}}},"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"}}}}}}}},"components":{"schemas":{"GroupRequest":{"type":"object","properties":{"entities":{"type":"array","items":{"$ref":"#/components/schemas/NerEntity"}},"original_text":{"type":"string"}},"additionalProperties":false,"description":"Request to group detected entities using entity linking."},"NerEntity":{"type":"object","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","nullable":true},"exampleRedaction":{"type":"string","description":"An example of what the redacted replacement text looks like","nullable":true},"head":{"type":"string","description":"Text immediately preceding the entity","nullable":true},"tail":{"type":"string","description":"Text immediately following the entity","nullable":true},"subNerEntities":{"type":"array","items":{"$ref":"#/components/schemas/NerEntity"},"description":"Sub-entities detected within this entity","nullable":true}},"additionalProperties":false,"description":"A detected named entity with its position, label, confidence score, and optional surrounding context."},"GroupResponse":{"type":"object","properties":{"groups":{"type":"array","items":{"$ref":"#/components/schemas/EntityGroup"}}},"additionalProperties":false,"description":"Response containing entity groups produced by entity linking."},"EntityGroup":{"type":"object","properties":{"pii_type":{"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"}],"description":"The type of personally identifiable information (PII) detected, such as NAME_GIVEN, EMAIL_ADDRESS, or CREDIT_CARD."},"entities":{"type":"array","items":{"$ref":"#/components/schemas/NerEntity"}},"representative":{"type":"string","nullable":true}},"additionalProperties":false},"PiiTypeEnum":{"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"],"type":"string","description":"The type of personally identifiable information (PII) detected, such as NAME_GIVEN, EMAIL_ADDRESS, or CREDIT_CARD."}}}}
```


---

# Agent Instructions: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
