UiPath Documentation
document-understanding
latest
false
Document Understanding API guide
  • Getting Started
    • Overview
    • Limits and Quota
    • Migrating automations from Document Understanding API v1 to v2
  • Examples Using the Document Understanding™ Cloud API v1
  • Licensing
  • Troubleshooting

Generative classifier

API example for using the generative classifier with Document Understanding, including a sample curl request using a project ID.

Start classifying a document using generative classifier

Tip:

The Project ID is obtained from the response received from the Get project information call.

curl -X 'POST' \
  '{AutomationCloudURL}/<Organization_Name>/<Tenant_Name>/du_/api/framework/projects/<Project_ID>/classifiers/generative_classifier/classification?api-version=1' \
  -H 'accept: text/plain' \
  -H 'Authorization: Bearer <your-access-token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "documentId": "fa83da2a-1498-ee11-8925-000d3a67a01e",
  "prompts": [
    {
      "name": "Invoice",
      "description": "A detailed statement of goods or services provided, with individual prices, the total charge, and payment terms."
    },
    {
      "name": "Receipt",
      "description": "A written acknowledgment of having received a specified amount of money, goods, or services."
    }
  ]
}'
curl -X 'POST' \
  '{AutomationCloudURL}/<Organization_Name>/<Tenant_Name>/du_/api/framework/projects/<Project_ID>/classifiers/generative_classifier/classification?api-version=1' \
  -H 'accept: text/plain' \
  -H 'Authorization: Bearer <your-access-token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "documentId": "fa83da2a-1498-ee11-8925-000d3a67a01e",
  "prompts": [
    {
      "name": "Invoice",
      "description": "A detailed statement of goods or services provided, with individual prices, the total charge, and payment terms."
    },
    {
      "name": "Receipt",
      "description": "A written acknowledgment of having received a specified amount of money, goods, or services."
    }
  ]
}'

Response of classifying a document using generative classifier

{
  "classificationResults": [
    {
      "DocumentTypeId": "Invoice",
      "DocumentId": "fa83da2a-1498-ee11-8925-000d3a67a01e",
      "Confidence": 0.9,
      "OcrConfidence": -1,
      "Reference": {
        "TextStartIndex": 0,
        "TextLength": 0,
        "Tokens": []
      },
      "DocumentBounds": {
        "StartPage": 0,
        "PageCount": 1,
        "TextStartIndex": 0,
        "TextLength": 864
      },
      "ClassifierName": "Generative Classifier"
    }
  ]
}
{
  "classificationResults": [
    {
      "DocumentTypeId": "Invoice",
      "DocumentId": "fa83da2a-1498-ee11-8925-000d3a67a01e",
      "Confidence": 0.9,
      "OcrConfidence": -1,
      "Reference": {
        "TextStartIndex": 0,
        "TextLength": 0,
        "Tokens": []
      },
      "DocumentBounds": {
        "StartPage": 0,
        "PageCount": 1,
        "TextStartIndex": 0,
        "TextLength": 864
      },
      "ClassifierName": "Generative Classifier"
    }
  ]
}

Was this page helpful?

Connect

Need help? Support

Want to learn? UiPath Academy

Have questions? UiPath Forum

Stay updated