DetectEntities - Amazon Comprehend


Inspects text for named entities, and returns information about them. For more information, about named entities, see Detect Entities.

Request Syntax

{ "LanguageCode": "string", "Text": "string" }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.


The language of the input documents. You can specify any of the primary languages supported by Amazon Comprehend. All documents must be in the same language.

Type: String

Valid Values: en | es | fr | de | it | pt | ar | hi | ja | ko | zh | zh-TW

Required: Yes


A UTF-8 text string. Each string must contain fewer that 5,000 bytes of UTF-8 encoded characters.

Type: String

Length Constraints: Minimum length of 1.

Required: Yes

Response Syntax

{ "Entities": [ { "BeginOffset": number, "EndOffset": number, "Score": number, "Text": "string", "Type": "string" } ] }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.


A collection of entities identified in the input text. For each entity, the response provides the entity text, entity type, where the entity text begins and ends, and the level of confidence that Amazon Comprehend has in the detection. For a list of entity types, see Detect Entities.

Type: Array of Entity objects


For information about the errors that are common to all actions, see Common Errors.


An internal server error occurred. Retry your request.

HTTP Status Code: 500


The request is invalid.

HTTP Status Code: 400


The size of the input text exceeds the limit. Use a smaller document.

HTTP Status Code: 400


Amazon Comprehend can't process the language of the input text. For all custom entity recognition APIs (such as CreateEntityRecognizer), only English is accepted. For most other APIs, such as those for Custom Classification, Amazon Comprehend accepts text in all supported languages. For a list of supported languages, see Languages Supported in Amazon Comprehend.

HTTP Status Code: 400


Detect entities

If the input text is "Bob ordered two sandwiches and three ice cream cones today from a store in Seattle.", the operation returns the following:

{ "Entities": [ { "Text": "Bob", "Score": 1.0, "Type": "PERSON", "BeginOffset": 0, "EndOffset": 3 }, { "Text": "two", "Score": 1.0, "Type": "QUANTITY", "BeginOffset": 12, "EndOffset": 15 }, { "Text": "three", "Score": 1.0, "Type": "QUANTITY", "BeginOffset": 32, "EndOffset": 37 }, { "Text": "Today", "Score": 1.0, "Type": "DATE", "BeginOffset": 54, "EndOffset": 59 }, { "Text": "Seattle", "Score": 1.0, "Type": "LOCATION", "BeginOffset": 76, "EndOffset": 83 } ], }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: