ClassifyDocument - Amazon Comprehend


Creates a new document classification request to analyze a single document in real-time, using a previously created and trained custom model and an endpoint.

Request Syntax

{ "EndpointArn": "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 Amazon Resource Number (ARN) of the endpoint. For information about endpoints, see Managing endpoints.

Type: String

Length Constraints: Maximum length of 256.

Pattern: arn:aws(-[^:]+)?:comprehend:[a-zA-Z0-9-]*:[0-9]{12}:document-classifier-endpoint/[a-zA-Z0-9](-*[a-zA-Z0-9])*

Required: Yes


The document text to be analyzed.

Type: String

Length Constraints: Minimum length of 1.

Required: Yes

Response Syntax

{ "Classes": [ { "Name": "string", "Score": number } ], "Labels": [ { "Name": "string", "Score": number } ] }

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.


The classes used by the document being analyzed. These are used for multi-class trained models. Individual classes are mutually exclusive and each document is expected to have only a single class assigned to it. For example, an animal can be a dog or a cat, but not both at the same time.

Type: Array of DocumentClass objects


The labels used the document being analyzed. These are used for multi-label trained models. Individual labels represent different categories that are related in some manner and are not mutually exclusive. For example, a movie can be just an action movie, or it can be an action movie, a science fiction movie, and a comedy, all at the same time.

Type: Array of DocumentLabel 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 specified resource is not available. Check the resource and try your request again.

HTTP Status Code: 400


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

HTTP Status Code: 400

See Also

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