Skip to main content
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.
doc_level
object
required
Document-level metadata
items
V4Item[]
required
Array of line items extracted from the invoice. See V4Item schema below.
header_discounts
object[]
Document-level discounts applied before line-item totals
charges
object[]
Additional charges like shipping, handling, packing
tcs
object
Tax Collected at Source information
round_off
number
Round-off adjustment to arrive at final grand total
totals
object
required
Computed totals after reconciliation
printed
object
Anchor values printed on the invoice for reconciliation
reconciliation
object
required
Reconciliation results and diagnostics
meta
object
Metadata about the extraction process

V4Item Type

Represents a single line item on the invoice.
name
string
required
Item name or description
hsn
string
required
HSN code (Harmonized System of Nomenclature)
qty
number
required
Quantity
uom
string
required
Unit of measurement (e.g., “PCS”, “KGS”, “BOX”)
rate_ex_tax
number
required
Unit rate excluding tax (best source determined by reconciliation)
discount
object
required
Line-level discount information
gst
object
required
GST information for this line item
totals
object
required
Computed line totals
raw
object
Raw extraction data before reconciliation
ui_hints
object
Display hints for UI rendering (structure varies)
confidence
number
required
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

Build docs developers (and LLMs) love