The 210 is the X12 motor carrier freight details and invoice. Trucking companies send it to the shipper or the party paying the freight to bill for a shipment.
B3 carries the invoice number, shipment ID, payment method and total charges, N1 loops the shipper and consignee, and LX loops with L0, L1 and L5 segments describe the lading, rates and charges.
004010IM (GS01)TS210 in EdiFabric.Templates.X12The full X12 210 layout from its OpenEDI definition, the same model ediFabric uses to parse, validate and generate it: 12 loops and 60 segment positions, in file order. Loops are shaded and their segments indented; Max use is how many times a segment or loop may repeat.
| Segment / loop | Name | Usage | Max use |
|---|---|---|---|
ST | Transaction Set Header | Mandatory | 1 |
B3 | Beginning Segment for Carrier's Invoice | Mandatory | 1 |
C2 | Bank ID | Optional | 1 |
C3 | Currency | Optional | 1 |
ITD | Terms of Sale/Deferred Terms of Sale | Optional | 1 |
N9 | Reference Identification | Optional | 300 |
G62 | Date/Time | Optional | 6 |
R3 | Route Information - Motor | Optional | 12 |
H3 | Special Handling Instructions | Optional | 6 |
K1 | Remarks | Optional | 10 |
| N1 loop | Name | Optional | 10 |
N1 | Name | Mandatory | 1 |
N2 | Additional Name Information | Optional | 1 |
N3 | Address Information | Optional | 2 |
N4 | Geographic Location | Optional | 1 |
N9 | Reference Identification | Optional | 5 |
| N7 loop | Equipment Details | Optional | 10 |
N7 | Equipment Details | Mandatory | 1 |
M7 | Seal Numbers | Optional | 2 |
| SPO loop | Shipment Purchase Order Detail | Optional | 999999 |
SPO | Shipment Purchase Order Detail | Mandatory | 1 |
SDQ | Destination Quantity | Optional | 10 |
| S5 loop | Stop Off Details | Optional | 999 |
S5 | Stop Off Details | Mandatory | 1 |
N9 | Reference Identification | Optional | 10 |
G62 | Date/Time | Optional | 10 |
H3 | Special Handling Instructions | Optional | 6 |
| SPO loop | Shipment Purchase Order Detail | Optional | 999999 |
SPO | Shipment Purchase Order Detail | Mandatory | 1 |
SDQ | Destination Quantity | Optional | 10 |
| N1 loop | Name | Optional | 2 |
N1 | Name | Mandatory | 1 |
N2 | Additional Name Information | Optional | 1 |
N3 | Address Information | Optional | 2 |
N4 | Geographic Location | Optional | 1 |
N9 | Reference Identification | Optional | 5 |
| N7 loop | Equipment Details | Optional | 10 |
N7 | Equipment Details | Mandatory | 1 |
M7 | Seal Numbers | Optional | 2 |
| LX loop | Assigned Number | Optional | 9999 |
LX | Assigned Number | Mandatory | 1 |
N9 | Reference Identification | Optional | 5 |
POD | Proof of Delivery | Optional | 1 |
L5 | Description, Marks and Numbers | Optional | 30 |
H1 | Hazardous Material | Optional | 3 |
H2 | Additional Hazardous Material Description | Optional | 2 |
L0 | Line Item - Quantity and Weight | Optional | 10 |
L1 | Rate and Charges | Optional | 10 |
L4 | Measurement | Optional | 10 |
L7 | Tariff Reference | Optional | 10 |
K1 | Remarks | Optional | 10 |
| SPO loop | Shipment Purchase Order Detail | Optional | 999999 |
SPO | Shipment Purchase Order Detail | Mandatory | 1 |
SDQ | Destination Quantity | Optional | 10 |
| N1 loop | Name | Optional | 999999 |
N1 | Name | Mandatory | 1 |
N2 | Additional Name Information | Optional | 1 |
N3 | Address Information | Optional | 2 |
N4 | Geographic Location | Optional | 1 |
N9 | Reference Identification | Optional | 10 |
| CD3 loop | Carton (Package) Detail | Optional | 999999 |
CD3 | Carton (Package) Detail | Mandatory | 1 |
N9 | Reference Identification | Optional | 20 |
H6 | Special Services | Optional | 10 |
L9 | Charge Detail | Optional | 10 |
POD | Proof of Delivery | Optional | 1 |
G62 | Date/Time | Optional | 1 |
| SPO loop | Shipment Purchase Order Detail | Optional | 999999 |
SPO | Shipment Purchase Order Detail | Mandatory | 1 |
SDQ | Destination Quantity | Optional | 10 |
L3 | Total Weight and Charges | Optional | 1 |
SE | Transaction Set Trailer | Mandatory | 1 |
Mandatory segments must be sent, Optional ones only when the data applies. Trading partners often add their own rules in companion guides - ediFabric templates can be adjusted to match. Open the element-level definition in the EdiNation spec library.
A freight invoice with stops, lading and charges. Paste it into EdiNation to see every element named and validated.
ISA*00* *00* *16*SENDER1 *1B*RECEIVER1 *071216*1406*U*00204*000000263*1*T*>~ GS*IN*SENDER1*RECEIVER1*20071216*1406*000000001*X*004010*~ ST*210*00000001~ B3**3410889*545930791T*TP*L*20071031*5165**20071029*035*NLMI~ C3*USD~ N9*AE*260451~ N9*OP*3410889~ G62*86*20071031~ R3*EXEM*B**AE***20071031*37905~ N1*SH*SIEMENS VDO S A DE C V - SIEMENS AUTOMOTIVE*94*99999~ N3*PERIFERICO SUR 7999D COMPLEJO IND~ N4*TLAQUEPAQUE*MX*99999*MX~ N1*CN*BRAMPTON ASSEMBLY - COLLINS AND AIKMAN*94*09126B~ N3*500 LAIRD ROAD*GUELPH PRODUCTS~ N4*GUELPH*ON*99999*CA~ N1*BT*BRAMPTON ASSEMBLY - MAIN*94*09126~ N3*2000 WILLIAMS PARKWAY EAST~ N4*BRAMPTON*ON*99999*CA~ N1*CA*NATIONAL LOGISTICS MANAGEMENT*94*45795~ N3*14320 JOY RD.~ N4*DETROIT*MI*48228*US~ N1*ZZ*EXPEDITORS/EMERY WORLDWIDE*94*37905~ N3*10881 LOWELL AVENUE~ N4*OVERLANDPARK*KS*66201*US~ N9*IK*545930791T~ N7**53456*********TL****5300*******53ST~ LX*1~ L5*1**2*Z~ L0*1*1499*FR*1499*G******L~ L1*1*51.65*FR*5165****400~ L3*2619*G***5165~ SE*30*00000001~ GE*1*000000001~ IEA*1*000000263~
ediFabric turns every loop, segment and element into a named field. This is the transaction from the sample, in the JSON that ediFabric Native and Cloud return and accept.
{
"ST": {
"TransactionSetIdentifierCode_01": "210",
"TransactionSetControlNumber_02": "00000001"
},
"B3": {
"InvoiceNumber_02": "3410889",
"ShipmentIdentificationNumber_03": "545930791T",
"ShipmentMethodofPayment_04": "TP",
"WeightUnitCode_05": "L",
"Date_06": "20071031",
"NetAmountDue_07": "5165",
"DeliveryDate_09": "20071029",
"DateTimeQualifier_10": "035",
"StandardCarrierAlphaCode_11": "NLMI"
},
"C3": {
"CurrencyCode_01": "USD"
},
"N9": [
{
"ReferenceIdentificationQualifier_01": "AE",
"ReferenceIdentification_02": "260451"
},
{
"ReferenceIdentificationQualifier_01": "OP",
"ReferenceIdentification_02": "3410889"
}
],
"G62": [
{
"DateQualifier_01": "86",
"Date_02": "20071031"
}
],
"R3": [
{
"StandardCarrierAlphaCode_01": "EXEM",
"RoutingSequenceCode_02": "B",
"TransportationMethodTypeCode_04": "AE",
"Date_07": "20071031",
"Amount_08": "37905"
}
],
"N1Loop": [
{
"N1": {
"EntityIdentifierCode_01": "SH",
"Name_02": "SIEMENS VDO S A DE C V - SIEMENS AUTOMOTIVE",
"IdentificationCodeQualifier_03": "94",
"IdentificationCode_04": "99999"
},
"N3": [
{
"AddressInformation_01": "PERIFERICO SUR 7999D COMPLEJO IND"
}
],
"N4": {
"CityName_01": "TLAQUEPAQUE",
"StateorProvinceCode_02": "MX",
"PostalCode_03": "99999",
"CountryCode_04": "MX"
}
},
{
"N1": {
"EntityIdentifierCode_01": "CN",
"Name_02": "BRAMPTON ASSEMBLY - COLLINS AND AIKMAN",
"IdentificationCodeQualifier_03": "94",
"IdentificationCode_04": "09126B"
},
"N3": [
{
"AddressInformation_01": "500 LAIRD ROAD",
"AddressInformation_02": "GUELPH PRODUCTS"
}
],
"N4": {
"CityName_01": "GUELPH",
"StateorProvinceCode_02": "ON",
"PostalCode_03": "99999",
"CountryCode_04": "CA"
}
},
{
"N1": {
"EntityIdentifierCode_01": "BT",
"Name_02": "BRAMPTON ASSEMBLY - MAIN",
"IdentificationCodeQualifier_03": "94",
"IdentificationCode_04": "09126"
},
"N3": [
{
"AddressInformation_01": "2000 WILLIAMS PARKWAY EAST"
}
],
"N4": {
"CityName_01": "BRAMPTON",
"StateorProvinceCode_02": "ON",
"PostalCode_03": "99999",
"CountryCode_04": "CA"
}
},
{
"N1": {
"EntityIdentifierCode_01": "CA",
"Name_02": "NATIONAL LOGISTICS MANAGEMENT",
"IdentificationCodeQualifier_03": "94",
"IdentificationCode_04": "45795"
},
"N3": [
{
"AddressInformation_01": "14320 JOY RD."
}
],
"N4": {
"CityName_01": "DETROIT",
"StateorProvinceCode_02": "MI",
"PostalCode_03": "48228",
"CountryCode_04": "US"
}
},
{
"N1": {
"EntityIdentifierCode_01": "ZZ",
"Name_02": "EXPEDITORS/EMERY WORLDWIDE",
"IdentificationCodeQualifier_03": "94",
"IdentificationCode_04": "37905"
},
"N3": [
{
"AddressInformation_01": "10881 LOWELL AVENUE"
}
],
"N4": {
"CityName_01": "OVERLANDPARK",
"StateorProvinceCode_02": "KS",
"PostalCode_03": "66201",
"CountryCode_04": "US"
},
"N9": [
{
"ReferenceIdentificationQualifier_01": "IK",
"ReferenceIdentification_02": "545930791T"
}
]
}
],
"N7Loop": [
{
"N7": {
"EquipmentNumber_02": "53456",
"EquipmentDescriptionCode_11": "TL",
"EquipmentLength_15": "5300",
"EquipmentType_22": "53ST"
}
}
],
"LXLoop": [
{
"LX": {
"AssignedNumber_01": "1"
},
"L5": [
{
"LadingLineItemNumber_01": "1",
"CommodityCode_03": "2",
"CommodityCodeQualifier_04": "Z"
}
],
"L0": [
{
"LadingLineItemNumber_01": "1",
"BilledRatedasQuantity_02": "1499",
"BilledRatedasQualifier_03": "FR",
"Weight_04": "1499",
"WeightQualifier_05": "G",
"WeightUnitCode_11": "L"
}
],
"L1": [
{
"LadingLineItemNumber_01": "1",
"FreightRate_02": "51.65",
"RateValueQualifier_03": "FR",
"Charge_04": "5165",
"SpecialChargeorAllowanceCode_08": "400"
}
]
}
],
"L3": {
"Weight_01": "2619",
"WeightQualifier_02": "G",
"Charge_05": "5165"
},
"SE": {
"NumberofIncludedSegments_01": "30",
"TransactionSetControlNumber_02": "00000001"
}
}Read the file into typed objects with ediFabric .NET, convert it to JSON in process with the ediFabric Native bindings for Python, Java and C, or post it to the ediFabric Cloud REST API from any language.
using EdiFabric.Templates.X12004010; License.SetSerial("YOUR_SERIAL_KEY"); using (var stream = File.OpenRead(@"C:\edi\FreightInvoice.txt")) using (var reader = new X12Reader(stream, "EdiFabric.Templates.X12")) { var items = await reader.ReadToEndAsync(); foreach (var transaction in items.OfType<TS210>()) { if (transaction.IsValid(out MessageErrorContext errors)) Console.WriteLine($"{transaction.ST.TransactionSetControlNumber_02} is valid"); else Console.WriteLine(string.Join(Environment.NewLine, errors.Flatten())); } }
import json import edifabric_x12 as ef serial = "YOUR_SERIAL_KEY" ef.load_library() ef.set_serial(serial) ef.set_map(json.dumps({"default": serial, "maps": {}})) edi = open("FreightInvoice.txt", "rb").read() output, offset = ef.parse(edi, ef.ParseMode.JSON_VALIDATE) transactions = output[:offset] report = json.loads(output[offset:]) print(report["errors_count"])
import com.edifabric.nativex12.EdiFabricX12; import com.edifabric.nativex12.ParseMode; import com.edifabric.nativex12.ParseResult; String serial = "YOUR_SERIAL_KEY"; EdiFabricX12.loadLibrary(); EdiFabricX12.setSerial(serial); EdiFabricX12.setMap("{\"default\":\"" + serial + "\",\"maps\":{}}"); String edi = Files.readString(Path.of("FreightInvoice.txt")); ParseResult result = EdiFabricX12.parse(edi, ParseMode.JSON_VALIDATE); System.out.println(result.getTransactions()); System.out.println(result.getReport());
#include "edifabric_x12.h" const char *serial = "YOUR_SERIAL_KEY"; ef_parse_result result; if (ef_load_library(NULL) != 0) return 1; ef_set_serial(serial); ef_set_map("{\"default\":\"YOUR_SERIAL_KEY\",\"maps\":{}}"); char *edi = read_file("FreightInvoice.txt", NULL); /* helper in example_all_functions.c */ if (ef_parse(edi, EF_PARSE_JSON_VALIDATE, NULL, &result) == 0) { /* transactions = output[0 .. offset), report = output[offset .. length) */ fwrite(result.output.data, 1, (size_t)result.output.length, stdout); ef_free(result.output.data); }
curl -X POST 'https://api.edination.com/v2/x12/read' \ -H 'Ocp-Apim-Subscription-Key: YOUR_SERIAL_KEY' \ -H 'Content-Type: application/octet-stream' \ --data-binary '@FreightInvoice.txt'
Populate a TS210 object in .NET, or pass JSON in the shape shown above to ediFabric Native or ediFabric Cloud, and get a valid 210 file back.
using EdiFabric.Templates.X12004010; License.SetSerial("YOUR_SERIAL_KEY"); var transaction = new TS210(); // Transaction Set Identifier Code = “210” // (Motor Carrier Freight Details and Invoice) // Transaction Set Control Number = 00000001 transaction.ST = new ST(); transaction.ST.TransactionSetIdentifierCode_01 = "210"; transaction.ST.TransactionSetControlNumber_02 = "0001"; // ... set the remaining loops and segments the same way // SegmentBuilders is in the Common project of the example repository using (var stream = new MemoryStream()) { using (var writer = new X12Writer(stream)) { writer.Write(SegmentBuilders.BuildIsa("1")); writer.Write(SegmentBuilders.BuildGs("1")); writer.Write(transaction); } Console.WriteLine(Encoding.UTF8.GetString(stream.ToArray())); }
import json import edifabric_x12 as ef serial = "YOUR_SERIAL_KEY" ef.load_library() ef.set_serial(serial) ef.set_map(json.dumps({"default": serial, "maps": {}})) # the transactions JSON returned by ef.parse, edited or produced by your application transactions = open("FreightInvoice.json", "rb").read() edi = ef.build(transactions, postfix="\r\n") print(edi)
import com.edifabric.nativex12.EdiFabricX12; String serial = "YOUR_SERIAL_KEY"; EdiFabricX12.loadLibrary(); EdiFabricX12.setSerial(serial); EdiFabricX12.setMap("{\"default\":\"" + serial + "\",\"maps\":{}}"); // the transactions JSON returned by parse, edited or produced by your application String transactions = Files.readString(Path.of("FreightInvoice.json")); String edi = EdiFabricX12.build(transactions, "\r\n"); System.out.println(edi);
#include "edifabric_x12.h" ef_buffer edi; if (ef_load_library(NULL) != 0) return 1; ef_set_serial("YOUR_SERIAL_KEY"); ef_set_map("{\"default\":\"YOUR_SERIAL_KEY\",\"maps\":{}}"); /* the transactions JSON returned by ef_parse, edited or produced by your application */ char *transactions = read_file("FreightInvoice.json", NULL); if (ef_build(transactions, "\r\n", &edi) == 0) { fwrite(edi.data, 1, (size_t)edi.length, stdout); ef_free(edi.data); }
# the JSON returned by /read, edited or produced by your application curl -X POST 'https://api.edination.com/v2/x12/write' \ -H 'Ocp-Apim-Subscription-Key: YOUR_SERIAL_KEY' \ -H 'Content-Type: application/json' \ --data-binary '@FreightInvoice.json' \ -o 'FreightInvoice.txt'
B3 carries the shipment identification (PRO) number and the bill of lading references, which also appear on the 204 load tender and the 214 status messages.
In additional L1 segments with their own special charge codes, next to the line haul charge.
Usually a 204 load tender, a 990 response to the tender, and 214 shipment status messages.
In .NET, install EdiFabric and EdiFabric.Templates.X12, read the file with X12Reader into TS210 objects and write them back with X12Writer. From Python, Java or C, use ediFabric Native, which converts 210 files to JSON and JSON back to X12 inside your process. From any other language, post the file to the ediFabric Cloud REST API.