Events
Mar 17, 9 PM - Mar 21, 10 AM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
REST API version 2023-07-31 (GA)
Azure AI Document Intelligence is a cloud service that uses machine learning to analyze text and structured data from documents. The Document Intelligence software development kit (SDK) is a set of libraries and tools that enable you to easily integrate Document Intelligence models and capabilities into your applications. Document Intelligence SDK is available across platforms in C#/.NET, Java, JavaScript, and Python programming languages.
Document Intelligence SDK supports the following languages and platforms:
Language → Document Intelligence SDK version | Package | Supported API version | Platform support |
---|---|---|---|
.NET/C# → latest (GA) | NuGet | 2023-07-31 (GA) | |
Java → latest (GA) | Maven repository | 2023-07-31 (GA) | Windows, macOS, Linux |
JavaScript → latest (GA) | npm | 2023-07-31 (GA) | Browser, Windows, macOS, Linux |
Python → latest (GA) | PyPI | 2023-07-31 (GA) | Windows, macOS, Linux |
For more information on other SDK versions, see:
The following tables present the correlation between each SDK version the supported API versions of the Document Intelligence service.
Language | SDK version | API version (default) | Supported clients |
---|---|---|---|
.NET/C# 4.1.0 | v3.1 latest (GA) | 2023-07-31 | DocumentAnalysisClient DocumentModelAdministrationClient |
.NET/C# 4.0.0 | v3.0 (GA) | 2022-08-31 | DocumentAnalysisClient DocumentModelAdministrationClient |
.NET/C# 3.1.x | v2.1 | v2.1 | FormRecognizerClient FormTrainingClient |
.NET/C# 3.0.x | v2.0 | v2.0 | FormRecognizerClient FormTrainingClient |
The Document Intelligence SDK enables the use and management of the Document Intelligence service in your application. The SDK builds on the underlying Document Intelligence REST API allowing you to easily use those APIs within your programming language paradigm. Here's how you use the Document Intelligence SDK for your preferred language:
dotnet add package Azure.AI.FormRecognizer --version 4.1.0
Install-Package Azure.AI.FormRecognizer -Version 4.1.0
using Azure;
using Azure.AI.FormRecognizer.DocumentAnalysis;
There are two supported methods for authentication:
Use a Document Intelligence API key with AzureKeyCredential from azure.core.credentials.
Use a token credential from azure-identity to authenticate with Microsoft Entra ID.
Here's where to find your Document Intelligence API key in the Azure portal:
Important
We recommend Microsoft Entra ID authentication with managed identities for Azure resources to avoid storing credentials with your applications that run in the cloud.
If you use an API key, store it securely somewhere else, such as in Azure Key Vault. Don't include the API key directly in your code, and never post it publicly.
For more information about AI services security, see Authenticate requests to Azure AI services.
//set `<your-endpoint>` and `<your-key>` variables with the values from the Azure portal to create your `AzureKeyCredential` and `DocumentAnalysisClient` instance
string key = "<your-key>";
string endpoint = "<your-endpoint>";
AzureKeyCredential credential = new AzureKeyCredential(key);
DocumentAnalysisClient client = new DocumentAnalysisClient(new Uri(endpoint), credential);
Note
Regional endpoints don't support Microsoft Entra authentication. Create a custom subdomain for your resource in order to use this type of authentication.
Authorization is easiest using the DefaultAzureCredential
. It provides a default token credential, based upon the running environment, capable of handling most Azure authentication scenarios.
Here's how to acquire and use the DefaultAzureCredential for .NET applications:
Install the Azure Identity library for .NET:
dotnet add package Azure.Identity
Install-Package Azure.Identity
Register a Microsoft Entra application and create a new service principal.
Grant access to Document Intelligence by assigning the Cognitive Services User
role to your service principal.
Set the values of the client ID, tenant ID, and client secret in the Microsoft Entra application as environment variables: AZURE_CLIENT_ID
, AZURE_TENANT_ID
, and AZURE_CLIENT_SECRET
, respectively.
Create your DocumentAnalysisClient
instance including the DefaultAzureCredential
:
string endpoint = "<your-endpoint>";
var client = new DocumentAnalysisClient(new Uri(endpoint), new DefaultAzureCredential());
For more information, see Authenticate the client.
Create a client object to interact with the Document Intelligence SDK, and then call methods on that client object to interact with the service. The SDKs provide both synchronous and asynchronous methods. For more insight, try a quickstart in a language of your choice.
The Microsoft Q & A and Stack Overflow forums are available for the developer community to ask and answer questions about Azure AI Document Intelligence and other services. Microsoft monitors the forums and replies to questions that the community has yet to answer. To make sure that we see your question, tag it with azure-form-recognizer
.
Explore Document Intelligence REST API 2023-07-31 operations.
Events
Mar 17, 9 PM - Mar 21, 10 AM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowTraining
Certification
Microsoft Certified: Azure AI Fundamentals - Certifications
展示与 Microsoft Azure 软件和服务开发相关的基本 AI 概念,以创建 AI 解决方案。