Skip to main content

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 header
  • L — line item
  • T — tax detail
  • D — cash discount
  • C — 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:

PositionFieldTypeDescription
col_2header.invoice_numbertextSender-issued invoice number.
col_3header.invoice_datedateDate the invoice was issued.
col_4header.due_datedateDate the full amount is due.
col_5header.delivery_datedateDate the goods or services were delivered.
col_6header.currency_codetextISO 4217 currency code (USD, EUR, GBP, …).
col_7header.order_number_1textBuyer purchase order number.
col_8header.contract_numbertextMaster or framework contract reference.
col_9header.customer_tax_idtextBuyer VAT / tax registration number.
col_10sender.supplier_nametextSupplier / vendor legal name.
col_11sender.supplier_tax_idtextSupplier VAT / tax registration number.
col_12receiver.customer_nametextBuyer / customer legal name.
col_13header.net_amountnumberInvoice-level net (pre-tax) total.
col_14header.tax_amountnumberInvoice-level total tax.
col_15header.gross_amountnumberInvoice-level total gross (net + tax).
col_16bill_to.streettextBill-to street address.
col_17bill_to.citytextBill-to city.
col_18bill_to.postal_codetextBill-to postal / ZIP code.
col_19bill_to.countrytextBill-to country (ISO 3166-1 alpha-2).
col_20ship_to.streettextShip-to street address.
col_21ship_to.citytextShip-to city.
col_22ship_to.postal_codetextShip-to postal / ZIP code.
col_23ship_to.countrytextShip-to country (ISO 3166-1 alpha-2).
col_24payment.bank_accounttextSupplier bank account (IBAN or local format).
col_25payment.bank_nametextSupplier bank name.
col_26payment.payment_methodtextPreferred payment method (ACH, wire, cheque, …).
col_27payment.reference_numbertextPayment reference the buyer should quote when remitting.

L — line item row

First column is L. Remaining columns:

PositionFieldTypeDescription
col_2line.product_code_1textSupplier product / SKU code.
col_3line.product_nametextProduct or service description.
col_4line.quantitynumberLine quantity.
col_5line.unit_pricenumberPrice per unit.
col_6line.unit_of_measuretextUnit of measure (EA, BX, KG, …).
col_7line.net_amountnumberLine net (pre-tax) amount.
col_8line.tax_ratenumberLine tax rate as a percentage.
col_9line.tax_amountnumberLine tax amount.
col_10line.gross_amountnumberLine gross amount (net + tax).

T — tax detail row

First column is T. Remaining columns:

PositionFieldTypeDescription
col_2taxes.tax_nametextTax category or jurisdiction name.
col_3taxes.tax_ratenumberTax rate as a percentage.
col_4taxes.tax_base_amountnumberAmount the tax rate is applied to.
col_5taxes.tax_amountnumberTax amount for this category.

D — cash discount row

First column is D. Remaining columns:

PositionFieldTypeDescription
col_2discounts.discount_descriptiontextHuman-readable description of the discount.
col_3discounts.discount_ratenumberDiscount rate as a percentage.
col_4discounts.discount_amountnumberDiscount amount.
col_5discounts.discount_due_datedateAbsolute date on which the discount expires (YYYY-MM-DD). Leave empty if the sender only supplies a term.
col_6discounts.due_date_basisdateDate the discount period is counted from (YYYY-MM-DD).
col_7discounts.due_date_period_valuenumberNumber of periods from due_date_basis until the discount expires (integer).
col_8discounts.due_date_period_measuretextUnit for the period value. One of DAY, WEEK, MONTH, YEAR.

C — invoice-level charge row (freight, handling, insurance, …)

First column is C. Remaining columns:

PositionFieldTypeDescription
col_2charges.charge_nametextCharge description (freight, handling, insurance, …).
col_3charges.charge_amounttextCharge 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.