Line-type discriminator
Use this shape when column 1 of each row is a record-type flag that determines how the rest of the row's columns are interpreted:
H— invoice headerL— line itemT— tax detailD— cash discountC— invoice-level charge (freight, handling, insurance, …)
Because each record type carries its own column layout, a single header row
cannot describe the file. This shape is positional only — the seed's field
locators use col_N. If the sender prepends a preamble (schema-descriptor
rows for humans, one per record type), skip it at the format level by
setting parse_settings.from_line to the first data row.
Config item ID
generic-csv-line-type-positions
Pick this in the admin portal when creating a customer file format from a global template, or select the same config item ID via the API.
Parse settings
{ "delimiter": ",", "columns": false }
Row layout
Rows 1+ are data. H rows start invoices; L, T, D, and
C rows attach to the most recent header.
Loops
invoice loop ← recordType: header, condition: columnValue col_1 eq H
line loop ← recordType: line, condition: columnValue col_1 eq L
tax loop ← recordType: taxes, condition: columnValue col_1 eq T
discount loop ← recordType: discounts, condition: columnValue col_1 eq D
charge loop ← recordType: charges, condition: columnValue col_1 eq C
Fields
Five record schemas keyed off col_1 (the record-type flag). Position numbers below start at col_2 because col_1 holds the flag itself.
H — invoice header row
First column is H. Remaining columns:
| Position | Field | Type | Description |
|---|---|---|---|
col_2 | header.invoice_number | text | Sender-issued invoice number. |
col_3 | header.invoice_date | date | Date the invoice was issued. |
col_4 | header.due_date | date | Date the full amount is due. |
col_5 | header.delivery_date | date | Date the goods or services were delivered. |
col_6 | header.currency_code | text | ISO 4217 currency code (USD, EUR, GBP, …). |
col_7 | header.order_number_1 | text | Buyer purchase order number. |
col_8 | header.contract_number | text | Master or framework contract reference. |
col_9 | header.customer_tax_id | text | Buyer VAT / tax registration number. |
col_10 | sender.supplier_name | text | Supplier / vendor legal name. |
col_11 | sender.supplier_tax_id | text | Supplier VAT / tax registration number. |
col_12 | receiver.customer_name | text | Buyer / customer legal name. |
col_13 | header.net_amount | number | Invoice-level net (pre-tax) total. |
col_14 | header.tax_amount | number | Invoice-level total tax. |
col_15 | header.gross_amount | number | Invoice-level total gross (net + tax). |
col_16 | bill_to.street | text | Bill-to street address. |
col_17 | bill_to.city | text | Bill-to city. |
col_18 | bill_to.postal_code | text | Bill-to postal / ZIP code. |
col_19 | bill_to.country | text | Bill-to country (ISO 3166-1 alpha-2). |
col_20 | ship_to.street | text | Ship-to street address. |
col_21 | ship_to.city | text | Ship-to city. |
col_22 | ship_to.postal_code | text | Ship-to postal / ZIP code. |
col_23 | ship_to.country | text | Ship-to country (ISO 3166-1 alpha-2). |
col_24 | payment.bank_account | text | Supplier bank account (IBAN or local format). |
col_25 | payment.bank_name | text | Supplier bank name. |
col_26 | payment.payment_method | text | Preferred payment method (ACH, wire, cheque, …). |
col_27 | payment.reference_number | text | Payment reference the buyer should quote when remitting. |
L — line item row
First column is L. Remaining columns:
| Position | Field | Type | Description |
|---|---|---|---|
col_2 | line.product_code_1 | text | Supplier product / SKU code. |
col_3 | line.product_name | text | Product or service description. |
col_4 | line.quantity | number | Line quantity. |
col_5 | line.unit_price | number | Price per unit. |
col_6 | line.unit_of_measure | text | Unit of measure (EA, BX, KG, …). |
col_7 | line.net_amount | number | Line net (pre-tax) amount. |
col_8 | line.tax_rate | number | Line tax rate as a percentage. |
col_9 | line.tax_amount | number | Line tax amount. |
col_10 | line.gross_amount | number | Line gross amount (net + tax). |
T — tax detail row
First column is T. Remaining columns:
| Position | Field | Type | Description |
|---|---|---|---|
col_2 | taxes.tax_name | text | Tax category or jurisdiction name. |
col_3 | taxes.tax_rate | number | Tax rate as a percentage. |
col_4 | taxes.tax_base_amount | number | Amount the tax rate is applied to. |
col_5 | taxes.tax_amount | number | Tax amount for this category. |
D — cash discount row
First column is D. Remaining columns:
| Position | Field | Type | Description |
|---|---|---|---|
col_2 | discounts.discount_description | text | Human-readable description of the discount. |
col_3 | discounts.discount_rate | number | Discount rate as a percentage. |
col_4 | discounts.discount_amount | number | Discount amount. |
col_5 | discounts.discount_due_date | date | Absolute date on which the discount expires (YYYY-MM-DD). Leave empty if the sender only supplies a term. |
col_6 | discounts.due_date_basis | date | Date the discount period is counted from (YYYY-MM-DD). |
col_7 | discounts.due_date_period_value | number | Number of periods from due_date_basis until the discount expires (integer). |
col_8 | discounts.due_date_period_measure | text | Unit for the period value. One of DAY, WEEK, MONTH, YEAR. |
C — invoice-level charge row (freight, handling, insurance, …)
First column is C. Remaining columns:
| Position | Field | Type | Description |
|---|---|---|---|
col_2 | charges.charge_name | text | Charge description (freight, handling, insurance, …). |
col_3 | charges.charge_amount | text | Charge amount. |
Sample file
Download generic-csv-line-type-positions.csv
H,INV-2025-0042,2026-07-15,2026-08-14,2026-07-12,USD,PO-88190,MSA-2024-11,US-849201,Northwind Manufacturing LLC,US-441290,Contoso Retail Group,1250.00,112.50,1362.50,"450 Market Street, Suite 200",San Francisco,94105,US,901 Airport Way,Reno,89502,US,US1234567890,First National Bank,ACH,INV-2025-0042
L,SKU-4471,Stainless Bolt M6 x 20 (box of 100),5,85.00,BX,425.00,9.00,38.25,463.25
L,SKU-4472,Stainless Nut M6 (box of 200),3,55.00,BX,165.00,9.00,14.85,179.85
L,SKU-9013,Vibration Damper Kit,2,330.00,EA,660.00,9.00,59.40,719.40
T,CA State,6.00,1250.00,75.00
T,County Levy,3.00,1250.00,37.50
D,2/10 Net 30 early payment,2.00,25.00,2026-07-25,2026-07-15,10,DAY
C,Freight,45.00
C,Handling & pallet,15.00
H,INV-2025-0043,2026-07-15,2026-08-14,2026-07-14,USD,PO-88191,MSA-2024-11,US-849201,Northwind Manufacturing LLC,US-441290,Contoso Retail Group,540.00,48.60,588.60,"450 Market Street, Suite 200",San Francisco,94105,US,2200 Industrial Blvd,Sparks,89434,US,US1234567890,First National Bank,ACH,INV-2025-0043
L,SKU-4471,Stainless Bolt M6 x 20 (box of 100),4,85.00,BX,340.00,9.00,30.60,370.60
L,SKU-9014,Vibration Damper Refill Pack,1,200.00,EA,200.00,9.00,18.00,218.00
T,CA State,6.00,540.00,32.40
T,County Levy,3.00,540.00,16.20
C,Freight,25.00
Expected extraction
Running the sample through this shape's seed extracts 2 invoices with fully populated header, sender, receiver, bill-to, ship-to, payment, and line records, plus per-invoice tax detail, discount, and charge rows. Totals, dates, and identifiers round-trip without loss.