Document Models - Get Model

Gets detailed document model information.

GET {endpoint}/formrecognizer/documentModels/{modelId}?api-version=2023-07-31

URI Parameters

Name In Required Type Description
endpoint
path True

string

url

Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com).

modelId
path True

string

Unique document model name.

Regex pattern: ^[a-zA-Z0-9][a-zA-Z0-9._~-]{1,63}$

api-version
query True

string

Requested API version.

Request Header

Name Required Type Description
Ocp-Apim-Subscription-Key True

string

The secret key for your Azure Cognitive Services subscription.

Responses

Name Type Description
200 OK

DocumentModelDetails

OK.

Other Status Codes

ErrorResponse

Error encountered.

Security

Ocp-Apim-Subscription-Key

The secret key for your Azure Cognitive Services subscription.

Type: apiKey
In: header

Examples

Get Custom Document Model
Get Prebuilt Document Model

Get Custom Document Model

Sample Request

GET https://myendpoint.cognitiveservices.azure.com/formrecognizer/documentModels/myCustomModel?api-version=2023-07-31

Sample Response

{
  "modelId": "myCustomModel",
  "description": "Custom model description",
  "createdDateTime": "2021-09-24T12:54:35Z",
  "expirationDateTime": "2023-01-01T00:00:00Z",
  "apiVersion": "2023-07-31",
  "docTypes": {
    "myForm": {
      "fieldSchema": {
        "Name": {
          "type": "string"
        },
        "Date": {
          "type": "date"
        },
        "Amount": {
          "type": "number"
        }
      },
      "buildMode": "template",
      "fieldConfidence": {
        "Name": 0.9,
        "Date": 0.95,
        "Amount": 0.93
      }
    }
  },
  "tags": {
    "createdBy": "myUserId"
  }
}

Get Prebuilt Document Model

Sample Request

GET https://myendpoint.cognitiveservices.azure.com/formrecognizer/documentModels/prebuilt-invoice?api-version=2023-07-31

Sample Response

{
  "modelId": "prebuilt-invoice",
  "description": "Prebuilt model to extract key information from English invoices, including customer, vendor, invoice ID, due date, total, and more.",
  "createdDateTime": "2021-07-30T00:00:00Z",
  "apiVersion": "2023-07-31",
  "docTypes": {
    "prebuilt:invoice": {
      "fieldSchema": {
        "CustomerName": {
          "type": "string"
        },
        "CustomerId": {
          "type": "string"
        },
        "PurchaseOrder": {
          "type": "string"
        },
        "InvoiceId": {
          "type": "string"
        },
        "InvoiceDate": {
          "type": "date"
        },
        "DueDate": {
          "type": "date"
        },
        "VendorName": {
          "type": "string"
        },
        "VendorAddress": {
          "type": "string"
        },
        "VendorAddressRecipient": {
          "type": "string"
        },
        "CustomerAddress": {
          "type": "string"
        },
        "CustomerAddressRecipient": {
          "type": "string"
        },
        "BillingAddress": {
          "type": "string"
        },
        "BillingAddressRecipient": {
          "type": "string"
        },
        "ShippingAddress": {
          "type": "string"
        },
        "ShippingAddressRecipient": {
          "type": "string"
        },
        "SubTotal": {
          "type": "number"
        },
        "TotalTax": {
          "type": "number"
        },
        "InvoiceTotal": {
          "type": "number"
        },
        "AmountDue": {
          "type": "number"
        },
        "PreviousUnpaidBalance": {
          "type": "number"
        },
        "RemittanceAddress": {
          "type": "string"
        },
        "RemittanceAddressRecipient": {
          "type": "string"
        },
        "ServiceAddress": {
          "type": "string"
        },
        "ServiceAddressRecipient": {
          "type": "string"
        },
        "ServiceStartDate": {
          "type": "date"
        },
        "ServiceEndDate": {
          "type": "date"
        },
        "Items": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "Amount": {
                "type": "number"
              },
              "Date": {
                "type": "date"
              },
              "Description": {
                "type": "string"
              },
              "Quantity": {
                "type": "number"
              },
              "ProductCode": {
                "type": "string"
              },
              "Tax": {
                "type": "number"
              },
              "Unit": {
                "type": "string"
              },
              "UnitPrice": {
                "type": "number"
              }
            }
          }
        }
      }
    }
  },
  "tags": {}
}

Definitions

Name Description
DocumentBuildMode

Custom document model build mode.

DocumentFieldSchema

Description of the field semantic schema using a JSON Schema style syntax.

DocumentFieldType

Semantic data type of the field value.

DocumentModelDetails

Document model info.

DocumentTypeDetails

Document type info.

Error

Error info.

ErrorResponse

Error response object.

InnerError

Detailed error.

DocumentBuildMode

Custom document model build mode.

Name Type Description
neural

string

Support documents with diverse visual templates.

template

string

Target documents with similar visual templates.

DocumentFieldSchema

Description of the field semantic schema using a JSON Schema style syntax.

Name Type Description
description

string

Field description.

example

string

Example field content.

items

DocumentFieldSchema

Field type schema of each array element.

properties

<string,  DocumentFieldSchema>

Named sub-fields of the object field.

type

DocumentFieldType

Semantic data type of the field value.

DocumentFieldType

Semantic data type of the field value.

Name Type Description
address

string

Parsed address.

array

string

List of subfields of the same type.

boolean

string

Boolean value, normalized to true or false.

countryRegion

string

Country/region, normalized to ISO 3166-1 alpha-3 format (ex. USA).

currency

string

Currency amount with optional currency symbol and unit.

date

string

Date, normalized to ISO 8601 (YYYY-MM-DD) format.

integer

string

Integer number, normalized to 64-bit signed integer.

number

string

Floating point number, normalized to double precision floating point.

object

string

Named list of subfields of potentially different types.

phoneNumber

string

Phone number, normalized to E.164 (+{CountryCode}{SubscriberNumber}) format.

selectionMark

string

Is field selected?

signature

string

Is signature present?

string

string

Plain text.

time

string

Time, normalized to ISO 8601 (hh:mm:ss) format.

DocumentModelDetails

Document model info.

Name Type Description
apiVersion

string

API version used to create this document model.

createdDateTime

string

Date and time (UTC) when the document model was created.

description

string

Document model description.

docTypes

<string,  DocumentTypeDetails>

Supported document types.

expirationDateTime

string

Date and time (UTC) when the document model will expire.

modelId

string

Unique document model name.

tags

object

List of key-value tag attributes associated with the document model.

DocumentTypeDetails

Document type info.

Name Type Description
buildMode

DocumentBuildMode

Custom document model build mode.

description

string

Document model description.

fieldConfidence

object

Estimated confidence for each field.

fieldSchema

<string,  DocumentFieldSchema>

Description of the document semantic schema using a JSON Schema style syntax.

Error

Error info.

Name Type Description
code

string

Error code.

details

Error[]

List of detailed errors.

innererror

InnerError

Detailed error.

message

string

Error message.

target

string

Target of the error.

ErrorResponse

Error response object.

Name Type Description
error

Error

Error info.

InnerError

Detailed error.

Name Type Description
code

string

Error code.

innererror

InnerError

Detailed error.

message

string

Error message.