{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amazon-comprehend/json-schema/amazon-comprehend-classify-document-response-schema.json",
  "title": "ClassifyDocumentResponse",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amazon-comprehend-amazon-comprehend-api-openapi.yml#/components/schemas/ClassifyDocumentResponse",
  "type": "object",
  "properties": {
    "Classes": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/DocumentClass"
      },
      "description": "The classes used by the document being analyzed. These are used for models trained in multi-class mode. 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. For prompt safety classification, the response includes only two classes (SAFE_PROMPT and UNSAFE_PROMPT), along with a confidence score for each class. The value range of the score is zero to one, where one is the highest confidence."
    },
    "Labels": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/DocumentLabel"
      },
      "description": "The labels used in 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."
    },
    "DocumentMetadata": {
      "$ref": "#/$defs/DocumentMetadata"
    },
    "DocumentType": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/DocumentTypeListItem"
      },
      "description": "The document type for each page in the input document. This field is present in the response only if your request includes the Byte parameter."
    },
    "Errors": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ErrorsListItem"
      },
      "description": "Page-level errors that the system detected while processing the input document. The field is empty if the system encountered no errors."
    },
    "Warnings": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/WarningsListItem"
      },
      "description": "Warnings detected while processing the input document. The response includes a warning if there is a mismatch between the input document type and the model type associated with the endpoint that you specified. The response can also include warnings for individual pages that have a mismatch. The field is empty if the system generated no warnings."
    }
  },
  "$defs": {
    "DocumentClass": {
      "type": "object",
      "properties": {
        "Name": {
          "type": "string",
          "description": "The name of the class."
        },
        "Score": {
          "type": "number",
          "description": "The confidence score that Amazon Comprehend has this class correctly attributed."
        },
        "Page": {
          "type": "integer",
          "description": "Page number in the input document. This field is present in the response only if your request includes the Byte parameter."
        }
      }
    },
    "DocumentLabel": {
      "type": "object",
      "properties": {
        "Name": {
          "type": "string",
          "description": "The name of the label."
        },
        "Score": {
          "type": "number",
          "description": "The confidence score that Amazon Comprehend has this label correctly attributed."
        },
        "Page": {
          "type": "integer",
          "description": "Page number where the label occurs. This field is present in the response only if your request includes the Byte parameter."
        }
      }
    },
    "DocumentMetadata": {
      "type": "object",
      "properties": {
        "Pages": {
          "type": "integer",
          "description": "Number of pages in the document."
        },
        "ExtractedCharacters": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ExtractedCharactersListItem"
          },
          "description": "List of pages in the document, with the number of characters extracted from each page."
        }
      }
    },
    "DocumentTypeListItem": {
      "type": "object",
      "properties": {
        "Page": {
          "type": "integer",
          "description": "Page number."
        },
        "Type": {
          "type": "string",
          "enum": [
            "NATIVE_PDF",
            "SCANNED_PDF",
            "MS_WORD",
            "IMAGE",
            "PLAIN_TEXT",
            "TEXTRACT_DETECT_DOCUMENT_TEXT_JSON",
            "TEXTRACT_ANALYZE_DOCUMENT_JSON"
          ],
          "description": "Document type."
        }
      }
    },
    "ErrorsListItem": {
      "type": "object",
      "properties": {
        "Page": {
          "type": "integer",
          "description": "Page number where the error occurred."
        },
        "ErrorCode": {
          "type": "string",
          "enum": [
            "TEXTRACT_BAD_PAGE",
            "TEXTRACT_PROVISIONED_THROUGHPUT_EXCEEDED",
            "PAGE_CHARACTERS_EXCEEDED",
            "PAGE_SIZE_EXCEEDED",
            "INTERNAL_SERVER_ERROR"
          ],
          "description": "Error code for the cause of the error."
        },
        "ErrorMessage": {
          "type": "string",
          "description": "Text message explaining the reason for the error."
        }
      }
    },
    "ExtractedCharactersListItem": {
      "type": "object",
      "properties": {
        "Page": {
          "type": "integer",
          "description": "Page number."
        },
        "Count": {
          "type": "integer",
          "description": "Number of characters extracted from each page."
        }
      }
    },
    "WarningsListItem": {
      "type": "object",
      "properties": {
        "Page": {
          "type": "integer",
          "description": "Page number in the input document."
        },
        "WarnCode": {
          "type": "string",
          "enum": [
            "INFERENCING_PLAINTEXT_WITH_NATIVE_TRAINED_MODEL",
            "INFERENCING_NATIVE_DOCUMENT_WITH_PLAINTEXT_TRAINED_MODEL"
          ],
          "description": "The type of warning."
        },
        "WarnMessage": {
          "type": "string",
          "description": "Text message associated with the warning."
        }
      }
    }
  }
}