Get KeyValuePairs when using modelId="prebuilt-invoice".

Andreas Palm Sivertsen 0 Reputation points

Hello :)

DocumentAnalysisClient client = new DocumentAnalysisClientBuilder()
	.credential(new AzureKeyCredential(apiKey))
SyncPoller<OperationResult, AnalyzeResult> analyzeInvoicePoller = client.beginAnalyzeDocumentFromUrl("prebuilt-invoice", url);
AnalyzeResult analyzeInvoiceResult = analyzeInvoicePoller.getFinalResult();
List<DocumentKeyValuePair> kartList = analyzeInvoiceResult.getKeyValuePairs();

List of KeyValuePairs is null when the modelId provided is "prebuilt-invoice", but is the actual key value pairs I am after when modelId="prebuilt-document". Is there a way to get key value pairs AND the processed fields you get from the prebuilt invoice model.

Azure AI Document Intelligence
Azure AI Document Intelligence
An Azure service that turns documents into usable data. Previously known as Azure Form Recognizer.
1,052 questions
Azure AI services
Azure AI services
A group of Azure services, SDKs, and APIs designed to make apps more intelligent, engaging, and discoverable.
1,877 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. VasaviLankipalle-MSFT 8,396 Reputation points

    Hello @Andreas Palm Sivertsen , Thanks for using Microsoft Q&A Platform.

    The key-value pairs are supported for the prebuilt-invoice model. However, to get a better understanding of the features available for each model, I recommend visiting the Analysis feature table. This table provides a comprehensive overview of the features available for each model, including prebuilt and custom models.

    I have reproduced, and the key-values pair are generated. Here is the sample python code snippet for the pre-built invoice model to print the key-value pairs of the analyze result:

    for kv_pair in invoices.key_value_pairs:
        if kv_pair.key:
                "Key '{}' found within '{}' bounding regions".format(kv_pair.key.content,
        if kv_pair.value:
                "Value '{}' found within '{}' bounding regions\n".format(kv_pair.value.content,

    Result:User's image

    I hope this helps.


    -Please kindly accept the answer and vote 'yes' if you feel helpful to support the community, thanks.

    0 comments No comments