Document Models - Analyze Document
Analyzes document with document model.
POST {endpoint}/formrecognizer/documentModels/{modelId}:analyze?api-version=2022-08-31
POST {endpoint}/formrecognizer/documentModels/{modelId}:analyze?pages={pages}&locale={locale}&stringIndexType={stringIndexType}&api-version=2022-08-31
URI Parameters
| Name | In | Required | Type | Description |
|---|---|---|---|---|
|
endpoint
|
path | True |
string |
Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com). |
|
model
|
path | True |
string pattern: [a-zA-Z0-9][a-zA-Z0-9._~-]{1,63} |
Unique document model name. |
|
api-version
|
query | True |
Requested API version. |
|
|
locale
|
query |
string |
Locale hint for text recognition and document analysis. Value may contain only the language code (ex. "en", "fr") or BCP 47 language tag (ex. "en-US"). |
|
|
pages
|
query |
string pattern: ^(\d+(-\d+)?)(,\s*(\d+(-\d+)?))*$ |
List of 1-based page numbers to analyze. Ex. "1-3,5,7-9" |
|
|
string
|
query |
Method used to compute string offset and length. |
Request Header
Media Types: "application/json", "application/octet-stream", "application/pdf", "image/jpeg", "image/png", "image/tiff", "image/bmp", "image/heif"
| Name | Required | Type | Description |
|---|---|---|---|
| Ocp-Apim-Subscription-Key | True |
string |
Request Body
Media Types: "application/json", "application/octet-stream", "application/pdf", "image/jpeg", "image/png", "image/tiff", "image/bmp", "image/heif"
| Name | Type | Description |
|---|---|---|
| base64Source |
string (byte) |
Base64 encoding of the document to analyze |
| urlSource |
string (uri) |
Document URL to analyze |
Responses
| Name | Type | Description |
|---|---|---|
| 202 Accepted |
Request is queued successfully. Headers Operation-Location: string |
|
| Other Status Codes |
Error encountered. |
Security
Ocp-Apim-Subscription-Key
Type:
apiKey
In:
header
Examples
|
Analyze |
|
Analyze |
AnalyzeDocument_Base64
Sample request
POST {endpoint}/formrecognizer/documentModels/prebuilt-layout:analyze?pages=1-2,4&locale=en-US&stringIndexType=textElements&api-version=2022-08-31
{
"base64Source": ""
}
Sample response
Operation-Location: {endpoint}/formrecognizer/documentModels/prebuilt-layout/analyzeResults/{resultId}?api-version=2022-08-31
AnalyzeDocument_Url
Sample request
POST {endpoint}/formrecognizer/documentModels/customModel:analyze?pages=1-2,4&locale=en-US&stringIndexType=textElements&api-version=2022-08-31
{
"urlSource": "http://host.com/doc.pdf"
}
Sample response
Operation-Location: {endpoint}/formrecognizer/documentModels/customModel/analyzeResults/{resultId}?api-version=2022-08-31
Definitions
| Name | Description |
|---|---|
|
Analyze |
Document analysis parameters. |
|
Api |
API version. |
| Error |
Error info. |
|
Error |
Error response object. |
|
Inner |
Detailed error. |
|
String |
Method used to compute string offset and length. |
AnalyzeDocumentRequest
Document analysis parameters.
| Name | Type | Description |
|---|---|---|
| base64Source |
string (byte) |
Base64 encoding of the document to analyze |
| urlSource |
string (uri) |
Document URL to analyze |
ApiVersion
API version.
| Value | Description |
|---|---|
| 2022-08-31 |
Error
Error info.
| Name | Type | Description |
|---|---|---|
| code |
string |
Error code. |
| details |
Error[] |
List of detailed errors. |
| innererror |
Detailed error. |
|
| message |
string |
Error message. |
| target |
string |
Target of the error. |
ErrorResponse
Error response object.
| Name | Type | Description |
|---|---|---|
| error |
Error info. |
InnerError
Detailed error.
| Name | Type | Description |
|---|---|---|
| code |
string |
Error code. |
| innererror |
Detailed error. |
|
| message |
string |
Error message. |
StringIndexType
Method used to compute string offset and length.
| Value | Description |
|---|---|
| textElements | |
| unicodeCodePoint | |
| utf16CodeUnit |