The 214 is the X12 transportation carrier shipment status message. Carriers send it to shippers and consignees to report pickup, in-transit events, appointments and delivery.
B10 identifies the shipment, and each LX loop reports an event: AT7 with the status code and date, MS1 with the location and MS2 with the equipment.
004010QM (GS01)TS214 in EdiFabric.Templates.X12The full X12 214 layout from its OpenEDI definition, the same model ediFabric uses to parse, validate and generate it: 12 loops and 54 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 |
B10 | Beginning Segment for Transportation Carrier Shipment Status Message | Mandatory | 1 |
L11 | Business Instructions and Reference Number | Optional | 300 |
MAN | Marks and Numbers | Optional | 9999 |
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 |
G61 | Contact | Optional | 1 |
G62 | Date/Time | Optional | 1 |
L11 | Business Instructions and Reference Number | Optional | 10 |
MS3 | Interline Information | Optional | 12 |
| LX loop | Assigned Number | Optional | 999999 |
LX | Assigned Number | Mandatory | 1 |
| AT7 loop | Shipment Status Details | Optional | 10 |
AT7 | Shipment Status Details | Mandatory | 1 |
MS1 | Equipment, Shipment, or Real Property Location | Optional | 1 |
MS2 | Equipment or Container Owner and Type | Optional | 1 |
L11 | Business Instructions and Reference Number | Optional | 10 |
MAN | Marks and Numbers | Optional | 9999 |
Q7 | Lading Exception Code | Optional | 10 |
K1 | Remarks | Optional | 10 |
AT5 | Bill of Lading Handling Requirements | Optional | 10 |
AT8 | Shipment Weight, Packaging and Quantity Data | Optional | 10 |
| CD3 loop | Carton (Package) Detail | Optional | 999999 |
CD3 | Carton (Package) Detail | Mandatory | 1 |
L11 | Business Instructions and Reference Number | Optional | 20 |
| AT7 loop | Shipment Status Details | Optional | 10 |
AT7 | Shipment Status Details | Mandatory | 1 |
MS1 | Equipment, Shipment, or Real Property Location | Optional | 1 |
MS2 | Equipment or Container Owner and Type | Optional | 1 |
NM1 | Individual or Organizational Name | Optional | 1 |
Q7 | Lading Exception Code | Optional | 10 |
AT8 | Shipment Weight, Packaging and Quantity Data | Optional | 1 |
MAN | Marks and Numbers | Optional | 9999 |
| N1 loop | Name | Optional | 999999 |
N1 | Name | Mandatory | 1 |
N2 | Additional Name Information | Optional | 1 |
N3 | Address Information | Optional | 3 |
N4 | Geographic Location | Optional | 1 |
L11 | Business Instructions and Reference Number | Optional | 10 |
| PRF loop | Purchase Order Reference | Optional | 999999 |
PRF | Purchase Order Reference | Mandatory | 1 |
| N1 loop | Name | Optional | 999999 |
N1 | Name | Mandatory | 1 |
N2 | Additional Name Information | Optional | 1 |
N3 | Address Information | Optional | 3 |
N4 | Geographic Location | Optional | 1 |
L11 | Business Instructions and Reference Number | Optional | 10 |
| CD3 loop | Carton (Package) Detail | Optional | 999999 |
CD3 | Carton (Package) Detail | Mandatory | 1 |
L11 | Business Instructions and Reference Number | Optional | 20 |
| AT7 loop | Shipment Status Details | Optional | 10 |
AT7 | Shipment Status Details | Mandatory | 1 |
MS1 | Equipment, Shipment, or Real Property Location | Optional | 1 |
MS2 | Equipment or Container Owner and Type | Optional | 1 |
MAN | Marks and Numbers | Optional | 9999 |
| SPO loop | Shipment Purchase Order Detail | Optional | 999999 |
SPO | Shipment Purchase Order Detail | Mandatory | 1 |
SDQ | Destination Quantity | Optional | 10 |
| EFI loop | Electronic Format Identification | Optional | >1 |
EFI | Electronic Format Identification | Mandatory | 1 |
BIN | Binary Data | Mandatory | 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 shipment status message with pickup and delivery events. Paste it into EdiNation to see every element named and validated.
ISA*00* *00* *16*SENDER1 *14*RECEIVER1 *071216*1406*U*00204*000000263*1*T*>~ GS*IN*SENDER1*RECEIVER1*20071216*1406*000000001*X*004010~ ST*214*0006~ B10*123456**BAWC**RU*ROUTE1~ L11*55555555*EQ~ N1*SF**92*23083C~ N4*DECORAH*IA**US~ N1*ST**92*00073~ N4*SUMMIT*IL**US~ MS3*BAWC*B**GG~ LX*1~ AT7*X3*NS***19970925*0830*CT~ MS1****0914726*0431836*W*N~ SE*12*0006~ GE*2*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": "214",
"TransactionSetControlNumber_02": "0006"
},
"B10": {
"ReferenceIdentification_01": "123456",
"StandardCarrierAlphaCode_03": "BAWC",
"ReferenceIdentificationQualifier_05": "RU",
"ReferenceIdentification_06": "ROUTE1"
},
"L11": [
{
"ReferenceIdentification_01": "55555555",
"ReferenceIdentificationQualifier_02": "EQ"
}
],
"N1Loop": [
{
"N1": {
"EntityIdentifierCode_01": "SF",
"IdentificationCodeQualifier_03": "92",
"IdentificationCode_04": "23083C"
},
"N4": {
"CityName_01": "DECORAH",
"StateorProvinceCode_02": "IA",
"CountryCode_04": "US"
}
},
{
"N1": {
"EntityIdentifierCode_01": "ST",
"IdentificationCodeQualifier_03": "92",
"IdentificationCode_04": "00073"
},
"N4": {
"CityName_01": "SUMMIT",
"StateorProvinceCode_02": "IL",
"CountryCode_04": "US"
}
}
],
"MS3": [
{
"StandardCarrierAlphaCode_01": "BAWC",
"RoutingSequenceCode_02": "B",
"TransportationMethodTypeCode_04": "GG"
}
],
"LXLoop": [
{
"LX": {
"AssignedNumber_01": "1"
},
"AT7Loop": [
{
"AT7": {
"ShipmentStatusCode_01": "X3",
"ShipmentStatusorAppointmentReasonCode_02": "NS",
"Date_05": "19970925",
"Time_06": "0830",
"TimeCode_07": "CT"
},
"MS1": {
"LongitudeCode_04": "0914726",
"LatitudeCode_05": "0431836",
"DirectionIdentifierCode_06": "W",
"DirectionIdentifierCode_07": "N"
}
}
]
}
],
"SE": {
"NumberofIncludedSegments_01": "12",
"TransactionSetControlNumber_02": "0006"
}
}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\ShipmentStatus.txt")) using (var reader = new X12Reader(stream, "EdiFabric.Templates.X12")) { var items = await reader.ReadToEndAsync(); foreach (var transaction in items.OfType<TS214>()) { 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("ShipmentStatus.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("ShipmentStatus.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("ShipmentStatus.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 '@ShipmentStatus.txt'
Populate a TS214 object in .NET, or pass JSON in the shape shown above to ediFabric Native or ediFabric Cloud, and get a valid 214 file back.
using EdiFabric.Templates.X12004010; License.SetSerial("YOUR_SERIAL_KEY"); var transaction = new TS214(); // Start Transaction Set 214 // Control number = 0006 transaction.ST = new ST(); transaction.ST.TransactionSetIdentifierCode_01 = "214"; transaction.ST.TransactionSetControlNumber_02 = "0001"; // Reference Number = 123456 // Carrier SCAC = BAWC // Route Code = ROUTE1 transaction.B10 = new B10(); transaction.B10.ReferenceIdentification_01 = "123456"; transaction.B10.StandardCarrierAlphaCode_03 = "BAWC"; transaction.B10.ReferenceIdentificationQualifier_05 = "RU"; transaction.B10.ReferenceIdentification_06 = "ROUTE1"; // Repeating L11 transaction.L11 = new List<L11>(); // ... 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("ShipmentStatus.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("ShipmentStatus.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("ShipmentStatus.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 '@ShipmentStatus.json' \ -o 'ShipmentStatus.txt'
X3 arrived at pickup location, AF departed pickup location, X1 arrived at delivery location, D1 completed unloading at delivery location, and AG estimated delivery.
Per event, as agreed with the shipper. Some carriers also send periodic in-transit location updates.
IFTSTA, the international multimodal status report.
In .NET, install EdiFabric and EdiFabric.Templates.X12, read the file with X12Reader into TS214 objects and write them back with X12Writer. From Python, Java or C, use ediFabric Native, which converts 214 files to JSON and JSON back to X12 inside your process. From any other language, post the file to the ediFabric Cloud REST API.