310 Freight Receipt and Invoice (Ocean) (005050)

This is the standard X12 005050 spec, with 14 loops and 79 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 (134 KB) Generate classes
The ediFabric .NET template, class TS310. It needs the common segments, composites and codes of X12 005050, one download for every transaction in the version. Download C# (2 KB) Common files (271 KB)
The intermediary model ediFabric Native loads with set_map. Download Native (114 KB)

Use the 310 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 310 files into TS310 objects. See ediFabric .NET.

ediFabric Native

Map version 005050 to the Native model with set_map, then parse 310 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 310 classes in Python, Java, Node.js, Go, Rust or C

ediFabric Native returns each 310 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 TS310. 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.

310 structure

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

IDNameUsageMax use
STTransaction Set HeaderOptional1
B3Beginning Segment for Carrier's InvoiceMandatory1
B2ASet PurposeOptional1
Y6AuthenticationOptional2
G3Compensation InformationOptional1
N9Extended Reference InformationOptional15
V1Vessel IdentificationMandatory2
M0Letter of Credit ReferenceOptional1
M1InsuranceOptional5
C2Bank IDOptional1
C3Currency IdentifierOptional1
Y2Container DetailsOptional10
Loop N1Party IdentificationMandatory10
N1Party IdentificationMandatory1
N2Additional Name InformationOptional1
N3Party LocationOptional2
N4Geographic LocationOptional1
G61ContactOptional3
Loop R4Port or TerminalMandatory20
R4Port or TerminalMandatory1
DTMDate/Time ReferenceOptional15
R2ARoute Information with PreferenceOptional25
R2R22Optional13
K1RemarksOptional12
H3Special Handling InstructionsOptional6
L5Description, Marks and NumbersOptional1
Loop C8Certifications and ClausesOptional20
C8Certifications and ClausesMandatory1
C8CCertifications Clauses ContinuationOptional5
Loop LXTransaction Set Line NumberMandatory999
LXTransaction Set Line NumberMandatory1
Loop N7Equipment DetailsOptional999
N7Equipment DetailsMandatory1
QTYQuantity InformationOptional1
V4Cargo Location ReferenceOptional1
N12Equipment EnvironmentOptional1
M7Seal NumbersOptional5
W09Equipment and TemperatureOptional1
Loop L1Rate and ChargesOptional20
L1Rate and ChargesMandatory1
C3Currency IdentifierOptional1
L7Tariff ReferenceOptional1
X1Export LicenseOptional1
X2Import LicenseOptional1
N9Extended Reference InformationOptional3
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
Loop L0Line Item - Quantity and WeightOptional120
L0Line Item - Quantity and WeightMandatory1
L5Description, Marks and NumbersOptional999
Loop L1Rate and ChargesOptional20
L1Rate and ChargesMandatory1
C3Currency IdentifierOptional1
L7Tariff ReferenceOptional1
X1Export LicenseOptional1
X2Import LicenseOptional1
Loop C8Certifications and ClausesOptional20
C8Certifications and ClausesMandatory1
C8CCertifications Clauses ContinuationOptional5
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
L3Total Weight and ChargesMandatory1
PWKPaperworkOptional25
Loop L1Rate and ChargesOptional20
L1Rate and ChargesMandatory1
C3Currency IdentifierOptional1
V9Event DetailOptional10
C8C82Optional20
K1K12Optional999
L11Business Instructions and Reference NumberOptional1
SETransaction Set TrailerOptional1