Skip to main content

At a glance

Credentials

Set these per environment. See Connect an integration.
VariableRequiredDescription
AZURE_DOCUMENT_INTELLIGENCE_KEYYesKey for your Azure Document Intelligence resource (Keys and Endpoint blade in the Azure portal), sent as the Ocp-Apim-Subscription-Key header Docs.
AZURE_DOCUMENT_INTELLIGENCE_ENDPOINTYesHostname of your resource endpoint, e.g. myresource.cognitiveservices.azure.com - pass it as the {resourceHost} parameter on each tool call Docs.

Setup

  1. Create a Document Intelligence resource: In the Azure portal, create an Azure AI Document Intelligence (formerly Form Recognizer) resource: https://portal.azure.com/#create/Microsoft.CognitiveServicesFormRecognizer. Choose the free F0 pricing tier to test at no cost (500 pages/month; F0 only processes the first 2 pages of each request).
  2. Copy the key and endpoint: Open the resource’s ‘Keys and Endpoint’ blade. Store KEY 1 as AZURE_DOCUMENT_INTELLIGENCE_KEY and the endpoint hostname (e.g. myresource.cognitiveservices.azure.com, without https://) as AZURE_DOCUMENT_INTELLIGENCE_ENDPOINT.
  3. Run an analysis: Call Analyze Invoice with your resource hostname as resourceHost and a urlSource pointing at a sample invoice. The API replies 202 Accepted; copy the result ID (GUID) from the Operation-Location response header.
  4. Fetch the result: Call Get Analyze Result with the same modelId (prebuilt-invoice) and the result ID. Poll until status is ‘succeeded’, then read the extracted fields from analyzeResult.documents.
  • Analysis is asynchronous: analyze calls return 202 with no body - the result ID must be read from the Operation-Location response header
  • Analyze results are retained for 24 hours, after which the result ID expires
  • All tools pin api-version 2024-11-30 (GA v4.0); region availability and model versions are listed in the Azure docs
  • Either urlSource or base64Source must be set on analyze calls - never both
Provider API reference: https://learn.microsoft.com/en-us/azure/ai-services/document-intelligence/

Tools

ToolAccessDescription
Analyze InvoiceWriteStart analysis of an invoice with the prebuilt-invoice model (vendor, customer, line items, totals, taxes, payment terms). Asynchronous: the API responds 202 Accepted with an Operation-Location header containing the result ID - poll Get Analyze Result with that ID to fetch the extracted fields.
Analyze ReceiptWriteStart analysis of a sales receipt with the prebuilt-receipt model (merchant, transaction date/time, line items, tax, tip, total). Asynchronous: responds 202 Accepted with an Operation-Location header containing the result ID - poll Get Analyze Result with that ID.
Analyze LayoutWriteStart analysis of any document with the prebuilt-layout model to extract text, tables, selection marks, and document structure (optionally as Markdown). Asynchronous: responds 202 Accepted with an Operation-Location header containing the result ID - poll Get Analyze Result with that ID.
Get Analyze ResultReadFetch the result of a previously started analysis. Use the result ID (GUID) from the Operation-Location response header of an analyze call, and the same model ID that started it. While status is ‘running’, wait and poll again; when status is ‘succeeded’, the extracted fields are in analyzeResult.
Analyze Read (OCR)WriteStart pure OCR text extraction with the prebuilt-read model - the cheapest option for plain scans where only the text matters (no tables or key-value pairs). Asynchronous: responds 202 Accepted with an Operation-Location header containing the result ID - poll Get Analyze Result with that ID.
List Document ModelsReadList the document models available on the resource (prebuilt and custom) with their model IDs and descriptions - use this to discover valid model IDs

Example prompts

  • Analyze this invoice with Azure Document Intelligence and summarize the vendor, invoice ID, due date, line items, and total.
  • Analyze this receipt with Azure Document Intelligence and report the merchant, date, and total amount.
  • Run layout analysis on this document with outputContentFormat=markdown and return the document content as Markdown.