Freight Invoice EDI - JSON Specification

Summary

The EDI-flavored JSON for freight-invoice EDI, used as the Chain.io file type "chainioInvoiceEDI". A single "freight_invoice" object drives EDI 110 (Air Freight Details & Invoice), EDI 210 (Motor Carrier Freight Invoice), and EDI 310 (Freight Receipt & Invoice, ocean); the "invoice_category" field selects the transaction set. All values are emitted as strings and are pre-coded to X12 code lists (N1 entity codes, DTM date qualifiers, weight and payment qualifiers); a downstream EDI translation engine performs the X12 serialization, so any segment references are logical correspondence. This is a flattened, single-invoice, EDI-oriented projection and is distinct from the canonical Freight Invoice ("chainioInvoiceJSON"). The tables below list every field the adapter emits; most fields are omitted when the source data has no value.
NameDescription
RootThe top level document.
FreightInvoiceA single freight invoice. All values are strings. Fields listed as required make the adapter fail the invoice (no file is produced) when the source value is missing; several of them can be relaxed or tightened through the adapter configuration, as noted per field.
EntityNameA party keyed by X12 N1 entity code.
PortA port reference (X12 DTM date qualifiers).
ShipmentLegA transport leg.
LegCarrierThe carrier of a shipment leg.
ContainerGroupThe count of containers of one size.
PurchaseOrderA purchase order linked to the service invoice.
AssignedGroupA container grouping.
ContainerA container on the shipment.
PackageDetailA package group's dimensions and weight.
ContainerInvoiceLineA charge line (X12 L1).
DateCollectionShipment milestone datetimes (ISO 8601). A milestone the shipment has no value for is null or absent.
UnlocodeCollectionFlattened port UN/LOCODEs and descriptions. A key is present only when the shipment has that value.
PackedItemA package group (used by "packed_items" and by "commodity_pack").
PackageContainerA container a package group is packed in.
ContainerChargeAn invoice line apportioned to one container.
CommodityGroupPackage groups that share a commodity type.
ReferenceNumberA coded reference number (X12 REF style).
CommercialInvoiceA commercial invoice.
CommercialInvoiceLineA commercial invoice line.
ManufacturerA manufacturer party.
BillOfLadingA bill of lading.
CustomsDeclarationA customs declaration. Dates are YYYYMMDD.
NameData TypeDescriptionRequired
freight_invoiceFreightInvoiceThe single freight invoice object.YES
NameData TypeDescriptionRequired
all_charge_codes_from_sourceStringEvery charge code on the source service invoice, pipe-delimited with a leading and trailing pipe (e.g. "|FRT|FSC|"), including lines the configuration omits.
asap_numberStringWhen the shipment purchase order numbers contain "ASAP#", the text after it. Optional unless configured as required.
assigned_groupAssignedGroupContainer grouping with per-container detail.
bill_to_organizationStringThe bill-to organization id from the service invoice. Required unless the adapter is configured to make it optional.
bills_of_ladingArray<BillOfLading>The shipment bills of lading. Empty when the shipment has none.
booking_referenceStringThe shipment booking reference.
carrier_scacStringCarrier SCAC. Optional unless configured as required.
comma_split_shipper_referenceArray<String>"shipper_reference" split on commas and trimmed.
commercial_invoicesArray<CommercialInvoice>Commercial invoice loop with commercial invoice lines.
commodity_groupsArray<CommodityGroup>Package groups grouped by commodity type.
company_codeStringThe forwarder controlling company code.
concatenated_order_numbersStringThe shipment purchase order numbers joined with ", "; present only when the shipment has purchase orders.
consolidation_detailsObjectEvery property of the canonical consolidation the shipment belongs to, copied as-is (for example "shipper_reference"). Empty when there is no consolidation.
container_countStringThe number of containers on the shipment. Always present ("0" when there are none).
container_detailsArray<ContainerGroup>Containers grouped by size code.
container_invoice_linesArray<ContainerInvoiceLine>Charge lines (X12 L1), grouped by mapped charge code unless configured otherwise.
containerization_typeStringLSE / FCL / LCL. Required unless the adapter is configured to make it optional.
converted_invoice_currencyStringThe currency of "converted_net_amount_due".
converted_net_amount_dueStringThe total due converted to another currency.
customer_referenceStringThe service invoice customer reference.
customs_declarationsArray<CustomsDeclaration>Customs declaration loop.
date_collectionDateCollectionShipment milestone datetimes.
delivery_detention_billable_daysStringThe number of billable delivery detention days.
delivery_distanceStringThe delivery distance, converted from kilometers to the unit in "delivery_distance_original_uom" when one is set.
delivery_distance_original_uomStringThe source unit of the delivery distance.
delivery_modeStringThe delivery mode (e.g. CY/CY).
description_of_goodsStringThe shipment goods description.
entity_namesArray<EntityName>Party loop keyed by X12 N1 entity code.
flow_execution_uuidStringThe Chain.io flow execution id that produced the file.
forwarder_controlling_department_codeStringThe forwarder controlling department code.
forwarder_controlling_department_descriptionStringThe forwarder controlling department description.
freight_payment_termsStringFreight terms (e.g. PPD = prepaid, CC = collect). Optional unless configured as required.
gross_weight_original_uomStringThe source unit of the shipment gross weight.
hmfStringHarbor Maintenance Fee: the amount of the customs declaration fee with code 501.
house_billStringHouse bill of lading. See "master_bill".
imo_numberStringThe vessel Lloyds / IMO number.
inco_termsStringIncoterms (e.g. DAT, DAP). Required unless the adapter is configured to make it optional.
invoice_categoryStringSelects the EDI transaction set: 110, 210 or 310.
invoice_charges_typeStringHow the charge lines compare to their linked cost lines: passthrough (lines are billed at cost and none above it), profit (lines are billed above cost and none at it) or mixed (both, or neither).
invoice_currencyStringThe invoice currency.
invoice_dateStringThe invoice issued date in YYYYMMDD. Required.YES
invoice_line_sum_amountStringThe sum of the invoice line amounts, rounded to 2 decimal places.
invoice_numberStringThe service invoice number. Required. When the adapter is configured to strip the invoice number suffix, anything from the first "/" onward is removed.YES
invoice_payment_term_daysStringThe service invoice payment terms in days.
invoice_payment_termsStringThe service invoice payment terms code.
master_billStringMaster bill of lading. At least one of "master_bill" or "house_bill" is required unless the adapter is configured to make both optional; either can also be configured as individually required.
method_of_paymentStringThe payment method code set in the adapter configuration; the same value on every invoice.
modeStringThe transport mode (AIR, SEA, etc.). Descriptive only: the transaction set is chosen by "invoice_category", not by "mode", so a mode may accompany any category — the example pairs "AIR" with the ocean 310 category.
mpfStringMerchandise Processing Fee: the amount of the customs declaration fee with code 499.
native_referencesArray<ReferenceNumber>Coded references (X12 REF style). Only references with a value and a code or description are included.
net_amount_dueStringThe service invoice total due. Required.YES
number_of_billable_storage_daysStringThe number of billable storage days.
number_of_outer_packsStringThe number of outer packs.
number_of_packagesStringTotal package count. Required unless the adapter is configured to make it optional.
outer_pack_package_type_codeStringThe outer pack package type code.
package_detailsArray<PackageDetail>Package group dimensions and weights.
package_type_codeStringPackage type code.
packages_chargeable_weightStringThe chargeable weight in its source unit. Optional unless the adapter is configured to require chargeable weight.
packages_chargeable_weight_kgsStringThe chargeable weight in kilograms. Optional unless the adapter is configured to require chargeable weight.
packages_chargeable_weight_uomStringThe source unit of the chargeable weight.
packages_gross_weight_kgsStringThe shipment gross weight. Required. Despite the name, the value is converted from kilograms to the unit in "gross_weight_original_uom" when one is set.YES
packed_itemsArray<PackedItem>One entry per package group, with the containers it is packed in.
pickup_actualStringThe actual pickup date in YYYYMMDD. Optional unless the adapter is configured to require it.
pickup_distanceStringThe pickup distance, converted from kilometers to the unit in "pickup_distance_original_uom" when one is set.
pickup_distance_original_uomStringThe source unit of the pickup distance.
portsArray<Port>Port loop: origin, destination, final port and receipt, in that order.
project_referenceStringThe shipment project reference.
purchase_ordersArray<PurchaseOrder>The purchase orders linked to the service invoice.
reference_numberStringThe forwarder reference.
release_typeStringThe bill of lading release type. Optional unless configured as required.
service_levelStringThe shipment service level, translated through the configured service level mappings when any are set.
shipment_legsArray<ShipmentLeg>The shipment transport legs. Empty when the shipment has none.
shipment_po_numberStringThe shipment PO number.
shipper_referenceStringShipper reference. Optional unless configured as required.
storage_rate_original_uomStringThe unit of the storage rate.
storage_rate_per_dayStringThe storage rate per day.
total_packages_quantitiesStringThe sum of the package group quantities; present only when greater than zero.
total_storage_chargesString"storage_rate_per_day" multiplied by "number_of_billable_storage_days"; present only when both are set.
unlocode_collectionUnlocodeCollectionFlattened UN/LOCODEs and descriptions for the import, lading, arrival and final ports.
vessel_nameStringVessel name. Optional unless configured as required.
volumeStringThe shipment volume, converted from cubic meters to the unit in "volume_unit" when one is set. Required unless the adapter is configured to make it optional.
volume_unitStringThe source volume unit. Always present; an empty string when the shipment has none.
voyage_numberStringVoyage number. Optional unless configured as required.
weight_unit_codeStringWeight unit qualifier. Always K (kilograms).
NameData TypeDescriptionRequired
address_1StringAddress line 1. Required for SH, CN, CON, CUS, BT and BF unless the adapter is configured to make the shipper or ship-to address optional.
address_2StringAddress line 2.
cityStringCity.
codeStringThe N1 entity code. SH = shipper (from the consignor, or the shipment ship-from fields), CN = ship-to (from the shipment ship-to fields, or the consignee), CON = consignee organization (always from the consignee location), CUS = forwarder customer, BT = bill-to, BF = bill-from (the seller on an "Invoice", the customer on a "Bill"). Additional parties use the codes configured in the adapter's additional party mapping (by default pickup, consignor, consignee, delivery and customer).
countryStringCountry code.
government_assigned_idStringA government-assigned party id.
government_assigned_id_typeStringThe type of "government_assigned_id".
identifierStringThe party identifier (owners id).
location_identifierStringThe location identifier (location owners id).
location_nameStringLocation name. Additional parties only.
nameStringParty name. Required for SH, CN, CON, CUS, BT and BF unless the adapter is configured to make the shipper or ship-to name optional.
postal_codeStringPostal / ZIP code.
stateStringState / province. Omitted unless it is exactly 2 characters (additional parties excepted).
unlocodeStringUN/LOCODE.
unlocode_descriptionStringUN/LOCODE description.
NameData TypeDescriptionRequired
cityStringCity.
codeStringThe port role. O = origin / lading, M = destination / discharge, FP = final port, R = receipt / import.
code_qualifierStringCode qualifier. Always UN.
countryStringCountry code.
date_qualifierStringThe DTM date qualifier: 369 (departure) on O, 371 (arrival) on M. Not present on FP or R.
date_timeDateTimeThe datetime (ISO 8601): estimated departure on O, estimated arrival on M, actual arrival on FP. Not present on R.
descriptionStringA description of the port.
unlocodeStringUN/LOCODE. On FP this is the ship-to UN/LOCODE, optional unless the adapter is configured to require it.
NameData TypeDescriptionRequired
carrierLegCarrierThe leg carrier.
carrier_scacStringThe leg carrier SCAC.
leg_sequence_numberStringThe leg order.
leg_typeStringThe leg type (e.g. MAIN).
modeStringTransport mode.
vessel_nameStringVessel name.
voyage_numberStringVoyage number.
NameData TypeDescriptionRequired
address_1StringAddress line 1.
address_2StringAddress line 2.
cityStringCity.
countryStringCountry code.
nameStringCarrier name.
postal_codeStringPostal / ZIP code.
stateStringState / province.
NameData TypeDescriptionRequired
equipment_sizeStringThe container size code.
number_of_containersStringThe number of containers with this size code.
NameData TypeDescriptionRequired
customer_order_numberStringThe purchase order number.
NameData TypeDescriptionRequired
assigned_numberStringThe assigned group number. Always 1.
containersArray<Container>One entry per container on the shipment.
NameData TypeDescriptionRequired
arrival_demurrage_free_daysStringFree demurrage days at arrival.
arrival_detention_free_daysStringFree detention days at arrival.
container_dimensions_uomStringThe unit of the container dimensions: the source dimension unit, or FT when none is set. Always present.
container_heightStringContainer height, converted from feet to "container_dimensions_uom".
container_lengthStringContainer length, converted from feet to "container_dimensions_uom".
container_widthStringContainer width, converted from feet to "container_dimensions_uom".
containerization_typeStringThe container containerization type.
equipment_numberStringThe container serial number (container number after the first 4 characters). Required.
equipment_scacStringThe container number owner prefix (first 4 characters).
equipment_sizeStringThe container size code. Required unless the adapter is configured to make it optional.
equipment_size_mappedStringThe size code after the configured size code mappings.
gross_weightStringContainer gross weight. Converted from kilograms to the source unit in "gross_weight_original_uom" when one is set.
gross_weight_original_uomStringThe source unit of the gross weight.
iso_codeStringThe container ISO type code.
origin_gate_in_actualDateTimeThe actual origin gate-in datetime (ISO 8601).
seal_1StringSeal number.
seal_2StringSecond seal number.
seal_3StringThird seal number.
tare_weightStringContainer tare weight, converted from kilograms to the unit in "tare_weight_original_uom" when one is set.
tare_weight_original_uomStringThe source unit of the tare weight.
weight_codeStringAlways K.
weight_qualifierStringAlways G (gross).
NameData TypeDescriptionRequired
gross_weightStringPackage gross weight. Converted from kilograms to the source unit in "gross_weight_original_uom" when one is set.
gross_weight_original_uomStringThe source unit of the gross weight.
heightStringPackage height, converted from centimeters to "package_dimensions_uom" when one is set.
lengthStringPackage length, converted from centimeters to "package_dimensions_uom" when one is set.
package_dimensions_uomStringThe source unit of the package dimensions.
quantityStringThe package quantity.
widthStringPackage width, converted from centimeters to "package_dimensions_uom" when one is set.
NameData TypeDescriptionRequired
allowance_codeStringThe charge code after the configured charge code mappings.
amountStringThe charge amount, to 3 decimal places. Summed per mapped charge code when lines are grouped.
charge_code_descriptionStringThe source charge code description.
converted_amountStringThe amount in the converted currency, to 3 decimal places.
descriptionStringThe charge description.
item_numberStringThe line item number.
quantityStringThe quantity.
NameData TypeDescriptionRequired
arrival_port_actualDateTimeActual port arrival.
arrival_port_estimatedDateTimeEstimated port arrival.
delivery_actualDateTimeActual delivery.
delivery_estimatedDateTimeEstimated delivery.
departure_actualDateTimeActual departure.
departure_estimatedDateTimeEstimated departure.
loading_actualDateTimeActual loading.
loading_estimatedDateTimeEstimated loading.
pickup_actualDateTimeActual pickup.
pickup_estimatedDateTimeEstimated pickup.
NameData TypeDescriptionRequired
arrival_descriptionStringThe arrival port description.
arrival_unlocodeStringThe arrival port UN/LOCODE.
final_port_descriptionStringThe final port description.
final_port_unlocodeStringThe final port UN/LOCODE.
import_descriptionStringThe import port description.
import_unlocodeStringThe import port UN/LOCODE.
lading_descriptionStringThe port of lading description.
lading_unlocodeStringThe port of lading UN/LOCODE.
NameData TypeDescriptionRequired
commodity_descriptionStringThe commodity description.
commodity_typeStringThe commodity type code.
description_of_goodsStringThe goods description.
heightStringPackage height, converted from centimeters to "package_dimensions_uom" when one is set.
lengthStringPackage length, converted from centimeters to "package_dimensions_uom" when one is set.
marks_and_numbersStringMarks and numbers.
package_containersArray<PackageContainer>The containers this package group is packed in.
package_dimensions_uomStringThe source unit of the package dimensions.
package_numberStringThe 1-based position of the package group (within the commodity group, for "commodity_pack").
quantityStringThe package quantity.
received_byStringThe name of the party that received the package. "packed_items" only.
type_codeStringThe package type code.
type_descriptionStringThe package type description.
volumeStringPackage volume, converted from cubic meters to "volume_unit".
volume_unitStringThe source volume unit, or M3 when none is set. Always present.
weightStringPackage gross weight, converted from kilograms to the unit in "weight_converted_uom" when one is set.
weight_converted_uomStringThe unit "weight" was converted to (the source gross weight unit).
widthStringPackage width, converted from centimeters to "package_dimensions_uom" when one is set.
NameData TypeDescriptionRequired
container_dimensions_uomStringThe unit of the container dimensions: the source dimension unit, or FT when none is set. Always present.
container_heightStringContainer height, converted from feet to "container_dimensions_uom".
container_lengthStringContainer length, converted from feet to "container_dimensions_uom".
container_related_chargesArray<ContainerCharge>The invoice lines split evenly across the containers. Present only when the adapter is configured to split charges by container, and only under "packed_items".
container_widthStringContainer width, converted from feet to "container_dimensions_uom".
equipment_numberStringThe container serial number (container number after the first 4 characters).
equipment_scacStringThe container number owner prefix (first 4 characters).
equipment_sizeStringThe container size code.
equipment_size_mappedStringThe size code after the configured size code mappings.
equipment_typeStringThe container ISO type code.
gross_weightStringContainer gross weight. Converted from kilograms to the source unit in "gross_weight_original_uom" when one is set.
gross_weight_original_uomStringThe source unit of the gross weight.
origin_gate_in_actualDateTimeThe actual origin gate-in datetime (ISO 8601).
packed_item_in_container_weightStringThe package group gross weight in kilograms.
seal_1StringSeal number.
tare_weightStringContainer tare weight, converted from kilograms to the unit in "tare_weight_original_uom" when one is set.
tare_weight_original_uomStringThe source unit of the tare weight.
weight_codeStringAlways K.
weight_qualifierStringAlways G (gross).
NameData TypeDescriptionRequired
allowance_codeStringThe charge code after the configured charge code mappings.
amountStringThe line amount divided by the container count, to 3 decimal places. The last charge of the last container absorbs any rounding difference.
descriptionStringThe charge description.
item_numberStringThe line item number.
quantityStringThe quantity.
NameData TypeDescriptionRequired
commodity_descriptionStringThe commodity description of the first package group in the group.
commodity_numberStringThe 1-based commodity group number.
commodity_packArray<PackedItem>The package groups in this commodity group (without "received_by" or "container_related_charges").
commodity_typeStringThe shared commodity type code.
description_of_goodsStringThe goods description of the first package group in the group.
NameData TypeDescriptionRequired
codeStringThe reference qualifier / code.
descriptionStringA description of the reference.
valueStringThe reference value.
NameData TypeDescriptionRequired
commercial_invoice_linesArray<CommercialInvoiceLine>The commercial invoice lines.
currencyStringThe currency.
gross_weight_kgsStringGross weight in kilograms.
inco_termsStringIncoterms.
invoice_numberStringThe commercial invoice number.
manufacturerManufacturerThe commercial invoice manufacturer.
total_dueStringThe total due.
total_other_chargesStringTotal other charges.
total_taxStringTotal tax.
NameData TypeDescriptionRequired
country_of_originStringCountry of origin.
customs_quantityStringThe customs quantity.
customs_quantity_2StringThe second customs quantity.
customs_quantity_uomStringThe customs quantity unit.
descriptionStringThe line description.
duty_rateStringThe first duty rate, to 3 decimal places; present only when it is numeric.
entered_valueStringThe customs entered value.
extended_priceStringThe extended price.
line_idStringThe line id.
manufacturerManufacturerThe line manufacturer.
part_numberStringThe part number.
quantityStringThe quantity.
tariff_numberStringThe tariff (HTS) number.
total_customs_dutyStringThe sum of the line duty amounts. Always present.
total_customs_feesStringThe sum of the line fee amounts. Always present.
unit_of_measureStringThe unit of measure.
unit_of_measure_descriptionStringThe unit of measure description.
unit_priceStringThe unit price.
us_mid_codeStringThe US manufacturer id (MID) code.
NameData TypeDescriptionRequired
address_1StringAddress line 1.
address_2StringAddress line 2.
cityStringCity.
countryStringCountry code.
government_assigned_idStringA government-assigned party id.
government_assigned_id_typeStringThe type of "government_assigned_id".
identifierStringThe party identifier (owners id).
location_identifierStringThe location identifier (location owners id).
nameStringManufacturer name.
postal_codeStringPostal / ZIP code.
stateStringState / province.
NameData TypeDescriptionRequired
codeStringMB = master bill, HB = house bill, SB = sub-house bill (the first of these the bill carries).
house_billStringThe house bill number (when "code" is HB).
issuer_scacStringThe issuer SCAC.
it_numberStringThe in-bond (IT) number.
manifest_quantityStringThe manifest quantity.
manifest_quantity_uomStringThe manifest quantity unit.
master_billStringThe master bill number (when "code" is MB).
subhouse_billStringThe sub-house bill number (when "code" is SB).
NameData TypeDescriptionRequired
broker_filer_codeStringThe broker filer code.
broker_referenceStringThe broker reference.
consignee_codeStringThe consignee code.
customs_modeStringThe customs mode.
customs_typeStringThe customs type.
declaration_numberStringThe declaration number.
entered_valueStringThe entered value.
entry_dateStringThe entry date.
entry_typeStringThe entry type.
export_country_codeStringThe export country code.
export_dateStringThe export date.
import_country_codeStringThe import country code.
import_dateStringThe import date.
importer_codeStringThe importer code.
importer_referenceStringThe importer reference.
manifest_quantityStringThe manifest quantity.
manifest_quantity_uomStringThe manifest quantity unit.
port_of_arrival_codeStringThe port of arrival code.
port_of_entry_codeStringThe port of entry code.
port_of_entry_descriptionStringThe port of entry description.
port_of_loading_codeStringThe port of loading code.
release_dateStringThe release date.
statement_dateStringThe statement date.
submitted_dateStringThe submitted date.
total_dutyStringTotal duty.
total_feesStringTotal fees.

Example