{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amazon-comprehend/json-schema/amazon-comprehend-classify-document-request-schema.json",
  "title": "ClassifyDocumentRequest",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amazon-comprehend-operations-api-openapi.yml#/components/schemas/ClassifyDocumentRequest",
  "type": "object",
  "properties": {
    "Text": {
      "type": "string",
      "description": "The document text to be analyzed. If you enter text using this parameter, do not use the Bytes parameter."
    },
    "EndpointArn": {
      "type": "string",
      "description": "The Amazon Resource Number (ARN) of the endpoint. For prompt safety classification, Amazon Comprehend provides the endpoint ARN. For more information about prompt safety classifiers, see Prompt safety classification in the Amazon Comprehend Developer Guide For custom classification, you create an endpoint for your custom model. For more information, see Using Amazon Comprehend endpoints."
    },
    "Bytes": {
      "type": "string",
      "format": "byte",
      "description": "Use the Bytes parameter to input a text, PDF, Word or image file. When you classify a document using a custom model, you can also use the Bytes parameter to input an Amazon Textract DetectDocumentText or AnalyzeDocument output file. To classify a document using the prompt safety classifier, use the Text parameter for input. Provide the input document as a sequence of base64-encoded bytes. If your code uses an Amazon Web Services SDK to classify documents, the SDK may encode the document file bytes for you. The maximum length of this field depends on the input document type. For details, see In"
    },
    "DocumentReaderConfig": {
      "$ref": "#/$defs/DocumentReaderConfig"
    }
  },
  "required": [
    "EndpointArn"
  ],
  "$defs": {
    "DocumentReaderConfig": {
      "type": "object",
      "properties": {
        "DocumentReadAction": {
          "type": "string",
          "enum": [
            "TEXTRACT_DETECT_DOCUMENT_TEXT",
            "TEXTRACT_ANALYZE_DOCUMENT"
          ],
          "description": "This field defines the Amazon Textract API operation that Amazon Comprehend uses to extract text from PDF files and image files. Enter one of the following values: TEXTRACT_DETECT_DOCUMENT_TEXT - The Amazon Comprehend service uses the DetectDocumentText API operation. TEXTRACT_ANALYZE_DOCUMENT - The Amazon Comprehend service uses the AnalyzeDocument API operation."
        },
        "DocumentReadMode": {
          "type": "string",
          "enum": [
            "SERVICE_DEFAULT",
            "FORCE_DOCUMENT_READ_ACTION"
          ],
          "description": "Determines the text extraction actions for PDF files. Enter one of the following values: SERVICE_DEFAULT - use the Amazon Comprehend service defaults for PDF files. FORCE_DOCUMENT_READ_ACTION - Amazon Comprehend uses the Textract API specified by DocumentReadAction for all PDF files, including digital PDF files."
        },
        "FeatureTypes": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "TABLES",
              "FORMS"
            ]
          },
          "description": "Specifies the type of Amazon Textract features to apply. If you chose TEXTRACT_ANALYZE_DOCUMENT as the read action, you must specify one or both of the following values: TABLES - Returns additional information about any tables that are detected in the input document. FORMS - Returns additional information about any forms that are detected in the input document."
        }
      },
      "required": [
        "DocumentReadAction"
      ]
    }
  }
}