Document Models - Build Model

Builds a custom document analysis model.

POST {endpoint}/formrecognizer/documentModels:build?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).

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.

Request Body

Name Required Type Description
buildMode True

DocumentBuildMode

Custom document model build mode.

modelId True

string

Unique document model name.

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.

description

string

Document model description.

tags

object

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

Responses

Name Type Description
202 Accepted

Request is queued successfully.

Headers

Operation-Location: string

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

Build Document Model

Sample Request

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

{
  "modelId": "myCustomModel",
  "description": "Custom model description",
  "buildMode": "template",
  "azureBlobSource": {
    "containerUrl": "https://myStorageAccount.blob.core.windows.net/myContainer?mySasToken",
    "prefix": "trainingDocs/"
  },
  "tags": {
    "createdBy": "myUserId"
  }
}

Sample Response

Operation-Location: https://myendpoint.cognitiveservices.azure.com/formrecognizer/operations/b704bb00-d130-4f3f-a1d8-ca96de3eabb4?api-version=2023-07-31

Definitions

Name Description
AzureBlobContentSource

Azure Blob Storage content.

AzureBlobFileListContentSource

File list in Azure Blob Storage.

BuildDocumentModelRequest

Request body to build a new custom document model.

DocumentBuildMode

Custom document model build mode.

Error

Error info.

ErrorResponse

Error response object.

InnerError

Detailed error.

AzureBlobContentSource

Azure Blob Storage content.

Name Type Description
containerUrl

string

Azure Blob Storage container URL.

prefix

string

Blob name prefix.

AzureBlobFileListContentSource

File list in Azure Blob Storage.

Name Type Description
containerUrl

string

Azure Blob Storage container URL.

fileList

string

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

BuildDocumentModelRequest

Request body to build a new custom document model.

Name Type Description
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.

description

string

Document model description.

modelId

string

Unique document model name.

tags

object

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

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.

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.