- Getting Started
- Examples Using the Document Understanding™ Cloud API v1
- Licensing
- Troubleshooting
Classifying a document
API example for classifying a document using the Document Understanding Classification Service with a project ID and curl request.
Start classifying a document
The Project ID is obtained from the response received from the Get project information call.
curl -X 'POST' \
'https://{AutomationCloudURL}/<Organization_Name>/<Tenant_Name>/du_/api/framework/projects/<Project_ID>/classifiers/ml-classification/classification?api-version=1' \
-H 'accept: text/plain' \
-H 'Authorization: Bearer <your-access-token>' \
-H 'Content-Type: application/json' \
-d '{
"documentId": "25a03e48-cfe8-ed11-9f75-000d3a4964af"
}'
curl -X 'POST' \
'https://{AutomationCloudURL}/<Organization_Name>/<Tenant_Name>/du_/api/framework/projects/<Project_ID>/classifiers/ml-classification/classification?api-version=1' \
-H 'accept: text/plain' \
-H 'Authorization: Bearer <your-access-token>' \
-H 'Content-Type: application/json' \
-d '{
"documentId": "25a03e48-cfe8-ed11-9f75-000d3a4964af"
}'
Response of classifying a document
{
"classificationResults": [
{
"documentTypeId": "invoices",
"documentId": "25a03e48-cfe8-ed11-9f75-000d3a4964af",
"confidence": 0.6170391,
"ocrConfidence": -1,
"reference": {
"textStartIndex": 0,
"textLength": 0,
"tokens": []
},
"documentBounds": {
"pageRange": "1",
"pageCount": 1
},
"classifierName": "ML Classification (Preview)"
}
]
}
{
"classificationResults": [
{
"documentTypeId": "invoices",
"documentId": "25a03e48-cfe8-ed11-9f75-000d3a4964af",
"confidence": 0.6170391,
"ocrConfidence": -1,
"reference": {
"textStartIndex": 0,
"textLength": 0,
"tokens": []
},
"documentBounds": {
"pageRange": "1",
"pageCount": 1
},
"classifierName": "ML Classification (Preview)"
}
]
}
This example shows an API v1 response, which uses camelCase property names. API v2 returns PascalCase property names on all routes. For details, check Migrating automations from Document Understanding API v1 to v2.
Document bounds
The documentBounds object identifies the pages of the input file that a classification result applies to.
| Property | Type | Description |
|---|---|---|
pageRange | string | The pages covered by the result, numbered from 1. A single page appears as "3" and a range as "1-3". When a classifier splits a file into multiple documents, each result has its own range. |
pageCount | integer | The number of pages in pageRange. |
The startPage, textStartIndex, and textLength properties are deprecated. Responses still include them for backward compatibility, but their values do not reflect the page range of a split document. pageRange and pageCount replace them.