Forms Recognizer API – Analyze Receipt

The “Analyze Receipt” operation extracts text and values from a given receipt document. 

API Reference – https://bit.ly/2CqN93E

Pre-requisites

Image requirements

  • Image needs to be PDF, JPEG, PNG

Analyze Receipt Operation

  • Launch Postman
  • Append your endpoint URL from pre-requisites step with  /formrecognizer/v1.0-preview/prebuilt/receipt/asyncBatchAnalyze
  • Provide the subscription key and content-type in Headers tab
  • Provide the image URL of the receipt in the Body tab
  • The linked JPG is provided in the blob URL
  • Here is the output from the AnalyzeReceipt operation. Note: You will receive a HTTP code 202 – Accepted response immediately and it will include an “Operation-Location” header. We need to further query the operation status using the URL specified in this header. The operation ID will expire in 48 hours.
  • Try issuing a ‘GET’ with the Operation-Location URL to get the output.
 {
    "status": "Succeeded",
    "recognitionResults": [
        {
            "page": 1,
            "clockwiseOrientation": 358.99,
            "width": 2268,
            "height": 4032,
            "unit": "pixel",
            "lines": [
                {
                    "boundingBox": [
                        123,
                        129,
                        1617,
                        63,
                        1626,
                        253,
                        131,
                        320
                    ],
                    "text": "DOLLARWORLD PORTRUA",
                    "words": [
                        {
                            "boundingBox": [
                                125,
                                142,
                                1023,
                                99,
                                1032,
                                270,
                                131,
                                311
                            ],
                            "text": "DOLLARWORLD"
                        },
                        {
                            "boundingBox": [
                                1067,
                                97,
                                1610,
                                64,
                                1621,
                                257,
                                1076,
                                268
                            ],
                            "text": "PORTRUA",
                            "confidence": "Low"
                        }
                    ]
                },
                {
                    "boundingBox": [
                        128,
                        336,
                        1156,
                        281,
                        1165,
                        445,
                        137,
                        501
                    ],
                    "text": "GST 109666653",
                    "words": [
                        {
                            "boundingBox": [
                                132,
                                336,
                                414,
                                324,
                                420,
                                488,
                                137,
                                502
                            ],
                            "text": "GST"
                        },
                        {
                            "boundingBox": [
                                468,
                                321,
                                1151,
                                286,
                                1162,
                                443,
                                475,
                                486
                            ],
                            "text": "109666653"
                        }
                    ]
                },
                {
                    "boundingBox": [
                        136,
                        520,
                        1954,
                        417,
                        1965,
                        612,
                        147,
                        715
                    ],
                    "text": "RETURN OR REFUND WITHIN",
                    "words": [
                        {
                            "boundingBox": [
                                139,
                                538,
                                640,
                                499,
                                643,
                                663,
                                146,
                                697
                            ],
                            "text": "RETURN"
                        },
                        {
                            "boundingBox": [
                                703,
                                495,
                                881,
                                482,
                                882,
                                650,
                                705,
                                660
                            ],
                            "text": "OR"
                        },
                        {
                            "boundingBox": [
                                933,
                                479,
                                1445,
                                447,
                                1441,
                                628,
                                933,
                                648
                            ],
                            "text": "REFUND"
                        },
                        {
                            "boundingBox": [
                                1497,
                                444,
                                1957,
                                420,
                                1949,
                                617,
                                1493,
                                626
                            ],
                            "text": "WITHIN"
                        }
                    ]
                },
                {
                    "boundingBox": [
                        148,
                        891,
                        2055,
                        781,
                        2065,
                        970,
                        159,
                        1080
                    ],
                    "text": "30/10/2019 000000#144151",
                    "words": [
                        {
                            "boundingBox": [
                                163,
                                901,
                                985,
                                853,
                                992,
                                1034,
                                170,
                                1068
                            ],
                            "text": "30/10/2019"
                        },
                        {
                            "boundingBox": [
                                1029,
                                850,
                                2047,
                                781,
                                2054,
                                971,
                                1036,
                                1031
                            ],
                            "text": "000000#144151"
                        }
                    ]
                },
                {
                    "boundingBox": [
                        168,
                        1089,
                        553,
                        1081,
                        559,
                        1242,
                        176,
                        1255
                    ],
                    "text": "17:18",
                    "words": [
                        {
                            "boundingBox": [
                                178,
                                1088,
                                543,
                                1078,
                                548,
                                1244,
                                183,
                                1254
                            ],
                            "text": "17:18",
                            "confidence": "Low"
                        }
                    ]
                },
                {
                    "boundingBox": [
                        860,
                        1066,
                        1739,
                        1002,
                        1750,
                        1160,
                        872,
                        1225
                    ],
                    "text": "01 CLERK 01",
                    "words": [
                        {
                            "boundingBox": [
                                871,
                                1068,
                                1078,
                                1061,
                                1091,
                                1207,
                                883,
                                1225
                            ],
                            "text": "01"
                        },
                        {
                            "boundingBox": [
                                1110,
                                1059,
                                1534,
                                1026,
                                1545,
                                1175,
                                1122,
                                1205
                            ],
                            "text": "CLERK"
                        },
                        {
                            "boundingBox": [
                                1596,
                                1019,
                                1740,
                                1002,
                                1751,
                                1163,
                                1607,
                                1172
                            ],
                            "text": "01"
                        }
                    ]
                },
                {
                    "boundingBox": [
                        186,
                        1467,
                        807,
                        1443,
                        814,
                        1618,
                        193,
                        1643
                    ],
                    "text": "2x 3. 90",
                    "words": [
                        {
                            "boundingBox": [
                                209,
                                1474,
                                449,
                                1459,
                                460,
                                1629,
                                223,
                                1640
                            ],
                            "text": "2x"
                        },
                        {
                            "boundingBox": [
                                504,
                                1456,
                                625,
                                1451,
                                633,
                                1625,
                                514,
                                1627
                            ],
                            "text": "3."
                        },
                        {
                            "boundingBox": [
                                657,
                                1449,
                                800,
                                1443,
                                806,
                                1622,
                                665,
                                1625
                            ],
                            "text": "90"
                        }
                    ]
                },
                {
                    "boundingBox": [
                        194,
                        1660,
                        737,
                        1643,
                        743,
                        1808,
                        199,
                        1825
                    ],
                    "text": "DEPT . 01",
                    "words": [
                        {
                            "boundingBox": [
                                194,
                                1660,
                                479,
                                1655,
                                484,
                                1815,
                                200,
                                1827
                            ],
                            "text": "DEPT"
                        },
                        {
                            "boundingBox": [
                                512,
                                1654,
                                556,
                                1652,
                                561,
                                1813,
                                517,
                                1814
                            ],
                            "text": "."
                        },
                        {
                            "boundingBox": [
                                589,
                                1651,
                                732,
                                1645,
                                736,
                                1809,
                                594,
                                1812
                            ],
                            "text": "01"
                        }
                    ]
                },
                {
                    "boundingBox": [
                        1523,
                        1593,
                        1930,
                        1584,
                        1935,
                        1754,
                        1531,
                        1757
                    ],
                    "text": "*7. 80",
                    "words": [
                        {
                            "boundingBox": [
                                1545,
                                1589,
                                1749,
                                1586,
                                1751,
                                1756,
                                1547,
                                1759
                            ],
                            "text": "*7.",
                            "confidence": "Low"
                        },
                        {
                            "boundingBox": [
                                1783,
                                1586,
                                1930,
                                1583,
                                1932,
                                1753,
                                1785,
                                1756
                            ],
                            "text": "80"
                        }
                    ]
                },
                {
                    "boundingBox": [
                        197,
                        1839,
                        831,
                        1835,
                        832,
                        1980,
                        199,
                        1985
                    ],
                    "text": "2x 2.00",
                    "words": [
                        {
                            "boundingBox": [
                                237,
                                1841,
                                466,
                                1844,
                                466,
                                1984,
                                237,
                                1986
                            ],
                            "text": "2x"
                        },
                        {
                            "boundingBox": [
                                533,
                                1843,
                                828,
                                1835,
                                828,
                                1984,
                                533,
                                1984
                            ],
                            "text": "2.00",
                            "confidence": "Low"
                        }
                    ]
                },
                {
                    "boundingBox": [
                        171,
                        1999,
                        741,
                        2007,
                        739,
                        2155,
                        169,
                        2148
                    ],
                    "text": "DEPT . 01",
                    "words": [
                        {
                            "boundingBox": [
                                173,
                                2000,
                                488,
                                2008,
                                484,
                                2146,
                                169,
                                2150
                            ],
                            "text": "DEPT"
                        },
                        {
                            "boundingBox": [
                                518,
                                2008,
                                567,
                                2009,
                                563,
                                2149,
                                514,
                                2148
                            ],
                            "text": "."
                        },
                        {
                            "boundingBox": [
                                597,
                                2010,
                                735,
                                2012,
                                731,
                                2155,
                                593,
                                2150
                            ],
                            "text": "01"
                        }
                    ]
                },
                {
                    "boundingBox": [
                        1543,
                        1980,
                        1944,
                        1980,
                        1945,
                        2142,
                        1544,
                        2137
                    ],
                    "text": "*4. 00",
                    "words": [
                        {
                            "boundingBox": [
                                1553,
                                1977,
                                1759,
                                1978,
                                1757,
                                2140,
                                1552,
                                2139
                            ],
                            "text": "*4.",
                            "confidence": "Low"
                        },
                        {
                            "boundingBox": [
                                1791,
                                1979,
                                1942,
                                1979,
                                1941,
                                2141,
                                1790,
                                2141
                            ],
                            "text": "00"
                        }
                    ]
                },
                {
                    "boundingBox": [
                        136,
                        2350,
                        558,
                        2355,
                        555,
                        2506,
                        134,
                        2507
                    ],
                    "text": "ITEMS",
                    "words": [
                        {
                            "boundingBox": [
                                144,
                                2350,
                                552,
                                2351,
                                551,
                                2508,
                                143,
                                2507
                            ],
                            "text": "ITEMS"
                        }
                    ]
                },
                {
                    "boundingBox": [
                        1177,
                        2343,
                        1331,
                        2351,
                        1324,
                        2501,
                        1165,
                        2484
                    ],
                    "text": "40",
                    "words": [
                        {
                            "boundingBox": [
                                1186,
                                2339,
                                1335,
                                2351,
                                1323,
                                2500,
                                1174,
                                2488
                            ],
                            "text": "40"
                        }
                    ]
                },
                {
                    "boundingBox": [
                        98,
                        2532,
                        712,
                        2528,
                        712,
                        2709,
                        99,
                        2712
                    ],
                    "text": "CREDIT1",
                    "words": [
                        {
                            "boundingBox": [
                                99,
                                2532,
                                709,
                                2529,
                                709,
                                2712,
                                99,
                                2715
                            ],
                            "text": "CREDIT1"
                        }
                    ]
                },
                {
                    "boundingBox": [
                        973,
                        2516,
                        2029,
                        2490,
                        2034,
                        2689,
                        978,
                        2715
                    ],
                    "text": "*11. 80",
                    "words": [
                        {
                            "boundingBox": [
                                1028,
                                2525,
                                1652,
                                2518,
                                1656,
                                2702,
                                1026,
                                2704
                            ],
                            "text": "*11."
                        },
                        {
                            "boundingBox": [
                                1710,
                                2514,
                                2004,
                                2493,
                                2012,
                                2688,
                                1716,
                                2700
                            ],
                            "text": "80"
                        }
                    ]
                },
                {
                    "boundingBox": [
                        47,
                        2964,
                        1907,
                        2935,
                        1910,
                        3137,
                        51,
                        3167
                    ],
                    "text": "5DAYS WITH RCPT ONLY",
                    "words": [
                        {
                            "boundingBox": [
                                66,
                                2965,
                                574,
                                2962,
                                572,
                                3159,
                                64,
                                3159
                            ],
                            "text": "5DAYS",
                            "confidence": "Low"
                        },
                        {
                            "boundingBox": [
                                625,
                                2962,
                                1031,
                                2956,
                                1030,
                                3154,
                                623,
                                3159
                            ],
                            "text": "WITH"
                        },
                        {
                            "boundingBox": [
                                1095,
                                2955,
                                1514,
                                2946,
                                1513,
                                3144,
                                1094,
                                3153
                            ],
                            "text": "RCPT"
                        },
                        {
                            "boundingBox": [
                                1565,
                                2944,
                                1908,
                                2935,
                                1907,
                                3132,
                                1564,
                                3143
                            ],
                            "text": "ONLY"
                        }
                    ]
                },
                {
                    "boundingBox": [
                        19,
                        3192,
                        1835,
                        3160,
                        1839,
                        3371,
                        23,
                        3403
                    ],
                    "text": "FAULTY GOODS EXCEPT",
                    "words": [
                        {
                            "boundingBox": [
                                37,
                                3192,
                                655,
                                3193,
                                657,
                                3395,
                                37,
                                3397
                            ],
                            "text": "FAULTY"
                        },
                        {
                            "boundingBox": [
                                709,
                                3192,
                                1233,
                                3183,
                                1237,
                                3384,
                                711,
                                3394
                            ],
                            "text": "GOODS"
                        },
                        {
                            "boundingBox": [
                                1287,
                                3181,
                                1825,
                                3162,
                                1830,
                                3365,
                                1291,
                                3383
                            ],
                            "text": "EXCEPT"
                        }
                    ]
                },
                {
                    "boundingBox": [
                        20,
                        3430,
                        1186,
                        3419,
                        1189,
                        3646,
                        23,
                        3657
                    ],
                    "text": "SEASON ITEMS",
                    "words": [
                        {
                            "boundingBox": [
                                26,
                                3435,
                                644,
                                3425,
                                647,
                                3655,
                                23,
                                3659
                            ],
                            "text": "SEASON"
                        },
                        {
                            "boundingBox": [
                                717,
                                3425,
                                1173,
                                3424,
                                1181,
                                3649,
                                721,
                                3654
                            ],
                            "text": "ITEMS"
                        }
                    ]
                }
            ]
        }
    ],
    "understandingResults": [
        {
            "pages": [
                1
            ],
            "fields": {
                "Subtotal": null,
                "Total": null,
                "Tax": null,
                "MerchantAddress": null,
                "MerchantName": {
                    "valueType": "stringValue",
                    "value": "DOLLARWORLD PORTRUA",
                    "text": "DOLLARWORLD PORTRUA",
                    "elements": [
                        {
                            "$ref": "#/recognitionResults/0/lines/0/words/0"
                        },
                        {
                            "$ref": "#/recognitionResults/0/lines/0/words/1"
                        }
                    ]
                },
                "MerchantPhoneNumber": null,
                "TransactionDate": {
                    "valueType": "stringValue",
                    "value": null,
                    "text": "30/10/2019",
                    "elements": [
                        {
                            "$ref": "#/recognitionResults/0/lines/3/words/0"
                        }
                    ]
                },
                "TransactionTime": null
            }
        }
    ]
} 

Leave a Reply

Your email address will not be published. Required fields are marked *