304 Shipping Instructions (006020)

This is the standard X12 006020 spec, with 26 loops and 134 segment positions, as OpenEDI JSON, an ediFabric C# template and an ediFabric Native model. To change it for a trading partner, customize it in the EDI Spec Builder.

Loading the spec…
The spec as an OpenAPI 3 schema with x-openedi-* extensions, for ediFabric Native, ediFabric Cloud and the EDI Spec Builder. Download OpenEDI (205 KB) Generate classes
The ediFabric .NET template, class TS304. It needs the common segments, composites and codes of X12 006020, one download for every transaction in the version. Download C# (2 KB) Common files (274 KB)
The intermediary model ediFabric Native loads with set_map. Download Native (172 KB)

Use the 304 spec in your code

ediFabric .NET

Add the C# template and its common files to your project, or reference the template NuGet package, and read 304 files into TS304 objects. See ediFabric .NET.

ediFabric Native

Map version 006020 to the Native model with set_map, then parse 304 files to JSON from Python, Java, C or C#. See Convert between EDI and JSON.

OpenEDI

Select Customize in Spec Builder to copy the spec under your own name, change it for your partner, and parse files against it in EdiNation, ediFabric Native or ediFabric Cloud. Read about OpenEDI.

Generate 304 classes in Python, Java, Node.js, Go, Rust or C

ediFabric Native returns each 304 as JSON, with the property names of the OpenEDI schema. To work with that JSON as typed objects, generate classes from the OpenEDI file in your language and deserialize the JSON into TS304. Serialize the objects back to JSON to build EDI with ediFabric Native. The classes keep the loops, segments, lengths and code lists, but not the EDI data formats, so validate files with ediFabric Native. Read more in Generate a class from OpenEDI.

Python: datamodel-code-generator. Node.js: openapi-typescript. Java, Go, Rust and C: OpenAPI Generator.

304 structure

Loops and segments of the standard 304, with their usage and maximum repeats.

