> ## Documentation Index
> Fetch the complete documentation index at: https://veryfront.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Azure Document Intelligence

> Analyze invoices, receipts, and document layout with Azure AI Document Intelligence prebuilt models

## At a glance

* **Availability**: Experimental ([how to enable](/cloud/integrations)).
* **Auth**: API key.
* **Connection**: The key from `AZURE_DOCUMENT_INTELLIGENCE_KEY` is sent as the `Ocp-Apim-Subscription-Key` header.
* **Docs**: [https://learn.microsoft.com/en-us/rest/api/aiservices/document-models/analyze-document](https://learn.microsoft.com/en-us/rest/api/aiservices/document-models/analyze-document)

## Credentials

Set these per environment. See [Connect an integration](/cloud/integrations).

| 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](https://portal.azure.com). |
| `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](https://portal.azure.com).  |

## 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](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/](https://learn.microsoft.com/en-us/azure/ai-services/document-intelligence/)

## 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.
