/api/ocr-structured. It follows the MyBillBook invoice data structure and is suitable for simpler invoice processing workflows.
InvoiceDoc Type
The top-level document structure for the compact schema.Invoice header information
Array of invoice line items (see InvoiceItem below)
Buyer/customer information
InvoiceItem Type
Represents a single line item in the compact schema.Item name or description
HSN or SAC code
Quantity as a string
Unit of measurement (e.g., “PCS”, “KGS”)
Unit price excluding tax (as a string)
Tax rate percentage (e.g., “18” for 18% GST)
Line-level discount percentage (e.g., “10” for 10% off)
AdditionalCharge Type
Represents additional charges like freight, packing, handling fees.Charge name (alternative to
label)Charge label (alternative to
name)Charge amount as printed (interpretation depends on
amount_includes_tax)Tax rate percentage (may be combined CGST+SGST string like “9+9”)
Whether
amount is gross (including tax) or net (excluding tax)Normalized amount excluding tax (optional v4-style field)
Normalized amount including tax (optional v4-style field)
GST rate (optional v4-style field)
GST rate hint for inference (optional v4-style field)
GST amount on this charge (optional v4-style field)
Whether this charge is subject to tax (optional v4-style field)
Example Response
Reconciliation
The compact schema can be processed through reconciliation logic (seelib/invoice.ts:reconcileInvoice) which:
- Computes line-level totals from quantity, price, discount, and tax
- Applies invoice-level discounts (before or after tax)
- Adds additional charges with tax handling
- Tests multiple hypotheses to match the printed total
The reconciliation engine for this schema is separate from the V4 reconciliation engine. For more advanced reconciliation with HSN table anchoring and multi-hypothesis testing, use the V4 schema.
Comparison with V4 Schema
| Feature | MyBillBook Schema | V4 Schema |
|---|---|---|
| Format | Compact, string-based | Normalized, number-based |
| Discount types | Single percentage per line | Multiple sequential discounts (d1, d2, flat) |
| Tax representation | Combined rate string | Separate CGST/SGST/IGST amounts |
| Reconciliation | Simple hypothesis testing | 6-phase multi-candidate algorithm |
| HSN anchoring | Not supported | Supported via HSN tax table |
| Use case | Simpler invoices, basic extraction | Complex GST invoices, audit-ready data |
When to Use This Schema
Use the MyBillBook schema when:- You need a simple, compact JSON format
- You’re integrating with systems expecting MyBillBook format
- Invoice complexity is low (no complex discounting schemes)
- You don’t need detailed GST breakdowns
- You need HSN-wise tax reconciliation
- Invoices have complex discount structures
- You need separate CGST/SGST/IGST amounts
- Accuracy and audit compliance are critical
Related
OCR Structured Endpoint
Use this schema with the structured API endpoint
V4 Schema
Alternative normalized schema with advanced reconciliation
Request Formats
Learn how to format API requests
Understanding Reconciliation
How reconciliation works for both schemas
