EDI X12 Parser
Parse EDI X12 documents
EDI X12 is the North American standard for electronic business document exchange — purchase orders, invoices, and payment remittances.
What is EDI X12?
EDI X12 (Electronic Data Interchange, ANSI ASC X12) is the predominant standard for electronic business document exchange in North America. Developed by the Accredited Standards Committee X12 (originally chartered by ANSI in 1979), it defines standardized formats for common business documents such as purchase orders (850), invoices (810), payment remittances (820), advance ship notices (856), and hundreds more.
EDI replaces paper-based business processes with structured electronic messages that can be processed automatically by computer systems. Instead of mailing a paper purchase order that must be manually keyed into the supplier’s system, a buyer’s ERP system generates an EDI 850 that the supplier’s system can ingest directly — eliminating data entry errors, reducing processing time from days to minutes, and cutting costs significantly.
Despite the rise of APIs and XML-based alternatives, EDI X12 remains deeply entrenched in supply chain, healthcare, transportation, and financial services. Major retailers (Walmart, Amazon, Target), healthcare payers, and logistics companies require their trading partners to communicate via EDI.
Message Structure
Every EDI X12 interchange uses a three-layer envelope structure — like nested boxes — that provides routing, grouping, and transaction-level organization.
ISA/IEA (Interchange Control) is the outermost envelope. It identifies the sender and receiver, sets the delimiters, and wraps one or more functional groups. The ISA segment is always exactly 106 characters.
GS/GE (Functional Group) groups related transaction sets. A single interchange can contain multiple functional groups (e.g., one group of invoices and one group of purchase orders). The GS identifies the functional type (IN = Invoice, PO = Purchase Order).
ST/SE (Transaction Set) contains the actual business document. The ST segment identifies the transaction set type (810 for invoice, 850 for purchase order) and assigns a control number. The SE segment counts the segments and closes the transaction.
Common Transaction Sets
| Set | Name | Direction | Description |
|---|---|---|---|
| 810 | Invoice | Seller to Buyer | Billing for goods or services delivered |
| 850 | Purchase Order | Buyer to Seller | Request to buy specific items at agreed prices |
| 820 | Payment Order/Remittance Advice | Payer to Payee | Payment instructions with invoice references |
| 856 | Advance Ship Notice (ASN) | Seller to Buyer | Notification of shipment with packing details |
| 997 | Functional Acknowledgment | Receiver to Sender | Confirms receipt and syntactic correctness |
| 834 | Benefit Enrollment | Employer to Payer | Healthcare enrollment and changes |
| 835 | Healthcare Claim Payment | Payer to Provider | Explanation of benefits and payment details |
| 837 | Healthcare Claim | Provider to Payer | Medical claim submission |
EDI vs Modern Alternatives
| Feature | EDI X12 | XML/JSON API |
|---|---|---|
| Format | Fixed positional + delimited | Hierarchical markup/object |
| Human-readable | Difficult | Easy |
| Schema validation | Implementation guides | XSD / JSON Schema |
| Transport | VAN, AS2, SFTP | HTTPS REST/SOAP |
| Adoption | Universal in supply chain | Growing, not universal |
| Real-time | Typically batch | Real-time capable |
| Cost | VAN fees per KB | API hosting costs |
Common Use Cases
- Supply chain management: Purchase orders (850), invoices (810), and ASNs (856) automate the procure-to-pay cycle between retailers and suppliers
- Healthcare claims: 837 (claim submission), 835 (remittance), and 834 (enrollment) are mandated by HIPAA for US healthcare transactions
- Payment processing: 820 (payment order) and 823 (lockbox) automate B2B payment instructions and cash application
- Transportation: 204 (load tender), 214 (shipment status), and 210 (freight invoice) coordinate logistics between shippers and carriers
- Retail compliance: Major retailers require EDI for all vendor transactions — non-compliance results in chargebacks and penalties
- Financial reporting: 822 (customer account analysis) and 821 (financial information reporting) support treasury operations
Try These Examples
A valid EDI X12 810 (Invoice) wrapped in the standard three-layer envelope: ISA/IEA (interchange), GS/GE (functional group), ST/SE (transaction set). The invoice references PO-2024-500, ships to ACME CORPORATION, contains two line items (100 widgets at $25.00, 50 gadgets at $42.50), and totals $4,625.00 (TDS segment in cents).
ISA*00* *00* *ZZ*SENDERID *ZZ*RECEIVERID *240315*1200*U*00401*000000001*0*P*>~
GS*IN*SENDERID*RECEIVERID*20240315*1200*1*X*004010~
ST*810*0001~
BIG*20240315*INV-2024-001*20240310*PO-2024-500~
N1*ST*ACME CORPORATION*92*SHIP001~
IT1*1*100*EA*25.00**VP*WIDGET-A~
IT1*2*50*EA*42.50**VP*GADGET-B~
TDS*462500~
SE*8*0001~
GE*1*1~
IEA*1*000000001~ This EDI interchange is missing the GE (Functional Group Trailer) segment between the SE and IEA segments. The GE segment is mandatory and must contain the number of transaction sets in the group and the group control number matching the GS header. Without it, the receiving system cannot validate group integrity.
ISA*00* *00* *ZZ*SENDERID *ZZ*RECEIVERID *240315*1200*U*00401*000000002*0*P*>~
GS*IN*SENDERID*RECEIVERID*20240315*1200*2*X*004010~
ST*810*0001~
BIG*20240315*INV-2024-002~
TDS*100000~
SE*4*0001~
IEA*1*000000002~