IDNameUsageMax use
STTransaction Set HeaderOptional1
B2Beginning Segment for Shipment Information TransactionMandatory1
B2ASet PurposeOptional1
Y6AuthenticationOptional2
G1Shipment Type InformationOptional1
G2Beyond RoutingOptional1
G3Compensation InformationOptional1
N9Extended Reference InformationOptional100
YNQYes/No QuestionOptional10
V1Vessel IdentificationOptional2
V3Vessel ScheduleOptional1
M0Letter of Credit ReferenceOptional1
CURCurrencyOptional1
Loop M1InsuranceOptional5
M1InsuranceMandatory1
CURCurrencyOptional1
M2Sales/Delivery TermsOptional1
C2Bank IDOptional1
ITDTerms of Sale/Deferred Terms of SaleOptional1
DTMDate/Time ReferenceOptional20
Loop N1Party IdentificationOptional100
N1Party IdentificationMandatory1
N2Additional Name InformationOptional2
N3Party LocationOptional2
N4Geographic LocationOptional1
G61ContactOptional3
Loop R4Port or TerminalOptional20
R4Port or TerminalMandatory1
DTMDate/Time ReferenceOptional15
R2ARoute Information with PreferenceOptional25
R2R22Optional13
K1RemarksOptional12
L11Business Instructions and Reference NumberOptional99
H3Special Handling InstructionsOptional6
L5Description, Marks and NumbersOptional999
X1Export LicenseOptional25
X2Import LicenseOptional5
Loop C8Certifications and ClausesOptional20
C8Certifications and ClausesMandatory1
C8CCertifications Clauses ContinuationOptional5
SUPSupplementary InformationOptional10
Loop LXTransaction Set Line NumberOptional999
LXTransaction Set Line NumberMandatory1
Y2Container DetailsOptional10
Loop N7Equipment DetailsOptional999
N7Equipment DetailsMandatory1
QTYQuantity InformationOptional1
L4MeasurementOptional1
N12Equipment EnvironmentOptional1
M7Seal NumbersOptional5
M7ASeal Number ReplacementOptional100
W09Equipment and TemperatureOptional1
LH6Hazardous CertificationOptional6
Loop L1Rate and ChargesOptional20
L1Rate and ChargesMandatory1
CURCurrencyOptional1
L7Tariff ReferenceOptional1
X1Export LicenseOptional25
X2Import LicenseOptional5
N9Extended Reference InformationOptional100
Loop H1Hazardous MaterialOptional10
H1Hazardous MaterialMandatory1
H2Additional Hazardous Material DescriptionOptional10
Loop LH1Hazardous Identification InformationOptional100
LH1Hazardous Identification InformationMandatory1
LH2Hazardous Classification InformationOptional4
LH3Hazardous Material Shipping Name InformationOptional10
LFHFree-form Hazardous Material InformationOptional25
LEPEPA Required DataOptional3
LH4Canadian Dangerous RequirementsOptional1
LHTTransborder Hazardous RequirementsOptional3
LHRHazardous Material Identifying Reference NumbersOptional5
PERAdministrative Communications ContactOptional5
L11Business Instructions and Reference NumberOptional100
K1RemarksOptional10
Loop PO4Item Physical DetailsOptional100
PO4Item Physical DetailsMandatory1
MEAMeasurementsOptional5
MANMarks and Numbers InformationOptional5
N9Extended Reference InformationOptional5
Loop L0Line Item - Quantity and WeightOptional120
L0Line Item - Quantity and WeightMandatory1
MEAMeasurementsOptional10
N9Extended Reference InformationOptional100
Loop PO4Item Physical DetailsOptional100
PO4Item Physical DetailsMandatory1
MEAMeasurementsOptional5
MANMarks and Numbers InformationOptional5
N9Extended Reference InformationOptional5
QTYQuantity InformationOptional5
L4MeasurementOptional1
LH6Hazardous CertificationOptional6
Loop PALPallet Type and Load CharacteristicsOptional3
PALPallet Type and Load CharacteristicsMandatory1
QTYQuantity InformationOptional1
Loop CTPPricing InformationOptional1
CTPPricing InformationMandatory1
CURCurrencyOptional1
L5Description, Marks and NumbersOptional999
LINItem IdentificationOptional1
L12Alternate Lading DescriptionOptional20
YNQYes/No QuestionOptional10
Loop L1Rate and ChargesOptional20
L1Rate and ChargesMandatory1
CURCurrencyOptional1
L7Tariff ReferenceOptional1
Loop SACService, Promotion, Allowance, or Charge InformationOptional10
SACService, Promotion, Allowance, or Charge InformationMandatory1
CURCurrencyOptional1
Loop L9Charge DetailOptional10
L9Charge DetailMandatory1
CURCurrencyOptional1
X1Export LicenseOptional25
X2Import LicenseOptional5
Loop C8Certifications and ClausesOptional20
C8Certifications and ClausesMandatory1
C8CCertifications Clauses ContinuationOptional5
SUPSupplementary InformationOptional10
Loop H1Hazardous MaterialOptional10
H1Hazardous MaterialMandatory1
H2Additional Hazardous Material DescriptionOptional10
Loop LH1Hazardous Identification InformationOptional1000
LH1Hazardous Identification InformationMandatory1
LH2Hazardous Classification InformationOptional4
LH3Hazardous Material Shipping Name InformationOptional10
LFHFree-form Hazardous Material InformationOptional25
LEPEPA Required DataOptional3
LH4Canadian Dangerous RequirementsOptional1
LHTTransborder Hazardous RequirementsOptional3
LHRHazardous Material Identifying Reference NumbersOptional5
PERAdministrative Communications ContactOptional5
Loop N1Party IdentificationOptional10
N1Party IdentificationMandatory1
N2Additional Name InformationOptional2
N3Party LocationOptional2
N4Geographic LocationOptional1
G61ContactOptional3
Loop L3Total Weight and ChargesOptional1
L3Total Weight and ChargesMandatory1
CURCurrencyOptional1
MEAMeasurementsOptional5
PWKPaperworkOptional50
SUPSupplementary InformationOptional999
Loop L1Rate and ChargesOptional20
L1Rate and ChargesMandatory1
CURCurrencyOptional1
Loop TDSTotal Monetary Value SummaryOptional1
TDSTotal Monetary Value SummaryMandatory1
CURCurrencyOptional1
Loop SACService, Promotion, Allowance, or Charge InformationOptional10
SACService, Promotion, Allowance, or Charge InformationMandatory1
CURCurrencyOptional1
Loop L9Charge DetailOptional10
L9Charge DetailMandatory1
CURCurrencyOptional1
ISSInvoice Shipment SummaryOptional5
V9Event DetailOptional10
K1RemarksOptional999
L11Business Instructions and Reference NumberOptional24
SETransaction Set TrailerOptional1