> For the complete documentation index, see [llms.txt](https://docs.mastersindia.co/masters-india-apis/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mastersindia.co/masters-india-apis/invoice-ocr-api/ocr-tax-invoice-api.md).

# OCR Tax Invoice API

### OCR Upload API - where user can upload the document ans start parsing the data from the doc

MI  OCR API **Response Form is JSON**

**Field data** is a term that refers to the data collected from a field.

1. **Field name** -A field name identifies the type or meaning of the data stored in the field.
2. **Value** - can be a string, a number, an object, an array, a boolean, or null.
3. **Accuracy**  - deonte the confidence of model that particular field is labelled correct as mentioned in invoice&#x20;

**Table data** is a term that refers to the data that is organized in a tabular format, such as rows and columns.

###

Use this API to Extract data from the Invoice/Delivery order & Bill of Entry & E-invoice QR code

{% tabs %}
{% tab title="Data Ectraction API" %}
**Upload API**

<table><thead><tr><th width="130">Name</th><th width="592">Description</th></tr></thead><tbody><tr><td><strong>API</strong></td><td>Upload</td></tr><tr><td><strong>URL</strong></td><td><a href="https://api-platform.mastersindia.co/api/v1/ocr/upload/">https://api-platform.mastersindia.co/api/v2/ocr/upload</a></td></tr><tr><td><strong>Method Type</strong></td><td>POST</td></tr><tr><td><strong>Headers</strong></td><td></td></tr><tr><td><strong>Body</strong></td><td></td></tr><tr><td><strong>Action</strong> </td><td>Hit the Send button.</td></tr><tr><td><strong>Note</strong> </td><td><p><strong>Sync</strong> <strong>OCR Service</strong> will extract the first 5 pages from the file to ensure faster processing. To fulfill you use case of more than 5-pages file please use our </p><p></p><p><strong>Async OCR Service.</strong><br>Response may vary as per data available in the Invoice - In key value Pair and Line items</p></td></tr><tr><td><strong>Response</strong></td><td><p></p><pre class="language-json"><code class="lang-json">{
    "data": {
        "invoices": [
            {
                "field_data": {
                    "currency": {
                        "value": "INR",
                        "accuracy": 0.0
                    },
                    "buyer_gstin": {
                        "value": "03AAICM5508J1ZI",
                        "accuracy": 71.3
                    },
                    "invoice_type": {
                        "value": "TAX INVOICE",
                        "accuracy": 98.99303615093231
                    },
                    "buyer_pan_number": {
                        "value": "AAICM5508J",
                        "accuracy": 99.88749623298645
                    },
                    "place_of_supply": {
                        "value": "MAHARASHTRA (27)",
                        "accuracy": 99.42076802253723
                    },
                    "ewaybill_number": {
                        "value": "691548424357",
                        "accuracy": 99.96246099472046
                    },
                    "invoice_amount": {
                        "value": 4298376.56,
                        "accuracy": 94.1
                    },
                    "invoice_date": {
                        "value": "08/04/2023",
                        "accuracy": 93.6
                    },
                    "invoice_number": {
                        "value": "24183001003678",
                        "accuracy": 94.1
                    },
                    "po_number": {
                        "value": "24183000",
                        "accuracy": 94.1
                    },
                    "invoice_due_date": {
                        "value": "08/04/2023",
                        "accuracy": 94.1
                    },
                    "payment_term": {
                        "value": "30",
                        "accuracy": 94.1
                    },
                    "irn": {
                        "value": "IRN887292f8b4469c62a933bc56a6a8e131a8ebb88id2059fd93796ce2c2blbe",
                        "accuracy": 99.77746605873108
                    },
                    "ship_to_gstin": {
                        "value": "03AAICM5508J1ZI",
                        "accuracy": 99.84920024871826
                    },
                    "ship_to_name": {
                        "value": "TOPPAN SPECIALITY FILMS PRIVATE LTD",
                        "accuracy": 95.97364783287048
                    },
                    "supplier_gstin": {
                        "value": "24AAACR5055K1ZD",
                        "accuracy": 42.3
                    },
                    "pan_number": {
                        "value": "AAACR5055K",
                        "accuracy": 99.80529546737671
                    },
                    "total_igst": {
                        "value": 655684.56,
                        "accuracy": 99.9909281730651
                    },
                    "total_cgst": {
                        "value": 655684.56,
                        "accuracy": 99.99092817306519
                    },
                    "total_sgst": {
                        "value": 655684.56,
                        "accuracy": 99.99092817306519
                    },
                    "total_taxable": {
                        "value": 3642692.0,
                        "accuracy": 84.7
                    },
                    "total_discount": {
                        "value": 6584.56,
                        "accuracy": 93.8
                    },
                    "rounding_amount": {
                        "value": 0.38,
                        "accuracy": 84.7
                    },
                    "supplier_address": {
                        "value": "PO Motikhavdi\nMeghpar Padana Gagva\nJamnagar, Gujarat (24) , 361140",
                        "accuracy": 88.9
                    },
                    "buyer_address": {
                        "value": "419 BHAI MOHAN SINGH NAGAR VILLAGE RAILMAJRA TEHSIL BALACHAUR SHAHID BHAGAT SINGH NAGAR ",
                        "accuracy": 96.73346143502457
                    },
                    "supplier_name": {
                        "value": "Reliance Industries Limited",
                        "accuracy": 93.6
                    },
                    "buyer_name": {
                        "value": "TOPPAN SPECIALITY FILMS PRIVATE LTD",
                        "accuracy": 93.3
                    },
                    "ship_to_address": {
                        "value": "419 BHAI MOHAN SINGH NAGAR\nVILLAGE RAILMAJRA\nTEHSIL BALACHAUR\nNAWANSHAHR, PUNJAB (03) , 144533",
                        "accuracy": 87.3
                    },
                    "total_tax_amount": {
                        "value": 655684.56,
                        "accuracy": 93.8
                    },
                    "supplier_gstin_status": {
                        "value": true,
                        "accuracy": 100
                    },
                    "supplier_einvoice_status": {
                        "value": true,
                        "accuracy": 100
                    }
                },
                "table_data": [
                    [
                       {
                            "item_total_amount": {
                                "value": 30.00,
                                "accuracy": 85.2
                            },
                            "item_description": {
                                "value": "Item01 :",
                                "accuracy": 71.7
                            },
                            "item_hsn": {
                                "value": "996601",
                                "accuracy": 72.6
                            },
                            "item_unit_price": {
                                "value": 2750.00,
                                "accuracy": 51.8
                            },
                            "item_cgst_rate": {
                                "value": 6.0,
                                "accuracy": 0
                            },
                            "item_cgst_value": {
                                "value": 165.0,
                                "accuracy": 0
                            },
                            "item_sgst_rate": {
                                "value": 6.0,
                                "accuracy": 0
                            },
                            "item_sgst_value": {
                                "value": 165.0,
                                "accuracy": 0
                            },
                            "item_quantity": {
                                "value": 1,
                                "accuracy": 0
                            },
                            "item_taxable_value": {
                                "value": 2750.0,
                                "accuracy": 0
                            },
                            "item_uom": {
                                "value": "Liters",
                                "accuracy": 86.9
                            },
                            "item_igst_rate": {
                                "value": 18.0,
                                "accuracy": 0
                            },
                            "item_igst_value": {
                                "value": 289.08,
                                "accuracy": 0
                            }
                        },
                        {
                            "item_total_amount": {
                                "value": 840.00,
                                "accuracy": 85.2
                            },
                            "item_description": {
                                "value": "Item01",
                                "accuracy": 85.2
                            },
                            "item_hsn": {
                                "value": "996601",
                                "accuracy": 72.7
                            },
                            "item_unit_price": {
                                "value": 750.00,
                                "accuracy": 59.0
                            },
                            "item_cgst_rate": {
                                "value": 6.0,
                                "accuracy": 0
                            },
                            "item_cgst_value": {
                                "value": 45.0,
                                "accuracy": 0
                            },
                            "item_sgst_rate": {
                                "value": 6.0,
                                "accuracy": 0
                            },
                            "item_sgst_value": {
                                "value": 45.0,
                                "accuracy": 0
                            },
                            "item_quantity": {
                                "value": 1,
                                "accuracy": 0
                            },
                            "item_taxable_value": {
                                "value": 750.0,
                                "accuracy": 0
                            },
                            "item_uom": {
                                "value": "Liters",
                                "accuracy": 86.9
                            },
                            "item_igst_rate": {
                                "value": 18.0,
                                "accuracy": 0
                            },
                            "item_igst_value": {
                                "value": 289.08,
                                "accuracy": 0
                            }
                        },
                    ]
                ],
                "file_url": [
                    "https://qa-arapback.mastersindia-einv.com/api/v2/get-presigned-file/?file=invoiceannotation/img_387_0003e18343ce8bef187bd767ac68_page0.jpg",
                    "https://qa-arapback.mastersindia-einv.com/api/v2/get-presigned-file/?file=invoiceannotation/img_387_01cd90e073acfe6e4a6b00ac09_page1.jpg"
                ],
                "file_status": "duplicate for 594720341085781510",
                "file_name": "Invoice-3.pdf",
                "qr_status": "QR Success"
                "doc_type": "tax_invoice"
            }
        ],
        "request_status": "completed"
    },
    "message": "Data Extracted Successfully",
    "status_code": 200,
    "success": true
}
</code></pre></td></tr></tbody></table>

