410 Rail Carrier Freight Details and Invoice (007020)

This is the standard X12 007020 spec, with 8 loops and 46 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 (141 KB) Generate classes
The ediFabric .NET template, class TS410. It needs the common segments, composites and codes of X12 007020, one download for every transaction in the version. Download C# (1 KB) Common files (232 KB)
The intermediary model ediFabric Native loads with set_map. Download Native (113 KB)

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

ediFabric Native

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

ediFabric Native returns each 410 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 TS410. 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.

410 structure

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

IDNameUsageMax use
STTransaction Set HeaderMandatory1
B3BB3BMandatory1
C4C4Optional1
N9N9Optional30
CMCMOptional2
NTENTEOptional2
Loop N7N7Mandatory500
N7N7Mandatory1
VCVCOptional36
G4G4Optional1
M7M7Optional5
N5N5Optional1
ICICOptional1
IMIMOptional1
M12M12Optional1
GAGAOptional15
N8N8Mandatory499
F9F9Mandatory1
D9D9Mandatory1
Loop N1N1Optional15
N1N1Mandatory1
N2N2Optional2
N3N3Optional2
N4N4Optional1
PERPEROptional2
BLBLOptional12
Loop S1S1Optional12
S1S1Mandatory1
S2S2Optional1
S9S9Optional1
R2R2Optional13
R9R9Optional1
PSPSOptional5
Loop LXLXMandatory25
LXLXMandatory1
L5L5Mandatory15
Loop L0L0Mandatory25
L0L0Mandatory1
MEAMEAOptional3
Loop L1L1Mandatory10
L1L1Mandatory1
DTMDTMOptional4
Loop PIPIOptional30
PIPIMandatory1
CDCDOptional10
Loop T1T1Optional64
T1T1Mandatory1
T2T2Optional30
T3T3Optional12
T6T6Optional1
T8T8Optional99
L3L3Mandatory1
X7X7Optional2
SETransaction Set TrailerMandatory1