859 Freight Invoice (007010)
This is the standard X12 007010 spec, with 9 loops and 84 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.
Use the 859 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 859 files into TS859 objects. See ediFabric .NET.
ediFabric Native
Map version 007010 to the Native model with set_map, then parse 859 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 859 classes in Python, Java, Node.js, Go, Rust or C
ediFabric Native returns each 859 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 TS859. 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.
859 structure
Loops and segments of the standard 859, with their usage and maximum repeats.
| ID | Name | Usage | Max use |
|---|---|---|---|
| ST | Transaction Set Header | Mandatory | 1 |
| B3 | B3 | Mandatory | 1 |
| B3A | B3A | Optional | 1 |
| N9 | N9 | Optional | 30 |
| CM | CM | Optional | 1 |
| Y6 | Y6 | Optional | 4 |
| Y7 | Y7 | Optional | 1 |
| C3 | C3 | Optional | 1 |
| ITD | ITD | Optional | 1 |
| G62 | G62 | Optional | 10 |
| PER | PER | Optional | 3 |
| NA | NA | Optional | 30 |
| F9 | F9 | Optional | 1 |
| D9 | D9 | Optional | 1 |
| R1 | R1 | Optional | 1 |
| R2 | R2 | Optional | 13 |
| H3 | H3 | Optional | 6 |
| PS | PS | Optional | 5 |
| H6 | H6 | Optional | 6 |
| M1 | M1 | Optional | 1 |
| M2 | M2 | Optional | 1 |
| L7 | L7 | Optional | 30 |
| NTE | NTE | Optional | 30 |
| XH | XH | Optional | 1 |
| P1 | P1 | Optional | 1 |
| ITA | ITA | Optional | 1 |
| N8 | N8 | Optional | 499 |
| R9 | R9 | Optional | 1 |
| Loop H1 | H1 | Optional | 3 |
| H1 | H1 | Mandatory | 1 |
| H2 | H2 | Optional | 2 |
| Loop N7 | N7 | Optional | 600 |
| N7 | N7 | Mandatory | 1 |
| M7 | M7 | Optional | 5 |
| N5 | N5 | Optional | 1 |
| REF | REF | Optional | 5 |
| IC | IC | Optional | 1 |
| VC | VC | Optional | 36 |
| G4 | G4 | Optional | 1 |
| GA | GA | Optional | 15 |
| Loop N1 | N1 | Optional | 10 |
| N1 | N1 | Mandatory | 1 |
| N2 | N2 | Optional | 2 |
| N3 | N3 | Optional | 2 |
| N4 | N4 | Optional | 1 |
| REF | REF | Optional | 12 |
| PER | PER | Optional | 3 |
| Loop S5 | S5 | Optional | 50 |
| S5 | S5 | Mandatory | 1 |
| G62 | G62 | Optional | 6 |
| N9 | N9 | Optional | 10 |
| H6 | H6 | Optional | 6 |
| Loop N1 | N1 | Optional | 5 |
| N1 | N1 | Mandatory | 1 |
| N2 | N2 | Optional | 2 |
| N3 | N3 | Optional | 2 |
| N4 | N4 | Optional | 1 |
| REF | REF | Optional | 12 |
| PER | PER | Optional | 3 |
| Loop LX | LX | Mandatory | 999 |
| LX | LX | Mandatory | 1 |
| Loop N1 | N1 | Optional | 10 |
| N1 | N1 | Mandatory | 1 |
| N2 | N2 | Optional | 2 |
| N3 | N3 | Optional | 2 |
| N4 | N4 | Optional | 1 |
| REF | REF | Optional | 12 |
| PER | PER | Optional | 3 |
| L5 | L5 | Optional | 10 |
| Loop L0 | L0 | Optional | 10 |
| L0 | L0 | Mandatory | 1 |
| L1 | L1 | Optional | 20 |
| MEA | MEA | Optional | 5 |
| L7 | L7 | Optional | 10 |
| SL1 | SL1 | Optional | 1 |
| R1 | R1 | Optional | 1 |
| LH | LH | Optional | 1 |
| N9 | N9 | Optional | 10 |
| X1 | X1 | Optional | 6 |
| X2 | X2 | Optional | 1 |
| P1 | P1 | Optional | 1 |
| POD | POD | Optional | 1 |
| FOB | FOB | Optional | 1 |
| ITA | ITA | Optional | 20 |
| L8 | L8 | Optional | 1 |
| V9 | V9 | Optional | 1 |
| P2 | P2 | Optional | 1 |
| N7 | N7 | Optional | 5 |
| Loop H1 | H1 | Optional | 3 |
| H1 | H1 | Mandatory | 1 |
| H2 | H2 | Optional | 2 |
| L3 | L3 | Optional | 1 |
| SE | Transaction Set Trailer | Mandatory | 1 |