<table><thead><tr><th width="132.40740966796875">Key</th><th>Values</th><th>Mandatory</th></tr></thead><tbody><tr><td>Authorization</td><td>JWT {{token}}</td><td>Yes</td></tr><tr><td>subid</td><td>Will be shared during POC.</td><td>Yes</td></tr><tr><td>productid</td><td>arap</td><td>Yes</td></tr><tr><td>mode</td><td>Buyer</td><td>Yes</td></tr></tbody></table>

<table><thead><tr><th width="138.851806640625">form_data</th><th width="100"></th><th></th></tr></thead><tbody><tr><td>file_url</td><td>file</td><td><p><strong>Select file -</strong> </p><p>you can upload are - </p><p>PDF/JPEG/PNG</p></td></tr><tr><td>document_type</td><td></td><td><br></td></tr></tbody></table>
{% endtab %}
{% endtabs %}

You can use this JSON Response in your ERP or Software as per your requirement

### OCR API Errors

<table><thead><tr><th width="101.96295166015625">HTTP Status CODE</th><th width="126.148193359375">HTTP CODE MSG</th><th width="153.370361328125">Request Message</th><th>Description</th></tr></thead><tbody><tr><td>400</td><td>Bad Request</td><td>Invalid Params format type!</td><td>When user requested to extract BOE file details by mentioning Document type as BOE but forgot to mention the format of boe i.e form13, form14, boe, export, boe_v2</td></tr><tr><td></td><td></td><td>Invalid Params Business Unit</td><td>When Subid is missing from the request header</td></tr><tr><td></td><td></td><td>Invalid Params file url!</td><td>File Url missing from request body</td></tr><tr><td></td><td></td><td>File content type not supported</td><td>The file upload is not of one following content type ["image/jpeg", "image/jpg", "image/png", "application/pdf"]</td></tr><tr><td></td><td></td><td>File uploaded is not a valid file name</td><td>The file name is not valid like contain "%00" or "\x00"</td></tr><tr><td></td><td></td><td>Multiple files not allowed!</td><td>Trying to upload more than one file at a time</td></tr><tr><td></td><td></td><td>Invalid File Format!</td><td>File upload is having a valid extension i.e ['.jpg', '.jpeg', '.png', '.pdf']:</td></tr><tr><td>403</td><td>Forbidden</td><td>Unauthorized Product</td><td>Product ID provided is other than arap</td></tr><tr><td></td><td></td><td>No Organization found</td><td>When the user credential used is not part of any organization</td></tr><tr><td></td><td></td><td>No Organization found for this User!</td><td>When User is part of some other organization</td></tr><tr><td></td><td></td><td>Invalid User!</td><td>No User found based on credentials</td></tr><tr><td></td><td></td><td>Unauthorized for this Business Unit</td><td>No user assigned with the particular Bussines unit</td></tr><tr><td>206</td><td>Partial Content</td><td>You consumed your allotted units for ocr organization &#x3C;org_id></td><td>Subscription expire</td></tr><tr><td></td><td></td><td>Error in creation of ocr as &#x3C;ex>,</td><td>Error in ocr extraction</td></tr><tr><td></td><td></td><td>Data Extraction Failed</td><td>Error in ocr extraction</td></tr><tr><td>408</td><td>Request Timeout</td><td>Timeout for 120 sec</td><td>Timeout for 120 sec</td></tr><tr><td>200</td><td>Success</td><td>Data Extracted Successfully</td><td></td></tr></tbody></table>

