X12 210 Motor Carrier Freight Details and Invoice

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.

At a glance

Standard
X12
Version
004010
Functional group
IM (GS01)
Sent by
Motor carrier to shipper or freight payer
Responses
997, 820 (payment)
ediFabric .NET template
TS210 in EdiFabric.Templates.X12
OpenEDI definition
View 210 in the spec library

210 structure

The 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
STTransaction Set HeaderMandatory1
B3Beginning Segment for Carrier's InvoiceMandatory1
C2Bank IDOptional1
C3CurrencyOptional1
ITDTerms of Sale/Deferred Terms of SaleOptional1
N9Reference IdentificationOptional300
G62Date/TimeOptional6
R3Route Information - MotorOptional12
H3Special Handling InstructionsOptional6
K1RemarksOptional10
N1 loopNameOptional10
N1NameMandatory1
N2Additional Name InformationOptional1
N3Address InformationOptional2
N4Geographic LocationOptional1
N9Reference IdentificationOptional5
N7 loopEquipment DetailsOptional10
N7Equipment DetailsMandatory1
M7Seal NumbersOptional2
SPO loopShipment Purchase Order DetailOptional999999
SPOShipment Purchase Order DetailMandatory1
SDQDestination QuantityOptional10
S5 loopStop Off DetailsOptional999
S5Stop Off DetailsMandatory1
N9Reference IdentificationOptional10
G62Date/TimeOptional10
H3Special Handling InstructionsOptional6
SPO loopShipment Purchase Order DetailOptional999999
SPOShipment Purchase Order DetailMandatory1
SDQDestination QuantityOptional10
N1 loopNameOptional2
N1NameMandatory1
N2Additional Name InformationOptional1
N3Address InformationOptional2
N4Geographic LocationOptional1
N9Reference IdentificationOptional5
N7 loopEquipment DetailsOptional10
N7Equipment DetailsMandatory1
M7Seal NumbersOptional2
LX loopAssigned NumberOptional9999
LXAssigned NumberMandatory1
N9Reference IdentificationOptional5
PODProof of DeliveryOptional1
L5Description, Marks and NumbersOptional30
H1Hazardous MaterialOptional3
H2Additional Hazardous Material DescriptionOptional2
L0Line Item - Quantity and WeightOptional10
L1Rate and ChargesOptional10
L4MeasurementOptional10
L7Tariff ReferenceOptional10
K1RemarksOptional10
SPO loopShipment Purchase Order DetailOptional999999
SPOShipment Purchase Order DetailMandatory1
SDQDestination QuantityOptional10
N1 loopNameOptional999999
N1NameMandatory1
N2Additional Name InformationOptional1
N3Address InformationOptional2
N4Geographic LocationOptional1
N9Reference IdentificationOptional10
CD3 loopCarton (Package) DetailOptional999999
CD3Carton (Package) DetailMandatory1
N9Reference IdentificationOptional20
H6Special ServicesOptional10
L9Charge DetailOptional10
PODProof of DeliveryOptional1
G62Date/TimeOptional1
SPO loopShipment Purchase Order DetailOptional999999
SPOShipment Purchase Order DetailMandatory1
SDQDestination QuantityOptional10
L3Total Weight and ChargesOptional1
SETransaction Set TrailerMandatory1

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.

Sample 210 file

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~

The same 210 as JSON

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"
  }
}

Parse and validate a 210 file

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'

Generate a 210 file

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'

210 questions

How is a 210 matched to the shipment?

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.

Where are accessorial charges?

In additional L1 segments with their own special charge codes, next to the line haul charge.

Which transactions come before the 210?

Usually a 204 load tender, a 990 response to the tender, and 214 shipment status messages.

How do I parse and generate X12 210 files in .NET, Python, Java and C?

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.

Related transactions

Parse your first 210 in five minutes

The Community plan is free forever and needs no credit card. It includes ediFabric .NET, Native and Cloud.