304 Shipping Instructions (Ocean) (003030)

This is the standard X12 003030 spec, with 10 loops and 66 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 (92 KB) Generate classes
The ediFabric .NET template, class TS304. It needs the common segments, composites and codes of X12 003030, one download for every transaction in the version. Download C# (1 KB) Common files (159 KB)
The intermediary model ediFabric Native loads with set_map. Download Native (84 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 003030 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
N9Reference NumberOptional100
V1Vessel IdentificationOptional2
V3Vessel ScheduleOptional1
M0Letter of Credit ReferenceOptional1
M1InsuranceOptional5
M2Sales/Delivery TermsOptional1
C2Bank IDOptional1
C3CurrencyOptional1
Loop N1NameMandatory10
N1NameMandatory1
N2Additional Name InformationOptional2
N3Address InformationOptional2
N4Geographic LocationOptional1
G61ContactOptional3
Loop R4PortMandatory20
R4PortMandatory1
DTMDate/Time ReferenceOptional15
R2Route InformationOptional13
K1RemarksOptional12
L11Business InstructionsOptional99
H3Special Handling InstructionsOptional6
L5Description, Marks and NumbersOptional999
Loop LXAssigned NumberMandatory999
LXAssigned NumberMandatory1
Y2Container DetailsOptional10
Loop N7Equipment DetailsOptional999
N7Equipment DetailsMandatory1
QTYQuantityOptional1
N12Equipment EnvironmentOptional1
M7Seal NumbersOptional5
W09Equipment and TemperatureOptional1
Loop L1Rate and ChargesOptional20
L1Rate and ChargesMandatory1
C3CurrencyOptional1
L4MeasurementOptional1
L7Tariff ReferenceOptional1
X1Export LicenseOptional1
X2Import LicenseOptional1
N9Reference NumberOptional3
Loop H1Hazardous MaterialOptional10
H1Hazardous MaterialMandatory1
H2Additional Hazardous Material DescriptionOptional10
K1RemarksOptional10
Loop L0Line Item - Quantity and WeightOptional120
L0Line Item - Quantity and WeightMandatory1
MEAMeasurementsOptional10
L5Description, Marks and NumbersOptional999
L12Alternate Lading DescriptionOptional20
Loop L1Rate and ChargesOptional20
L1Rate and ChargesMandatory1
C3CurrencyOptional1
L4MeasurementOptional1
L7Tariff ReferenceOptional1
X1Export LicenseOptional1
X2Import LicenseOptional1
C8Certifications and ClausesOptional10
Loop H1Hazardous MaterialOptional10
H1Hazardous MaterialMandatory1
H2Additional Hazardous Material DescriptionOptional10
L3Total Weight and ChargesMandatory1
MEAMeasurementsOptional5
PWKPaperworkOptional25
Loop L1Rate and ChargesOptional20
L1Rate and ChargesMandatory1
C3CurrencyOptional1
V9Event DetailOptional10
K1K12Optional999
L11L112Optional24
SETransaction Set TrailerOptional1