### Fields OCR Extract

The table will explain the Field Name with Descriptions, Type, and example

<table><thead><tr><th width="157">Type</th><th width="199">Field Name</th><th width="221">Filed key</th><th>Data Type</th></tr></thead><tbody><tr><td><strong>Key Value pair</strong></td><td>Currency</td><td>currency</td><td>String</td></tr><tr><td></td><td>Invoice No.</td><td>invoice_number</td><td>String</td></tr><tr><td></td><td>Invoice Date</td><td>invoice_date</td><td>String</td></tr><tr><td></td><td>Invoice Due Date</td><td>invoice_due_date</td><td>String</td></tr><tr><td></td><td>PO No</td><td>po_number</td><td>String</td></tr><tr><td></td><td>Payment Terms</td><td>payment_term</td><td>String</td></tr><tr><td></td><td>IRN</td><td>irn</td><td>String</td></tr><tr><td></td><td>Invoice Type</td><td>invoice_type</td><td>String</td></tr><tr><td></td><td>E Way Bill Number</td><td>ewaybill_number</td><td>String</td></tr><tr><td></td><td>Supplier Name</td><td>supplier_name</td><td>String</td></tr><tr><td></td><td>Supplier Pan</td><td>pan_number</td><td>String</td></tr><tr><td></td><td>Supplier GSTIN</td><td>supplier_gstin</td><td>String</td></tr><tr><td></td><td>Supplier Address</td><td>supplier_address</td><td>String</td></tr><tr><td></td><td>Buyer Address</td><td>buyer_address</td><td>String</td></tr><tr><td></td><td>Buyer Name</td><td>buyer_name</td><td>String</td></tr><tr><td></td><td>Buyer Pan</td><td>buyer_pan_number</td><td>String</td></tr><tr><td></td><td>Buyer GSTIN</td><td>buyer_gstin</td><td>String</td></tr><tr><td></td><td>Ship to GSTIN</td><td>ship_to_gstin</td><td>String</td></tr><tr><td></td><td>Shipping Address</td><td>ship_to_address</td><td>String</td></tr><tr><td></td><td>Ship to name</td><td>ship_to_name</td><td>String</td></tr><tr><td></td><td>Ship to Place</td><td>place_of_supply</td><td>String</td></tr><tr><td></td><td>Total Discount</td><td>total_discount</td><td>Integer</td></tr><tr><td></td><td>Total Taxable Value</td><td>total_taxable</td><td>Integer</td></tr><tr><td></td><td>CGST Amount</td><td>total_cgst_amount</td><td>Integer</td></tr><tr><td></td><td>SGST Amount</td><td>total_sgst_amount</td><td>Integer</td></tr><tr><td></td><td>IGST Amount</td><td>total_igst_amount</td><td>Integer</td></tr><tr><td></td><td>Total Tax Amount</td><td>total_tax_amount</td><td>Integer</td></tr><tr><td></td><td>Invoice Amount</td><td>invoice_amount</td><td>Integer</td></tr><tr><td></td><td>Round Off</td><td>rounding_amount</td><td>Integer</td></tr><tr><td></td><td>Supplier GSTIN Status</td><td>supplier_gstin_status</td><td>boolean</td></tr><tr><td></td><td>Supplier einvoice Status</td><td>supplier_einvoice_status</td><td>boolean</td></tr><tr><td><strong>Table</strong></td><td>Line Item Description</td><td>item_description</td><td>String</td></tr><tr><td></td><td>Line Item UOM</td><td>item_uom</td><td>String</td></tr><tr><td></td><td>Line Item HSN</td><td>item_hsn</td><td>String</td></tr><tr><td></td><td>Line Item Unit Price</td><td>item_unit_price</td><td>Integer</td></tr><tr><td></td><td>Line Item Quantity</td><td>item_quantity</td><td>Integer</td></tr><tr><td></td><td>Line Item Discount</td><td>item_discount</td><td>Integer</td></tr><tr><td></td><td>Line Item Taxable Value</td><td>item_taxable_value</td><td>Integer</td></tr><tr><td></td><td>Line Item IGST value</td><td>item_igst_value</td><td>Integer</td></tr><tr><td></td><td>Line Item IGST rate</td><td>item_igst_rate</td><td>Integer</td></tr><tr><td></td><td>Line Item CGST rate</td><td>item_cgst_rate</td><td>Integer</td></tr><tr><td></td><td>Line Item CGST value</td><td>item_cgst_value</td><td>Integer</td></tr><tr><td></td><td>Line Item SGST rate</td><td>item_sgst_rate</td><td>Integer</td></tr><tr><td></td><td>Line Item SGST value</td><td>item_sgst_value</td><td>Integer</td></tr><tr><td></td><td>Line Item Total Amount</td><td>item_total_amount</td><td>Integer</td></tr><tr><td><strong>QR Data</strong></td><td>Qr Supplier Gstin</td><td>qr_supplier_gstin</td><td>String</td></tr><tr><td></td><td>Qr Buyer Gstin</td><td>qr_buyer_gstin</td><td>String</td></tr><tr><td></td><td>Qr Invoice Number</td><td>qr_invoice_number</td><td>String</td></tr><tr><td></td><td>Qr Invoice Date</td><td>qr_invoice_date</td><td>String</td></tr><tr><td></td><td>Qr Invoice Value</td><td>qr_invoice_value</td><td>String</td></tr><tr><td></td><td>Qr Total Item</td><td>qr_total_item</td><td>String</td></tr><tr><td></td><td>Qr Hsn Code</td><td>qr_hsn_code</td><td>String</td></tr><tr><td></td><td>Qr Hash Code</td><td>qr_hash_code</td><td>String</td></tr></tbody></table>

Need Help in Getting Started  Request a Demo or try our [Invoice OCR](https://www.mastersindia.co/invoice-ocr/) Software or API
