X12 824 Application Advice Last updated: 2026-09-29
The 824 is the X12 application advice. It reports the result of processing a previously received transaction in the receiver's application - for example an invoice rejected because a price does not match the order.
Each OTI loop identifies the original transaction and says whether it was accepted, accepted with errors, or rejected; TED segments describe each error.
At a glance
- Standard
- X12
- Version
004010- Functional group
AG(GS01)- Sent by
- Receiver of any transaction back to its sender
- Responses
- 997
- ediFabric .NET template
TS824inEdiFabric.Templates.X12- OpenEDI definition
- View 824 in the spec library
824 structure
The full X12 824 layout from its OpenEDI definition, the same model ediFabric uses to parse, validate and generate it: 5 loops and 22 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 |
BGN | Beginning Segment | Mandatory | 1 |
| N1 loop | Name | Optional | >1 |
N1 | Name | Mandatory | 1 |
N2 | Additional Name Information | Optional | 2 |
N3 | Address Information | Optional | 2 |
N4 | Geographic Location | Optional | 1 |
REF | Reference Identification | Optional | 12 |
PER | Administrative Communications Contact | Optional | 3 |
| OTI loop | Original Transaction Identification | Mandatory | >1 |
OTI | Original Transaction Identification | Mandatory | 1 |
REF | Reference Identification | Optional | 12 |
DTM | Date/Time Reference | Optional | 2 |
PER | Administrative Communications Contact | Optional | 3 |
AMT | Monetary Amount | Optional | >1 |
QTY | Quantity | Optional | >1 |
NM1 | Individual or Organizational Name | Optional | 9 |
| TED loop | Technical Error Description | Optional | >1 |
TED | Technical Error Description | Mandatory | 1 |
NTE | Note/Special Instruction | Optional | 100 |
RED | Related Data | Optional | 100 |
| LM loop | Code Source Information | Optional | >1 |
LM | Code Source Information | Mandatory | 1 |
| LQ loop | Industry Code | Mandatory | 100 |
LQ | Industry Code | Mandatory | 1 |
RED | Related Data | Optional | 100 |
SE | Transaction Set Trailer | Mandatory | 1 |
Sample 824 file
An application advice that reports errors in a received transaction. 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*824*0002~ BGN*11*3*120902*1621~ N1*SU**92*42332AB~ N1*SF**92*42332A~ N1*ST**92*04025~ N1*MA**92*04025~ N1*CS**92*01123~ OTI*IR*SI*62001*******856~ REF*BM*62001~ REF*PK*87115~ REF*CN*506013~ REF*TB*01178~ REF*PM*05440113AA~ DTM*009*120901*1621*ET~ DTM*011*120901~ TED*201*ASN-PART/PLANT/SUPLR*****05440113AA0622137052~ NTE*LIN*INVALID PART/PLANT SUPPLIER COMBINATIO~ SE*18*0002~ GE*2*000000001~ IEA*1*000000263~
The same 824 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": "824",
"TransactionSetControlNumber_02": "0002"
},
"BGN": {
"TransactionSetPurposeCode_01": "11",
"ReferenceIdentification_02": "3",
"Date_03": "120902",
"Time_04": "1621"
},
"N1Loop": [
{
"N1": {
"EntityIdentifierCode_01": "SU",
"IdentificationCodeQualifier_03": "92",
"IdentificationCode_04": "42332AB"
}
},
{
"N1": {
"EntityIdentifierCode_01": "SF",
"IdentificationCodeQualifier_03": "92",
"IdentificationCode_04": "42332A"
}
},
{
"N1": {
"EntityIdentifierCode_01": "ST",
"IdentificationCodeQualifier_03": "92",
"IdentificationCode_04": "04025"
}
},
{
"N1": {
"EntityIdentifierCode_01": "MA",
"IdentificationCodeQualifier_03": "92",
"IdentificationCode_04": "04025"
}
},
{
"N1": {
"EntityIdentifierCode_01": "CS",
"IdentificationCodeQualifier_03": "92",
"IdentificationCode_04": "01123"
}
}
],
"OTILoop": [
{
"OTI": {
"ApplicationAcknowledgmentCode_01": "IR",
"ReferenceIdentificationQualifier_02": "SI",
"ReferenceIdentification_03": "62001",
"TransactionSetIdentifierCode_10": "856"
},
"REF": [
{
"ReferenceIdentificationQualifier_01": "BM",
"ReferenceIdentification_02": "62001"
},
{
"ReferenceIdentificationQualifier_01": "PK",
"ReferenceIdentification_02": "87115"
},
{
"ReferenceIdentificationQualifier_01": "CN",
"ReferenceIdentification_02": "506013"
},
{
"ReferenceIdentificationQualifier_01": "TB",
"ReferenceIdentification_02": "01178"
},
{
"ReferenceIdentificationQualifier_01": "PM",
"ReferenceIdentification_02": "05440113AA"
}
],
"DTM": [
{
"DateTimeQualifier_01": "009",
"Date_02": "120901",
"Time_03": "1621",
"TimeCode_04": "ET"
},
{
"DateTimeQualifier_01": "011",
"Date_02": "120901"
}
],
"TEDLoop": [
{
"TED": {
"ApplicationErrorConditionCode_01": "201",
"FreeFormMessage_02": "ASN-PART/PLANT/SUPLR",
"CopyofBadDataElement_07": "05440113AA0622137052"
},
"NTE": [
{
"NoteReferenceCode_01": "LIN",
"Description_02": "INVALID PART/PLANT SUPPLIER COMBINATIO"
}
]
}
]
}
],
"SE": {
"NumberofIncludedSegments_01": "18",
"TransactionSetControlNumber_02": "0002"
}
}Parse and validate an 824 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\ApplicationAdvice.txt")) using (var reader = new X12Reader(stream, "EdiFabric.Templates.X12")) { var items = await reader.ReadToEndAsync(); foreach (var transaction in items.OfType<TS824>()) { 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("ApplicationAdvice.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("ApplicationAdvice.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("ApplicationAdvice.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 '@ApplicationAdvice.txt'
Generate an 824 file
Populate a TS824 object in .NET, or pass JSON in the shape shown above to ediFabric Native or ediFabric Cloud, and get a valid 824 file back.
using EdiFabric.Templates.X12004010; License.SetSerial("YOUR_SERIAL_KEY"); var transaction = new TS824(); // Transaction Set Identifier Code // = “824” (Application Acknowlegment Advice) // Transaction Set Control Number = 0002 transaction.ST = new ST(); transaction.ST.TransactionSetIdentifierCode_01 = "824"; transaction.ST.TransactionSetControlNumber_02 = "0001"; // Transaction Set Purpose Code // = “11” (Response) // Reference Number = 3 // Date = 09 / 02 / 2012 // Time = 4:21 PM transaction.BGN = new BGN(); transaction.BGN.TransactionSetPurposeCode_01 = "11"; transaction.BGN.ReferenceIdentification_02 = "3"; transaction.BGN.Date_03 = "120902"; transaction.BGN.Time_04 = "1621"; // Repeating N1 Loops transaction.N1Loop = new List<Loop_N1_824>(); // ... 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("ApplicationAdvice.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("ApplicationAdvice.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("ApplicationAdvice.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 '@ApplicationAdvice.json' \ -o 'ApplicationAdvice.txt'
Complete ediFabric .NET example
A complete C# program for the X12 824, built on TS824 in EdiFabric.Templates.X12. The same code is in the ediFabric .NET examples on GitHub.
using EdiFabric.Core.Model.Edi;
using EdiFabric.Core.Model.Edi.X12;
using EdiFabric.Examples.X12.Common;
using EdiFabric.Framework.Readers;
using EdiFabric.Framework.Writers;
using EdiFabric.Templates.X12004010;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace EdiFabric.Examples.X12.T824
{
class Program
{
static void Main(string[] args)
{
SerialKey.Set(Common.SerialKey.Get());
Read();
Write();
}
///
/// Read Application Advice
///
static void Read()
{
var ediStream = File.OpenRead(Directory.GetCurrentDirectory() + @"\..\..\..\Files\X12\ApplicationAdvice.txt");
List ediItems;
using (var ediReader = new X12Reader(ediStream, "EdiFabric.Templates.X12"))
ediItems = ediReader.ReadToEnd().ToList();
var transactions = ediItems.OfType();
foreach (var transaction in transactions)
{
if (transaction.HasErrors)
{
// partially parsed
var errors = transaction.ErrorContext.Flatten();
}
}
}
///
/// Write Application Advice
///
static void Write()
{
var transaction = BuildApplicationAdvice("2");
using (var stream = new MemoryStream())
{
using (var writer = new X12Writer(stream))
{
writer.Write(SegmentBuilders.BuildIsa("1"));
writer.Write(SegmentBuilders.BuildGs("1"));
writer.Write(transaction);
}
var ediString = stream.LoadToString();
}
}
///
/// Builds Application Advice.
/// Original from https://ps.nafta.extra.fcagroup.com/sites/itb-ebus/Shared%20Documents/824FreightConsolidatorApplicationAdvice.pdf
///
static TS824 BuildApplicationAdvice(string controlNumber)
{
var result = new TS824();
// Transaction Set Identifier Code
// = “824” (Application Acknowlegment Advice)
// Transaction Set Control Number = 0002
result.ST = new ST();
result.ST.TransactionSetIdentifierCode_01 = "824";
result.ST.TransactionSetControlNumber_02 = controlNumber.PadLeft(9, '0');
// Transaction Set Purpose Code
// = “11” (Response)
// Reference Number = 3
// Date = 09 / 02 / 2012
// Time = 4:21 PM
result.BGN = new BGN();
result.BGN.TransactionSetPurposeCode_01 = "11";
result.BGN.ReferenceIdentification_02 = "3";
result.BGN.Date_03 = "120902";
result.BGN.Time_04 = "1621";
// Repeating N1 Loops
result.N1Loop = new List();
// Begin N1 Loop 1
var n1Loop1 = new Loop_N1_824();
// Entity Identifier Code
// = “SU” (Supplier / Manufacturer)
// Identification Code Qualifier
// = “92” (Assigned by Buyer)
// Identification Code = 42332AB
n1Loop1.N1 = new N1();
n1Loop1.N1.EntityIdentifierCode_01 = "SU";
n1Loop1.N1.IdentificationCodeQualifier_03 = "92";
n1Loop1.N1.IdentificationCode_04 = "42332AB";
// End N1 Loop 1
result.N1Loop.Add(n1Loop1);
// Begin N1 Loop 2
var n1Loop2 = new Loop_N1_824();
// Entity Identifier Code = “SF” (Ship From)
// Identification Code Qualifier
// = “92” (Assigned by Buyer)
// Identification Code = 42332AF
n1Loop2.N1 = new N1();
n1Loop2.N1.EntityIdentifierCode_01 = "SF";
n1Loop2.N1.IdentificationCodeQualifier_03 = "92";
n1Loop2.N1.IdentificationCode_04 = "42332A";
// End N1 Loop 2
result.N1Loop.Add(n1Loop2);
// Begin N1 Loop 3
var n1Loop3 = new Loop_N1_824();
// Entity Identifier Code = “ST” (Ship To)
// Identification Code Qualifier
// = “92” (Assigned by Buyer)
// Identification Code = 04025
n1Loop3.N1 = new N1();
n1Loop3.N1.EntityIdentifierCode_01 = "ST";
n1Loop3.N1.IdentificationCodeQualifier_03 = "92";
n1Loop3.N1.IdentificationCode_04 = "04025";
// End N1 Loop 3
result.N1Loop.Add(n1Loop3);
// Begin N1 Loop 4
var n1Loop4 = new Loop_N1_824();
// Entity Identifier Code = “MA”
// (Party for whom Item is Ultimately Intended)
// Identification Code Qualifier
// = “92” (Assigned by Buyer)
// Identification Code = 04025
n1Loop4.N1 = new N1();
n1Loop4.N1.EntityIdentifierCode_01 = "MA";
n1Loop4.N1.IdentificationCodeQualifier_03 = "92";
n1Loop4.N1.IdentificationCode_04 = "04025";
// End N1 Loop 4
result.N1Loop.Add(n1Loop4);
// Begin N1 Loop 5
var n1Loop5 = new Loop_N1_824();
// Entity Identifier Code = “CS” (Consolidator)
// Identification Code Qualifier
// = “92” (Assigned by Buyer)
// Identification Code = 01123
n1Loop5.N1 = new N1();
n1Loop5.N1.EntityIdentifierCode_01 = "CS";
n1Loop5.N1.IdentificationCodeQualifier_03 = "92";
n1Loop5.N1.IdentificationCode_04 = "01123";
// End N1 Loop 5
result.N1Loop.Add(n1Loop5);
// Repeating OTI Loops
result.OTILoop = new List();
// Begin OTI Loop
var otiLoop1 = new Loop_OTI_824();
// Application Acknowledgment Code
// = “IR” (Line item rejected)
// Reference Number Qualifier = “SI” (Shipper's
// Identifying Number for Shipment)
// Reference Number = 62001
// Transaction Set Identifier Code
// = “856” (X12.10 Ship Notice/ Manifest)
otiLoop1.OTI = new OTI();
otiLoop1.OTI.ApplicationAcknowledgmentCode_01 = "IR";
otiLoop1.OTI.ReferenceIdentificationQualifier_02 = "SI";
otiLoop1.OTI.ReferenceIdentification_03 = "62001";
otiLoop1.OTI.TransactionSetIdentifierCode_10 = "856";
// Repeating REF
otiLoop1.REF = new List();
// Reference Number Qualifier
// = “BM” (Bill of Lading Number)
// Reference Number = 62001
var ref1 = new REF();
ref1.ReferenceIdentificationQualifier_01 = "BM";
ref1.ReferenceIdentification_02 = "62001";
otiLoop1.REF.Add(ref1);
// Reference Number Qualifier
// = “PK” (Packing List Number)
// Reference Number = 87115
var ref2 = new REF();
ref2.ReferenceIdentificationQualifier_01 = "PK";
ref2.ReferenceIdentification_02 = "87115";
otiLoop1.REF.Add(ref2);
// Reference Number Qualifier = “CN”
// (Carrier's Reference Number <PRO/Invoice>)
// Reference Number = 506013
var ref3 = new REF();
ref3.ReferenceIdentificationQualifier_01 = "CN";
ref3.ReferenceIdentification_02 = "506013";
otiLoop1.REF.Add(ref3);
// Reference Number Qualifier
// = “TB” (Trucker's Bill of Lading)
// Reference Number = 01178
var ref4 = new REF();
ref4.ReferenceIdentificationQualifier_01 = "TB";
ref4.ReferenceIdentification_02 = "01178";
otiLoop1.REF.Add(ref4);
// Reference Number Qualifier
// = “PM” (Part Number)
// Reference Number = 05440113AA
var ref5 = new REF();
ref5.ReferenceIdentificationQualifier_01 = "PM";
ref5.ReferenceIdentification_02 = "05440113AA";
otiLoop1.REF.Add(ref5);
// Repeating DTM
otiLoop1.DTM = new List();
// Date/Time Qualifier = “009” (Process)
// Date = 09 / 01 / 2012
// Time = 4:21 PM
// Time Code = “ET” (Eastern Time)
var dtm1 = new DTM();
dtm1.DateTimeQualifier_01 = "009";
dtm1.Date_02 = "120901";
dtm1.Time_03 = "1621";
dtm1.TimeCode_04 = "ET";
otiLoop1.DTM.Add(dtm1);
// Date/Time Qualifier = “011” (Shipped)
// Date = 09 / 01 / 2012
var dtm2 = new DTM();
dtm2.DateTimeQualifier_01 = "011";
dtm2.Date_02 = "120901";
otiLoop1.DTM.Add(dtm2);
// Repeating TED Loops
otiLoop1.TEDLoop = new List();
// Begin TED Loop
var tedLoop1 = new Loop_TED_824();
// Application Error Condition = 201
// Free Form Message
// = ASN - PART / PLANT / SUPLR
// Copy of Bad Data Element
// = 05440113AA0622137052
tedLoop1.TED = new TED();
tedLoop1.TED.ApplicationErrorConditionCode_01 = "201";
tedLoop1.TED.FreeFormMessage_02 = "ASN-PART/PLANT/SUPLR";
tedLoop1.TED.CopyofBadDataElement_07 = "05440113AA0622137052";
// Repeating NTE
tedLoop1.NTE = new List();
// Note Reference Code = “LIN” (Line Item)
// Free Form Message = INVALID PART / PLANT
// SUPPLIER COMBINATIO
var nte1 = new NTE();
nte1.NoteReferenceCode_01 = "LIN";
nte1.Description_02 = "INVALID PART/PLANT SUPPLIER COMBINATIO";
tedLoop1.NTE.Add(nte1);
// End TED Loop
otiLoop1.TEDLoop.Add(tedLoop1);
// End OTI Loop
result.OTILoop.Add(otiLoop1);
return result;
}
}
}More operations in ediFabric .NET
824 questions
How is the 824 different from the 997?
The 997 reports syntax errors found when the file is received. The 824 reports business or application errors found when the data is processed.
What do the OTI01 codes mean?
TA transaction set accept, TE accept with error, TR reject. OTI02 and OTI03 point to the original document, such as an invoice number.
Which transactions can an 824 respond to?
Any of them. It is most common for 810 invoices, 856 ship notices and 820 payment orders.
How do I parse and generate X12 824 files in .NET, Python, Java and C?
In .NET, install EdiFabric and EdiFabric.Templates.X12, read the file with X12Reader into TS824 objects and write them back with X12Writer. From Python, Java or C, use ediFabric Native, which converts 824 files to JSON and JSON back to X12 inside your process. From any other language, post the file to the ediFabric Cloud REST API.
Resources
Parse your first X12 824 in five minutes
The Community plan is free forever and needs no credit card. It includes ediFabric .NET, Native and Cloud with one serial key.
Sign up free Validate EDI files free