Introduction
Processing large volumes of documents manually is time-consuming and error-prone. Whether dealing with invoices, receipts, contracts, or business forms, extracting structured data efficiently is crucial for automation.
Azure Document Intelligence (formerly Azure Form Recognizer) is a cloud-based AI service that enables automated document processing using pre-trained and custom models. With just an API call, you can:
- ✅ Extract key-value pairs from structured forms.
- ✅ Process invoices, receipts, and business cards.
- ✅ Recognize handwritten text and printed text.
- ✅ Automate data extraction into databases or applications.
This article walks through setting up Azure Document Intelligence, sending a document for analysis, and visualizing extracted data.

1️⃣ Setting Up Azure Document Intelligence
Before sending documents for processing, you need to set up Azure Document Intelligence in the Azure Portal.
Steps to Create a Document Intelligence Resource
1️⃣ Log in to Azure Portal.
2️⃣ Click "Create a resource" → Search for "Document Intelligence".
3️⃣ Select "Cognitive Services → Document Intelligence".
4️⃣ Configure the details:
- Subscription: Select an active Azure subscription.
- Resource Group: Create or use an existing one.
- Region: Pick a region closest to your users.
- Pricing Tier: Choose "Standard" or "Free (F0)" for limited usage.
5️⃣ Click "Review + Create" → then "Create".
Once deployed, navigate to "Keys and Endpoint" in the Document Intelligence resource to get:
- ✔ API Key (used for authentication)
- ✔ Endpoint URL (base URL for sending API requests)

2️⃣ Sending a Document to Azure Document Intelligence API
Now that the resource is set up, it's time to upload a document (PDF, image, or scanned document) for analysis.
Here’s a Python script to send a document to Azure Document Intelligence API:
import requests
# Replace with your Azure API details
API_KEY = "<your_api_key>"
ENDPOINT = "<your_endpoint>/formrecognizer/documentModels/prebuilt-invoice/analyze?api-version=2023-07-31-preview"
headers = {
"Ocp-Apim-Subscription-Key": API_KEY,
"Content-Type": "application/pdf"
}
# Open a sample PDF file
with open("sample_invoice.pdf", "rb") as file_data:
response = requests.post(ENDPOINT, headers=headers, data=file_data)
# Get operation location (needed to retrieve results)
operation_url = response.headers["Operation-Location"]
print(f"Processing started: {operation_url}")



Join the conversation! Your thoughts help the community grow.