{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/amazon-textract/json-schema/amazon-textract-get-lending-analysis-response-schema.json",
  "title": "GetLendingAnalysisResponse",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amazon-textract-operations-api-openapi.yml#/components/schemas/GetLendingAnalysisResponse",
  "type": "object",
  "properties": {
    "DocumentMetadata": {
      "$ref": "#/$defs/DocumentMetadata"
    },
    "JobStatus": {
      "type": "string",
      "enum": [
        "IN_PROGRESS",
        "SUCCEEDED",
        "FAILED",
        "PARTIAL_SUCCESS"
      ],
      "description": "The current status of the lending analysis job."
    },
    "NextToken": {
      "type": "string",
      "description": "If the response is truncated, Amazon Textract returns this token. You can use this token in the subsequent request to retrieve the next set of lending results."
    },
    "Results": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/LendingResult"
      },
      "description": "Holds the information returned by one of AmazonTextract's document analysis operations for the pinstripe."
    },
    "Warnings": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Warning"
      },
      "description": "A list of warnings that occurred during the lending analysis operation."
    },
    "StatusMessage": {
      "type": "string",
      "description": "Returns if the lending analysis job could not be completed. Contains explanation for what error occurred."
    },
    "AnalyzeLendingModelVersion": {
      "type": "string",
      "description": "The current model version of the Analyze Lending API."
    }
  },
  "$defs": {
    "AnalyzeIDDetections": {
      "type": "object",
      "properties": {
        "Text": {
          "type": "string",
          "description": "Text of either the normalized field or value associated with it."
        },
        "NormalizedValue": {
          "$ref": "#/$defs/NormalizedValue"
        },
        "Confidence": {
          "type": "number",
          "description": "The confidence score of the detected text."
        }
      },
      "required": [
        "Text"
      ]
    },
    "Block": {
      "type": "object",
      "properties": {
        "BlockType": {
          "type": "string",
          "enum": [
            "KEY_VALUE_SET",
            "PAGE",
            "LINE",
            "WORD",
            "TABLE",
            "CELL",
            "SELECTION_ELEMENT",
            "MERGED_CELL",
            "TITLE",
            "QUERY",
            "QUERY_RESULT",
            "SIGNATURE",
            "TABLE_TITLE",
            "TABLE_FOOTER",
            "LAYOUT_TEXT",
            "LAYOUT_TITLE",
            "LAYOUT_HEADER",
            "LAYOUT_FOOTER",
            "LAYOUT_SECTION_HEADER",
            "LAYOUT_PAGE_NUMBER",
            "LAYOUT_LIST",
            "LAYOUT_FIGURE",
            "LAYOUT_TABLE",
            "LAYOUT_KEY_VALUE"
          ],
          "description": "The type of text item that's recognized. In operations for text detection, the following types are returned: PAGE - Contains a list of the LINE Block objects that are detected on a document page. WORD - A word detected on a document page. A word is one or more ISO basic Latin script characters that aren't separated by spaces. LINE - A string of space-delimited, contiguous words that are detected on a document page. In text analysis operations, the following types are returned: PAGE - Contains a list of child Block objects that are detected on a document page. KEY_VALUE_SET - Stores the KEY and"
        },
        "Confidence": {
          "type": "number",
          "description": "The confidence score that Amazon Textract has in the accuracy of the recognized text and the accuracy of the geometry points around the recognized text."
        },
        "Text": {
          "type": "string",
          "description": "The word or line of text that's recognized by Amazon Textract."
        },
        "TextType": {
          "type": "string",
          "enum": [
            "HANDWRITING",
            "PRINTED"
          ],
          "description": "The kind of text that Amazon Textract has detected. Can check for handwritten text and printed text."
        },
        "RowIndex": {
          "type": "integer",
          "description": "The row in which a table cell is located. The first row position is 1. RowIndex isn't returned by DetectDocumentText and GetDocumentTextDetection."
        },
        "ColumnIndex": {
          "type": "integer",
          "description": "The column in which a table cell appears. The first column position is 1. ColumnIndex isn't returned by DetectDocumentText and GetDocumentTextDetection."
        },
        "RowSpan": {
          "type": "integer",
          "description": "The number of rows that a table cell spans. RowSpan isn't returned by DetectDocumentText and GetDocumentTextDetection."
        },
        "ColumnSpan": {
          "type": "integer",
          "description": "The number of columns that a table cell spans. ColumnSpan isn't returned by DetectDocumentText and GetDocumentTextDetection."
        },
        "Geometry": {
          "$ref": "#/$defs/Geometry"
        },
        "Id": {
          "type": "string",
          "description": "The identifier for the recognized text. The identifier is only unique for a single operation."
        },
        "Relationships": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Relationship"
          },
          "description": "A list of relationship objects that describe how blocks are related to each other. For example, a LINE block object contains a CHILD relationship type with the WORD blocks that make up the line of text. There aren't Relationship objects in the list for relationships that don't exist, such as when the current block has no child blocks."
        },
        "EntityTypes": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "KEY",
              "VALUE",
              "COLUMN_HEADER",
              "TABLE_TITLE",
              "TABLE_FOOTER",
              "TABLE_SECTION_TITLE",
              "TABLE_SUMMARY",
              "STRUCTURED_TABLE",
              "SEMI_STRUCTURED_TABLE"
            ]
          },
          "description": "The type of entity. The following entity types can be returned by FORMS analysis: KEY - An identifier for a field on the document. VALUE - The field text. The following entity types can be returned by TABLES analysis: COLUMN_HEADER - Identifies a cell that is a header of a column. TABLE_TITLE - Identifies a cell that is a title within the table. TABLE_SECTION_TITLE - Identifies a cell that is a title of a section within a table. A section title is a cell that typically spans an entire row above a section. TABLE_FOOTER - Identifies a cell that is a footer of a table. TABLE_SUMMARY - Identifies "
        },
        "SelectionStatus": {
          "type": "string",
          "enum": [
            "SELECTED",
            "NOT_SELECTED"
          ],
          "description": "The selection status of a selection element, such as an option button or check box."
        },
        "Page": {
          "type": "integer",
          "description": "The page on which a block was detected. Page is returned by synchronous and asynchronous operations. Page values greater than 1 are only returned for multipage documents that are in PDF or TIFF format. A scanned image (JPEG/PNG) provided to an asynchronous operation, even if it contains multiple document pages, is considered a single-page document. This means that for scanned images the value of Page is always 1."
        },
        "Query": {
          "$ref": "#/$defs/Query"
        }
      }
    },
    "BoundingBox": {
      "type": "object",
      "properties": {
        "Width": {
          "type": "number",
          "description": "The width of the bounding box as a ratio of the overall document page width."
        },
        "Height": {
          "type": "number",
          "description": "The height of the bounding box as a ratio of the overall document page height."
        },
        "Left": {
          "type": "number",
          "description": "The left coordinate of the bounding box as a ratio of overall document page width."
        },
        "Top": {
          "type": "number",
          "description": "The top coordinate of the bounding box as a ratio of overall document page height."
        }
      }
    },
    "DocumentMetadata": {
      "type": "object",
      "properties": {
        "Pages": {
          "type": "integer",
          "description": "The number of pages that are detected in the document."
        }
      }
    },
    "ExpenseCurrency": {
      "type": "object",
      "properties": {
        "Code": {
          "type": "string",
          "description": "Currency code for detected currency. the current supported codes are: USD EUR GBP CAD INR JPY CHF AUD CNY BZR SEK HKD"
        },
        "Confidence": {
          "type": "number",
          "description": "Percentage confideence in the detected currency."
        }
      }
    },
    "ExpenseDetection": {
      "type": "object",
      "properties": {
        "Text": {
          "type": "string",
          "description": "The word or line of text recognized by Amazon Textract"
        },
        "Geometry": {
          "$ref": "#/$defs/Geometry"
        },
        "Confidence": {
          "type": "number",
          "description": "The confidence in detection, as a percentage"
        }
      }
    },
    "ExpenseDocument": {
      "type": "object",
      "properties": {
        "ExpenseIndex": {
          "type": "integer",
          "description": "Denotes which invoice or receipt in the document the information is coming from. First document will be 1, the second 2, and so on."
        },
        "SummaryFields": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ExpenseField"
          },
          "description": "Any information found outside of a table by Amazon Textract."
        },
        "LineItemGroups": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/LineItemGroup"
          },
          "description": "Information detected on each table of a document, seperated into LineItems."
        },
        "Blocks": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Block"
          },
          "description": "This is a block object, the same as reported when DetectDocumentText is run on a document. It provides word level recognition of text."
        }
      }
    },
    "ExpenseField": {
      "type": "object",
      "properties": {
        "Type": {
          "$ref": "#/$defs/ExpenseType"
        },
        "LabelDetection": {
          "$ref": "#/$defs/ExpenseDetection"
        },
        "ValueDetection": {
          "$ref": "#/$defs/ExpenseDetection"
        },
        "PageNumber": {
          "type": "integer",
          "description": "The page number the value was detected on."
        },
        "Currency": {
          "$ref": "#/$defs/ExpenseCurrency"
        },
        "GroupProperties": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ExpenseGroupProperty"
          },
          "description": "Shows which group a response object belongs to, such as whether an address line belongs to the vendor's address or the recipent's address."
        }
      }
    },
    "ExpenseGroupProperty": {
      "type": "object",
      "properties": {
        "Types": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Informs you on whether the expense group is a name or an address."
        },
        "Id": {
          "type": "string",
          "description": "Provides a group Id number, which will be the same for each in the group."
        }
      }
    },
    "ExpenseType": {
      "type": "object",
      "properties": {
        "Text": {
          "type": "string",
          "description": "The word or line of text detected by Amazon Textract."
        },
        "Confidence": {
          "type": "number",
          "description": "The confidence of accuracy, as a percentage."
        }
      }
    },
    "Extraction": {
      "type": "object",
      "properties": {
        "LendingDocument": {
          "$ref": "#/$defs/LendingDocument"
        },
        "ExpenseDocument": {
          "$ref": "#/$defs/ExpenseDocument"
        },
        "IdentityDocument": {
          "$ref": "#/$defs/IdentityDocument"
        }
      }
    },
    "Geometry": {
      "type": "object",
      "properties": {
        "BoundingBox": {
          "$ref": "#/$defs/BoundingBox"
        },
        "Polygon": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Point"
          },
          "description": "Within the bounding box, a fine-grained polygon around the recognized item."
        },
        "RotationAngle": {
          "type": "number",
          "description": "Provides a numerical value corresponding to the rotation of the WORD block. Possible values are 0, 90, 180, and 270."
        }
      }
    },
    "IdentityDocument": {
      "type": "object",
      "properties": {
        "DocumentIndex": {
          "type": "integer",
          "description": "Denotes the placement of a document in the IdentityDocument list. The first document is marked 1, the second 2 and so on."
        },
        "IdentityDocumentFields": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/IdentityDocumentField"
          },
          "description": "The structure used to record information extracted from identity documents. Contains both normalized field and value of the extracted text."
        },
        "Blocks": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Block"
          },
          "description": "Individual word recognition, as returned by document detection."
        }
      }
    },
    "IdentityDocumentField": {
      "type": "object",
      "properties": {
        "Type": {
          "$ref": "#/$defs/AnalyzeIDDetections"
        },
        "ValueDetection": {
          "$ref": "#/$defs/AnalyzeIDDetections"
        }
      }
    },
    "LendingDetection": {
      "type": "object",
      "properties": {
        "Text": {
          "type": "string",
          "description": "The text extracted for a detected value in a lending document."
        },
        "SelectionStatus": {
          "type": "string",
          "enum": [
            "SELECTED",
            "NOT_SELECTED"
          ],
          "description": "The selection status of a selection element, such as an option button or check box."
        },
        "Geometry": {
          "$ref": "#/$defs/Geometry"
        },
        "Confidence": {
          "type": "number",
          "description": "The confidence level for the text of a detected value in a lending document."
        }
      }
    },
    "LendingDocument": {
      "type": "object",
      "properties": {
        "LendingFields": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/LendingField"
          },
          "description": "An array of LendingField objects."
        },
        "SignatureDetections": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/SignatureDetection"
          },
          "description": "A list of signatures detected in a lending document."
        }
      }
    },
    "LendingField": {
      "type": "object",
      "properties": {
        "Type": {
          "type": "string",
          "description": "The type of the lending document."
        },
        "KeyDetection": {
          "$ref": "#/$defs/LendingDetection"
        },
        "ValueDetections": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/LendingDetection"
          },
          "description": "An array of LendingDetection objects."
        }
      }
    },
    "LendingResult": {
      "type": "object",
      "properties": {
        "Page": {
          "type": "integer",
          "description": "The page number for a page, with regard to whole submission."
        },
        "PageClassification": {
          "$ref": "#/$defs/PageClassification"
        },
        "Extractions": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Extraction"
          },
          "description": "An array of Extraction to hold structured data. e.g. normalized key value pairs instead of raw OCR detections ."
        }
      }
    },
    "LineItemFields": {
      "type": "object",
      "properties": {
        "LineItemExpenseFields": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ExpenseField"
          },
          "description": "ExpenseFields used to show information from detected lines on a table."
        }
      }
    },
    "LineItemGroup": {
      "type": "object",
      "properties": {
        "LineItemGroupIndex": {
          "type": "integer",
          "description": "The number used to identify a specific table in a document. The first table encountered will have a LineItemGroupIndex of 1, the second 2, etc."
        },
        "LineItems": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/LineItemFields"
          },
          "description": "The breakdown of information on a particular line of a table."
        }
      }
    },
    "NormalizedValue": {
      "type": "object",
      "properties": {
        "Value": {
          "type": "string",
          "description": "The value of the date, written as Year-Month-DayTHour:Minute:Second."
        },
        "ValueType": {
          "type": "string",
          "enum": [
            "DATE"
          ],
          "description": "The normalized type of the value detected. In this case, DATE."
        }
      }
    },
    "PageClassification": {
      "type": "object",
      "properties": {
        "PageType": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Prediction"
          },
          "description": "The class, or document type, assigned to a detected Page object. The class, or document type, assigned to a detected Page object."
        },
        "PageNumber": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Prediction"
          },
          "description": "The page number the value was detected on, relative to Amazon Textract's starting position."
        }
      },
      "required": [
        "PageType",
        "PageNumber"
      ]
    },
    "Point": {
      "type": "object",
      "properties": {
        "X": {
          "type": "number",
          "description": "The value of the X coordinate for a point on a Polygon."
        },
        "Y": {
          "type": "number",
          "description": "The value of the Y coordinate for a point on a Polygon."
        }
      }
    },
    "Prediction": {
      "type": "object",
      "properties": {
        "Value": {
          "type": "string",
          "description": "The predicted value of a detected object."
        },
        "Confidence": {
          "type": "number",
          "description": "Amazon Textract's confidence in its predicted value."
        }
      }
    },
    "Query": {
      "type": "object",
      "properties": {
        "Text": {
          "type": "string",
          "description": "Question that Amazon Textract will apply to the document. An example would be \"What is the customer's SSN?\""
        },
        "Alias": {
          "type": "string",
          "description": "Alias attached to the query, for ease of location."
        },
        "Pages": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Pages is a parameter that the user inputs to specify which pages to apply a query to. The following is a list of rules for using this parameter. If a page is not specified, it is set to [\"1\"] by default. The following characters are allowed in the parameter's string: 0 1 2 3 4 5 6 7 8 9 - *. No whitespace is allowed. When using * to indicate all pages, it must be the only element in the list. You can use page intervals, such as [“1-3”, “1-1”, “4-*”]. Where * indicates last page of document. Specified pages must be greater than 0 and less than or equal to the number of pages in the document."
        }
      },
      "required": [
        "Text"
      ]
    },
    "Relationship": {
      "type": "object",
      "properties": {
        "Type": {
          "type": "string",
          "enum": [
            "VALUE",
            "CHILD",
            "COMPLEX_FEATURES",
            "MERGED_CELL",
            "TITLE",
            "ANSWER",
            "TABLE",
            "TABLE_TITLE",
            "TABLE_FOOTER"
          ],
          "description": "The type of relationship between the blocks in the IDs array and the current block. The following list describes the relationship types that can be returned. VALUE - A list that contains the ID of the VALUE block that's associated with the KEY of a key-value pair. CHILD - A list of IDs that identify blocks found within the current block object. For example, WORD blocks have a CHILD relationship to the LINE block type. MERGED_CELL - A list of IDs that identify each of the MERGED_CELL block types in a table. ANSWER - A list that contains the ID of the QUERY_RESULT block that’s associated with th"
        },
        "Ids": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "An array of IDs for related blocks. You can get the type of the relationship from the Type element."
        }
      }
    },
    "SignatureDetection": {
      "type": "object",
      "properties": {
        "Confidence": {
          "type": "number",
          "description": "The confidence, from 0 to 100, in the predicted values for a detected signature."
        },
        "Geometry": {
          "$ref": "#/$defs/Geometry"
        }
      }
    },
    "Warning": {
      "type": "object",
      "properties": {
        "ErrorCode": {
          "type": "string",
          "description": "The error code for the warning."
        },
        "Pages": {
          "type": "array",
          "items": {
            "type": "integer"
          },
          "description": "A list of the pages that the warning applies to."
        }
      }
    }
  }
}