At a glance
- Availability: Experimental (how to enable).
- Auth: API key.
- Connection: The key from
AZURE_DOCUMENT_INTELLIGENCE_KEYis sent as theOcp-Apim-Subscription-Keyheader. - Docs: https://learn.microsoft.com/en-us/rest/api/aiservices/document-models/analyze-document
Credentials
Set these per environment. See Connect an integration.| Variable | Required | Description |
|---|---|---|
AZURE_DOCUMENT_INTELLIGENCE_KEY | Yes | Key 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_ENDPOINT | Yes | Hostname of your resource endpoint, e.g. myresource.cognitiveservices.azure.com - pass it as the {resourceHost} parameter on each tool call Docs. |
Setup
- 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).
- 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.
- 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.
- 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
Tools
| Tool | Access | Description |
|---|---|---|
| Analyze Invoice | Write | Start 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 Receipt | Write | Start 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 Layout | Write | Start 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 Result | Read | Fetch 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) | Write | Start 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 Models | Read | List 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.