Documentation Index Fetch the complete documentation index at: https://mintlify.com/bnishit/purchase-ocr/llms.txt
Use this file to discover all available pages before exploring further.
The V4 schema represents the normalized India GST invoice format returned by /api/ocr-structured-v4. This schema is designed for the Indian GST ecosystem with support for CGST/SGST/IGST tax splits, HSN codes, and reconciliation.
V4Doc Type
The top-level document structure returned by the v4 endpoint.
Document-level metadata Supplier/seller name from the invoice
Supplier’s 15-character GSTIN (e.g., “29AABCU9603R1Z5”)
Invoice number or document reference
Invoice date in YYYY-MM-DD format
place_of_supply_state_code
2-digit state code for place of supply (e.g., “29” for Karnataka)
Buyer’s 15-character GSTIN
Currency code (typically “INR”)
Array of line items extracted from the invoice. See V4Item schema below.
Document-level discounts applied before line-item totals Discount label (e.g., “Trade Discount”, “Special Discount”)
Either “PERCENT” or “ABSOLUTE”
Discount value (percentage 0-100 or absolute amount)
Application order for sequential discounts
Additional charges like shipping, handling, packing Charge label (e.g., “Freight”, “Packing Charges”)
Charge amount excluding GST
GST rate percentage if applicable
GST amount on this charge
Total charge including GST
Whether this charge is subject to GST
Tax Collected at Source information Description of the base amount TCS was calculated on
Round-off adjustment to arrive at final grand total
Computed totals after reconciliation Sum of all line items excluding tax and after discounts
Total header-level discount amount
Sum of additional charges excluding tax
Total taxable amount before GST
Total GST amount (CGST + SGST + IGST)
Final invoice total including all taxes and charges
Anchor values printed on the invoice for reconciliation Taxable subtotal printed on invoice
Total GST amount printed on invoice
HSN-wise tax breakup table if present
Grand total printed on invoice
Reconciliation results and diagnostics Absolute difference between computed and printed grand total. Values ≤ ₹0.05 indicate successful reconciliation.
List of candidate hypotheses tested during reconciliation
Any warnings or issues encountered during reconciliation
Metadata about the extraction process Number of pages processed
Detected invoice language
Overall confidence score (0-1)
V4Item Type
Represents a single line item on the invoice.
HSN code (Harmonized System of Nomenclature)
Unit of measurement (e.g., “PCS”, “KGS”, “BOX”)
Unit rate excluding tax (best source determined by reconciliation)
Line-level discount information First discount percentage (0-100)
Second discount percentage (0-100)
Flat discount amount per unit
Effective combined discount percentage
Total discount amount for this line
GST information for this line item GST rate percentage (0, 5, 12, 18, 28)
Central GST amount (intra-state)
State GST amount (intra-state)
Integrated GST amount (inter-state)
Total GST amount (cgst + sgst + igst)
Computed line totals Line total excluding tax (qty × rate_ex_tax - discount)
Raw extraction data before reconciliation Rate value printed on invoice
Either “WITH_TAX” or “WITHOUT_TAX”
Discount percentage printed on invoice
special_discount_pct_printed
Special discount percentage if shown separately
Line amount printed on invoice
amount_ex_tax_before_discount
Amount before discounts excluding tax
amount_ex_tax_after_discount
Amount after discounts excluding tax
Display hints for UI rendering (structure varies)
Confidence score for this line item (0-1)
Example Response
{
"doc_level" : {
"supplier_name" : "ABC Enterprises" ,
"supplier_gstin" : "29AABCU9603R1Z5" ,
"invoice_number" : "INV-2024-001" ,
"invoice_date" : "2024-03-01" ,
"place_of_supply_state_code" : "29" ,
"buyer_gstin" : "27AAPFU0939F1ZV" ,
"currency" : "INR"
},
"items" : [
{
"name" : "Widget A" ,
"hsn" : "8471" ,
"qty" : 10 ,
"uom" : "PCS" ,
"rate_ex_tax" : 100.00 ,
"discount" : {
"d1_pct" : 10 ,
"d2_pct" : null ,
"flat_per_unit" : null ,
"effective_pct" : 10.00 ,
"amount" : 100.00
},
"gst" : {
"rate" : 18 ,
"cgst" : 81.00 ,
"sgst" : 81.00 ,
"igst" : 0 ,
"amount" : 162.00
},
"totals" : {
"line_ex_tax" : 900.00 ,
"line_inc_tax" : 1062.00
},
"confidence" : 0.95
}
],
"header_discounts" : [],
"charges" : [
{
"label" : "Freight" ,
"ex_tax" : 50.00 ,
"gst_rate_hint" : 18 ,
"gst_amount" : 9.00 ,
"inc_tax" : 59.00 ,
"taxable" : true
}
],
"tcs" : {
"rate" : 0 ,
"amount" : 0 ,
"base_used" : ""
},
"round_off" : -0.50 ,
"totals" : {
"items_ex_tax" : 900.00 ,
"header_discounts_ex_tax" : 0 ,
"charges_ex_tax" : 50.00 ,
"taxable_ex_tax" : 950.00 ,
"gst_total" : 171.00 ,
"grand_total" : 1120.50
},
"printed" : {
"taxable_subtotal" : 950.00 ,
"gst_total" : 171.00 ,
"hsn_tax_table" : [],
"grand_total" : 1121.00
},
"reconciliation" : {
"error_absolute" : 0.50 ,
"alternates_considered" : [
"Candidate 1: price_mode=WITHOUT_TAX, non_taxable_charges=include" ,
"Candidate 2: price_mode=WITH_TAX, non_taxable_charges=include"
],
"warnings" : []
},
"meta" : {
"pages_processed" : 1 ,
"language" : "en" ,
"overall_confidence" : 0.93
}
}
OCR Structured V4 Endpoint Use this schema with the v4 API endpoint
Understanding Reconciliation Learn how reconciliation works
Reconciliation Engine Deep dive into the reconciliation algorithm
MyBillBook Schema Alternative compact schema format