Key Value Extraction (Receipts)

Key value extraction can be used to identify values for predefined keys in a receipt. For example, if a receipt includes a merchant name, merchant address, or merchant phone number, Document Understanding can identify these values and return them as a key value pair.

The supported features are:
  • Extract values for predefined key value pairs
  • Bounding polygons
  • Single request
  • Batch request
Limitations:
  • Supports receipts in English only.

The supported fields are:

Supported Fields
Field Description
MerchantName The name of the merchant issuing the receipt.
MerchantPhoneNumber The telephone number of the merchant.
MerchantAddress The address of the merchant.
TransactionDate The date the receipt was issued.
TransactionTime The time the receipt was issued.
Total The total amount of the receipt, after all charges and taxes have been applied.
Subtotal The subtotal before taxes.
Tax Any sales taxes.
Tip The amount of tip given by the purchaser.

The supported line item information is:
Supported Line Items
Line Item Description
ItemName Name of the item.
ItemPrice Unit price of the item.
ItemQuantity The number of each item purchased.
ItemTotalPrice The total price of the line item.

Key Value Extraction (Receipts) Example

An example of key value extraction use in Document Understanding.

Input document
Figure 1. Key Value Extraction (Receipts) Input
Receipt from a fictitious cafe, including two line items, tax, subtotal and total amounts.
API Request:
{ 
            "processorConfig": {  
            "processorType": "GENERAL",  
            "features": [   
            {    
            "featureType": "KEY_VALUE_EXTRACTION"   
            },  
            "documentType": "RECEIPT" 
            }, 
            "inputLocation": {  
            "sourceType": "OBJECT_STORAGE_LOCATIONS",  
            "objectLocations": [   
            {    
            "source": "OBJECT_STORAGE",    
            "namespaceName": "",   
            "bucketName": "",    
            "objectName": ""   
            }  
            ] 
            }, 
            "compartmentId": "", 
            "outputLocation": {  
            "namespaceName": "",  
            "bucketName": "",  
            "prefix": "" 
            }
            }
Output:
Figure 2. Key Value Extraction (Receipts) Output
The fictitious receipt with only specific lines and fields highighted
API Response:
{ "documentMetadata":
            { "pageCount": 1,
            "mimeType": "image/jpeg" },
            "pages":
            [ { "pageNumber": 1, 
            "dimensions":
            { "width": 361,
            "height": 600,
            "unit": "PIXEL" },
            ...
            "documentFields":
            [ { "fieldType": "KEY_VALUE",
            "fieldLabel":
            { "name": "MerchantName" },
            "fieldValue":
            { "valueType": "STRING",
            "boundingPolygon":
            { "normalizedVertices":
            [ { "x": 0.0664819944598338,
            "y": 0.011666666666666667 },
            { "x": 0.3157894736842105,
            "y": 0.011666666666666667 },
            { "x": 0.3157894736842105,
            "y": 0.035 },
            { "x": 0.0664819944598338,
            "y": 0.035 } ]
            },
            "wordIndexes":
            [ 0, 1 ],
            "value": "Example cafe" } },
            ...