Share via


Document Models - Get Model

Gets detailed document model information.

GET {endpoint}/documentintelligence/documentModels/{modelId}?api-version=2024-11-30

URI Parameters

Name In Required Type Description
endpoint
path True

string (uri)

The Document Intelligence service endpoint.

modelId
path True

string

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

Unique document model name.

api-version
query True

string

minLength: 1

The API version to use for this operation.

Request Header

Name Required Type Description
x-ms-client-request-id

string (uuid)

An opaque, globally-unique, client-generated string identifier for the request.

Responses

Name Type Description
200 OK

DocumentModelDetails

The request has succeeded.

Headers

x-ms-client-request-id: string

Other Status Codes

DocumentIntelligenceErrorResponse

An unexpected error response.

Security

Ocp-Apim-Subscription-Key

Type: apiKey
In: header

OAuth2Auth

Type: oauth2
Flow: accessCode
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize
Token URL: https://login.microsoftonline.com/common/oauth2/token

Scopes

Name Description
https://cognitiveservices.azure.com/.default

Examples

Get Custom Document Model
Get Prebuilt Document Model

Get Custom Document Model

Sample request

GET https://myendpoint.cognitiveservices.azure.com/documentintelligence/documentModels/myCustomModel?api-version=2024-11-30

Sample response

{
  "modelId": "myCustomModel",
  "description": "Custom model description",
  "createdDateTime": "2021-09-24T12:54:35Z",
  "expirationDateTime": "2023-01-01T00:00:00Z",
  "apiVersion": "2024-11-30",
  "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/documentintelligence/documentModels/prebuilt-invoice?api-version=2024-11-30

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": "2024-11-30",
  "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
AzureBlobContentSource

Azure Blob Storage content.

AzureBlobFileListContentSource

File list in Azure Blob Storage.

DocumentAnalysisFeature

Document analysis features to enable.

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.

DocumentIntelligenceError

The error object.

DocumentIntelligenceErrorResponse

Error response object.

DocumentIntelligenceInnerError

An object containing more specific information about the error.

DocumentIntelligenceWarning

The error object.

DocumentModelDetails

Document model info.

DocumentTypeDetails

Document type info.

SplitMode

File splitting behavior.

AzureBlobContentSource

Azure Blob Storage content.

Name Type Description
containerUrl

string (uri)

Azure Blob Storage container URL.

prefix

string

Blob name prefix.

AzureBlobFileListContentSource

File list in Azure Blob Storage.

Name Type Description
containerUrl

string (uri)

Azure Blob Storage container URL.

fileList

string

Path to a JSONL file within the container specifying a subset of documents.

DocumentAnalysisFeature

Document analysis features to enable.

Value Description
ocrHighResolution

Perform OCR at a higher resolution to handle documents with fine print.

languages

Enable the detection of the text content language.

barcodes

Enable the detection of barcodes in the document.

formulas

Enable the detection of mathematical expressions in the document.

keyValuePairs

Enable the detection of general key value pairs (form fields) in the document.

styleFont

Enable the recognition of various font styles.

queryFields

Enable the extraction of additional fields via the queryFields query parameter.

DocumentBuildMode

Custom document model build mode.

Value Description
template

Target documents with similar visual templates.

neural

Support documents with diverse visual templates.

DocumentFieldSchema

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

Name Type Description
description

string

maxLength: 4096

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.

Value Description
string

Plain text.

date

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

time

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

phoneNumber

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

number

Floating point number, normalized to double precision floating point.

integer

Integer number, normalized to 64-bit signed integer.

selectionMark

Is field selected?

countryRegion

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

signature

Is signature present?

array

List of subfields of the same type.

object

Named list of subfields of potentially different types.

currency

Currency amount with optional currency symbol and unit.

address

Parsed address.

boolean

Boolean value, normalized to true or false.

selectionGroup

Array of selected string values.

DocumentIntelligenceError

The error object.

Name Type Description
code

string

One of a server-defined set of error codes.

details

DocumentIntelligenceError[]

An array of details about specific errors that led to this reported error.

innererror

DocumentIntelligenceInnerError

An object containing more specific information than the current object about the error.

message

string

A human-readable representation of the error.

target

string

The target of the error.

DocumentIntelligenceErrorResponse

Error response object.

Name Type Description
error

DocumentIntelligenceError

Error info.

DocumentIntelligenceInnerError

An object containing more specific information about the error.

Name Type Description
code

string

One of a server-defined set of error codes.

innererror

DocumentIntelligenceInnerError

Inner error.

message

string

A human-readable representation of the error.

DocumentIntelligenceWarning

The error object.

Name Type Description
code

string

One of a server-defined set of warning codes.

message

string

A human-readable representation of the warning.

target

string

The target of the error.

DocumentModelDetails

Document model info.

Name Type Default value Description
apiVersion

string

API version used to create this document model.

azureBlobFileListSource

AzureBlobFileListContentSource

Azure Blob Storage file list specifying the training data. Either azureBlobSource or azureBlobFileListSource must be specified.

azureBlobSource

AzureBlobContentSource

Azure Blob Storage location containing the training data. Either azureBlobSource or azureBlobFileListSource must be specified.

buildMode

DocumentBuildMode

Custom document model build mode.

classifierId

string

For composed models, the custom classifier to split and classify the input file.

createdDateTime

string (date-time)

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

description

string

maxLength: 4096

Document model description.

docTypes

<string,  DocumentTypeDetails>

Supported document types.

expirationDateTime

string (date-time)

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

modelId

string

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

Unique document model name.

modifiedDateTime

string (date-time)

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

split

SplitMode

none

For composed models, the file splitting behavior.

tags

object

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

trainingHours

number (float)

Number of V100-equivalent GPU hours consumed for model training.

warnings

DocumentIntelligenceWarning[]

List of warnings encountered while building the model.

DocumentTypeDetails

Document type info.

Name Type Description
buildMode

DocumentBuildMode

Custom document model build mode.

confidenceThreshold

number (float)

Only perform analysis if docType confidence is above threshold.

description

string

maxLength: 4096

Document model description.

features

DocumentAnalysisFeature[]

List of optional analysis features.

fieldConfidence

object

Estimated confidence for each field.

fieldSchema

<string,  DocumentFieldSchema>

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

maxDocumentsToAnalyze

integer (int32)

Maximum number of documents of specified type to analyze. Default=all.

modelId

string

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

Document model to use for analyzing documents with specified type.

queryFields

string[]

List of additional fields to extract. Ex. "NumberOfGuests,StoreNumber"

SplitMode

File splitting behavior.

Value Description
auto

Automatically split file into documents.

none

Treat the entire file as a single document.

perPage

Treat each page in the file as a separate document.