Share via


Document Models - Compose Model

Creates a new document model from document types of existing document models.

POST {endpoint}/documentintelligence/documentModels:compose?api-version=2024-11-30

URI Parameters

Name In Required Type Description
endpoint
path True

string (uri)

The Document Intelligence service endpoint.

api-version
query True

string

minLength: 1

The API version to use for this operation.

Request Body

Name Required Type Description
classifierId True

string

Custom classifier to split and classify the input file.

docTypes True

<string,  DocumentTypeDetails>

Dictionary mapping supported docTypes to the corresponding document models.

modelId True

string

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

Unique document model name.

description

string

maxLength: 4096

Document model description.

split

SplitMode

File splitting behavior.

tags

object

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

Responses

Name Type Description
202 Accepted

The request has been accepted for processing, but processing has not yet completed.

Headers

  • Operation-Location: string
  • Retry-After: integer
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

Compose Document Model

Sample request

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

{
  "modelId": "composedModel",
  "description": "Composed model description",
  "classifierId": "customClassifier",
  "docTypes": {
    "formA": {
      "modelId": "model1"
    },
    "formB": {
      "modelId": "model2"
    }
  }
}

Sample response

Operation-Location: https://myendpoint.cognitiveservices.azure.com/documentintelligence/operations/b704bb00-d130-4f3f-a1d8-ca96de3eabb4?api-version=2024-11-30

Definitions

Name Description
ComposeDocumentModelRequest

Request body to create a composed document model from component document models.

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.

DocumentTypeDetails

Document type info.

SplitMode

File splitting behavior.

ComposeDocumentModelRequest

Request body to create a composed document model from component document models.

Name Type Default value Description
classifierId

string

Custom classifier to split and classify the input file.

description

string

maxLength: 4096

Document model description.

docTypes

<string,  DocumentTypeDetails>

Dictionary mapping supported docTypes to the corresponding document models.

modelId

string

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

Unique document model name.

split

SplitMode

none

File splitting behavior.

tags

object

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

DocumentAnalysisFeature

Document analysis features to enable.

Value Description
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.

languages

Enable the detection of the text content language.

ocrHighResolution

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

queryFields

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

styleFont

Enable the recognition of various font styles.

DocumentBuildMode

Custom document model build mode.

Value Description
neural

Support documents with diverse visual templates.

template

Target documents with similar 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
address

Parsed address.

array

List of subfields of the same type.

boolean

Boolean value, normalized to true or false.

countryRegion

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

currency

Currency amount with optional currency symbol and unit.

date

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

integer

Integer number, normalized to 64-bit signed integer.

number

Floating point number, normalized to double precision floating point.

object

Named list of subfields of potentially different types.

phoneNumber

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

selectionGroup

Array of selected string values.

selectionMark

Is field selected?

signature

Is signature present?

string

Plain text.

time

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

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.

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.