---
title: "Recognize a photo of a form, extract key fields using stored templates"
method: POST
path: "/ocr/photo/recognize/form/advanced"
tags: ["ImageOcr"]
---

# Recognize a photo of a form, extract key fields using stored templates

`POST /ocr/photo/recognize/form/advanced`

Analyzes a photograph of a form as input, and outputs key business fields and information.  Customzie data to be extracted by defining fields for the form.  Uses template definitions stored in Cloudmersive Configuration; to configure stored templates in a configuration bucket, log into Cloudmersive Management Portal and navigate to Settings &gt; API Configuration &gt; Create Bucket.  Note: for free tier API keys, it is required to add a credit card to your account for security reasons, to use the free tier key with this API.

## Headers

- `bucketID` string
- `bucketSecretKey` string
- `recognitionMode` string
- `preprocessing` string
- `diagnostics` string

## Response `200`

OK

- FormRecognitionResult — The result of extracting form field values
  - `Successful` boolean — True if the operation was successful, false otherwise
  - `FieldValueExtractionResult` FieldResult[] — Result of form field OCR data extraction
    - `TargetField` FormFieldDefinition — Definition of a form field for OCR data extraction from images
      - `FieldID` string — The identifier of the field; use this to identify which field is being referenced. Set to SkipField if you do not wish to return the value of this field in the result.
      - `LeftAnchor` string — Optional - the left-hand anchor of the field
      - `TopAnchor` string — Optional - the top anchor of the field
      - `BottomAnchor` string — Optional - the bottom anchor of the field
      - `AlternateAnchor` string — Optional - alterate match text for the specified anchor
      - `AnchorMode` string — Optional - the matching mode for the anchor. Possible values are Complete (requires the entire anchor to match) and Partial (allows only part of the anchor to match) and Horizontal (anchor must be laid out horizontally). Default is Partial.
      - `DataType` string — The data type of the field; possible values are INTEGER (Integer value), STRING (Arbitrary string value, spaces are permitted), DATE (Date in a structured format), DECIMAL (Decimal number), ALPHANUMERIC (Continuous alphanumeric string with no spaces), STRINGNOWHITESPACE (A string that contains no whitespace characters), SERIALNUMBER (A serial-number style string that contains letters and numbers, and certain symbols; must contain at least one number), ALPHAONLY (Alphabet characters only, no numbers or symbols or whitespace)
      - `TargetDigitCount` integer — Optional - the target number of digits in the field; useful for fixed-length fields
      - `MinimumCharacterCount` integer — Optional - the target number of digits in the field; useful for fixed-length fields
      - `AllowNumericDigits` boolean — Optional - set to false to block values that contain numeric digits, set to true to allow numeric digits
      - `VerticalAlignmentType` string — Vertical alignment of target value area relative to the field anchor; Possible values are VCenter, Top, Bottom
      - `HorizontalAlignmentType` string — Horizontal alignment of target value area relative to the field anchor; Possible values are Left, Right
      - `TargetFieldWidth_Relative` number, double — Optional - scale factor for target field width - relative to width of field title; a value of 1.0 indicates the target value area has the same width as the field value as occurring in the image; a value of 2.0 would indicate that the target value area has 2 times the width of the field value as occurring in the image.
      - `TargetFieldHeight_Relative` number, double — Optional - scale factor for target field height - relative to height of field title
      - `TargetFieldHorizontalAdjustment` number, double — Optional - horizontal adjestment in relative width of the field
      - `TargetFieldVerticalAdjustment` number, double — Optional - vertical adjestment in relative height of the field
      - `Ignore` string[] — Optional - Ignore any result items that contain a partial or complete match with these text strings
      - `Options` string — Optional - additional options that can be set for this field definition, separated by commas. Possible values are AllowMultiMatch (allow the same anchor to be matched to multiple fields)
    - `FieldValues` OcrPhotoTextElement[] — Result field value(s) extracted
      - `Text` string — Text of the word
      - `XLeft` integer — X location of the left edge of the word in pixels
      - `YTop` integer — Y location of the top edge of the word in pixels
      - `Width` integer — Width of the word in pixels
      - `Height` integer — Height of the word in pixels
      - `BoundingPoints` Point[] — Points that form the bounding polygon around the text
        - `X` integer — X location in 2D in the image, where 0 represents the left edge of the image
        - `Y` integer — Y location in 2D in the image, where 0 represents the top edge of the image
      - `ConfidenceLevel` number, double — Confidence level of the machine learning result; possible values are 0.0 (lowest accuracy) - 1.0 (highest accuracy)
  - `TableValueExtractionResults` TableResult[] — Result of form table OCR data extraction
    - `TableDefinition` FormTableDefinition — Definition of a form table for OCR data extraction from images
      - `TableID` string — Optional; the ID of the table
      - `ColumnDefinitions` FormTableColumnDefinition[] — Definition of the columns in the table
        - `ColumnID` string — The identifier of the field; use this to identify which field is being referenced
        - `TopAnchor` string — Optional - the top anchor of the column heading
        - `AnchorMode` string — Optional - the matching mode for the anchor. Possible values are Complete (requires the entire anchor to match) and Partial (allows only part of the anchor to match). Default is Partial.
        - `DataType` string — The data type of the field; possible values are INTEGER (Integer value), STRING (Arbitrary string value, spaces are permitted), DATE (Date in a structured format), DECIMAL (Decimal number), ALPHANUMERIC (Continuous alphanumeric string with no spaces), STRINGNOWHITESPACE (A string that contains no whitespace characters), SERIALNUMBER (A serial-number style string that contains letters and numbers, and certain symbols; must contain at least one number), ALPHAONLY (Alphabet characters only, no numbers or symbols or whitespace)
        - `MinimumCharacterCount` integer — Optional - the target number of digits in the field; useful for fixed-length fields
        - `AllowNumericDigits` boolean — Optional - set to false to block values that contain numeric digits, set to true to allow numeric digits
      - `TargetTableHeight_Relative` number, double — Optional - scale factor for target table height - relative to maximum height of headers of columns
      - `TargetRowHeight_Relative` number, double — Optional - scale factor for target row height - relative to height of column header
    - `TableRowsResult` TableRowResult[] — Rows of data in the table
      - `TableRowCellsResult` TableCellResult[] — Table cells in this row result
        - `ColumnID` string — The ID of the column
        - `CellValues` OcrPhotoTextElement[] — Result cell value(s) extracted
          - `Text` string — Text of the word
          - `XLeft` integer — X location of the left edge of the word in pixels
          - `YTop` integer — Y location of the top edge of the word in pixels
          - `Width` integer — Width of the word in pixels
          - `Height` integer — Height of the word in pixels
          - `BoundingPoints` Point[] — Points that form the bounding polygon around the text
            - `X` integer — X location in 2D in the image, where 0 represents the left edge of the image
            - `Y` integer — Y location in 2D in the image, where 0 represents the top edge of the image
          - `ConfidenceLevel` number, double — Confidence level of the machine learning result; possible values are 0.0 (lowest accuracy) - 1.0 (highest accuracy)
  - `Diagnostics` string[] — Diagnostic images - default is null, enable diagnostics=true to populate this parameter with one image per field
  - `BestMatchFormSettingName` string — Optional; populated when using photo/recognize/form/advanced with the Setting Name of the best-matching highest-relevance form

---

[API](https://skmtc.net/cloudmersive/apis/ocrapi.md) · [All operations](https://skmtc.net/cloudmersive/apis/ocrapi/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/cloudmersive/ocrapi/versions/809f1a173306/schema)
