A free EDI course, from your first segment to your first partner
Twenty-one modules on X12, EDIFACT, the documents trading partners exchange, and how EDI connects to ERPs, warehouse and transportation systems, APIs and invoicing tools, with examples from five industries. Free, with no quizzes. Sign in to save your progress.
Learn to read, build and troubleshoot EDI
Electronic Data Interchange moves orders, ship notices, invoices, freight tenders and healthcare claims between companies as structured text. This course starts at the first segment and ends with you diagnosing a rejected file and onboarding a new trading partner.
How the course works
- Read in order, or jump to what you need. The four Foundations modules are the base for everything else. After those, each module stands on its own and links back to the ideas it uses.
- Every document is shown as a real file. The examples follow one set of fictional companies, so the order you read in Orders is the one shipped in Ship notices, billed in Invoices and trucked in Transportation.
- No quizzes. Mark a module done when you've read it. Open any example in the Segment Explorer to click through it element by element.
- Pick your industry. The industry pages below explain what EDI means for your kind of business and link to the modules that matter most.
- Then connect it to your systems. The Integrations and tools modules cover ERPs, warehouse and transportation systems, APIs, JSON, XML and flat files, translators and invoicing tools.
The files in this course are illustrative. They follow common practice, but every trading partner publishes its own implementation guide and those guides differ: which segments are required, which qualifiers and codes are accepted, even how long a field may be. Treat each example as a pattern to recognize, never as a template to copy into production. Implementation guides and partner rules explains how to read a partner's guide.
EDI in your industry
You sell to retailers or distributors: orders, ASNs, invoices, inventory feeds and chargebacks.
Warehousing and 3PLYou store and ship goods for their owners: shipping orders, receipts and inventory adjustments.
Transportation and logisticsYou carry or broker freight: load tenders, status updates and freight invoices.
ManufacturingYou build to forecasts and schedules: planning schedules, ship notices and self-billing.
HealthcareYou bill, pay or check coverage: claims, remittances, eligibility and enrollment under HIPAA.
Course outline
Tools that go with the course
Every document in the course, plus three broken files to practise on. Paste your own file too.
REFGlossaryShort definitions, each linked to the module that explains it.
EXAMFinal exam, open notesOptional and paid: an exam with a certificate, taken with the course open beside you.
What EDI is and who uses it
EDI replaces paper, fax and email documents between companies with structured messages that each side's systems can read without anyone re-typing them.
The problem EDI solves
Picture a retailer ordering shelf brackets from a supplier without EDI. The retailer's buyer creates a purchase order in their system and emails a PDF. A clerk at the supplier types it into the supplier's order system, possibly mistyping a quantity. When the goods ship, someone emails a packing list. When the invoice goes out, the retailer's accounts payable team types it into their system and compares it, by eye, with the order and the receipt.
Every hand-off adds a day and a chance of error. At ten orders a week that's tolerable. At ten thousand it isn't. EDI lets the retailer's system send the order as data that the supplier's system loads directly, and the supplier's system send back confirmations, ship notices and invoices the same way.
The word that matters is interchange. Both companies agree beforehand on a standard (usually X12 or EDIFACT), a version, and exactly which fields they'll use. That agreement is what makes the data reliable enough to process without a person checking it.
A first look at an EDI document
This is part of a purchase order from Acme Distribution to its supplier, North Supply Co. You'll learn to read
every character of it in the next module. For now, notice that it's plain text, one line per idea, with
* between fields and ~ at the end of each line.
ST*850*0001~ BEG*00*SA*PO-48213**20261026~ REF*DP*038~ DTM*002*20261109~ N1*ST*Acme Distribution Center*92*DC14~ N3*4100 Industrial Pkwy~ N4*Joliet*IL*60431*US~ PO1*1*24*CA*18.50*PE*UP*012345678905*VN*NS-1180~ PID*F****Shelf bracket, galvanized, 12 in~ PO1*2*10*EA*42.00*PE*UP*012345678912*VN*NS-2210~ PID*F****Wall-mount rail, 48 in~ CTT*2*34~ SE*13*0001~
| Line | In plain English |
|---|---|
| ST*850*0001 | A purchase order (850) starts here; it's document 0001 in this batch. |
| BEG*00*SA*PO-48213**20261026 | A new (00), stand-alone (SA) order, number PO-48213, dated 26 October 2026. |
| REF*DP*038 | For department (DP) 038. |
| DTM*002*20261109 | Please deliver (002) on 9 November 2026. |
| N1 / N3 / N4 | Ship to (ST) Acme Distribution Center, which the buyer calls DC14, at 4100 Industrial Pkwy, Joliet IL. |
| PO1*1*24*CA*18.50… | Line 1: 24 cases at 18.50 each of UPC 012345678905, which the vendor calls NS-1180. |
| PID*F****… | Its description, in free text (F). |
| CTT*2*34 | Two lines, 34 units in total: a check that nothing was lost. |
| SE*13*0001 | The order ends here; it had 13 lines counting ST and SE, and it was document 0001. |
The moving parts
Any company you exchange EDI with: a customer, supplier, carrier, warehouse, bank, insurer or clearinghouse.
The shared grammar. ANSI X12 in North America, UN/EDIFACT in Europe and international trade. See X12 vs EDIFACT vs APIs.
Each partner's rulebook: which documents, segments, codes and values it requires. See Implementation guides.
Software that checks incoming files against the standard and converts between EDI and your own formats.
Field-by-field rules the translator follows, such as "BEG03 goes into the customer PO number". See Mapping.
How files travel: AS2, SFTP, a VAN mailbox, OFTP2. See Moving the files.
A receipt that says a file arrived and could be read: the 997 or 999. See Acknowledgments.
Your ERP, warehouse, transport or billing system: where the data actually comes from and goes to.
A document's trip, end to end: your ERP creates an order → the translator maps it to an X12 850 and wraps it in envelopes → the transport sends it → the partner's translator checks it, returns a 997, and maps it into their system → their system answers with its own documents, which come back the same way.
Who uses EDI, and for what
| Industry | Typical partners | Documents you'll meet |
|---|---|---|
| Retail and distribution | Retailers, wholesalers, distributors, drop-ship vendors | 850, 855, 856, 810, 846, 852, 820, 812 |
| Warehousing and 3PL | Brands and distributors that store goods with a warehouse | 940, 945, 943, 944, 947, 846 |
| Transportation | Shippers, carriers, brokers | 204, 990, 214, 210 |
| Manufacturing | Automotive and industrial customers and suppliers | 830, 862, 856, 810, 820 |
| Healthcare | Providers, payers, clearinghouses, employers | 837, 835, 270, 271, 276, 277, 278, 834 |
| Finance | Banks and their corporate customers | 820, 823, 824 (and ISO 20022 outside EDI) |
Each of those has a module. The industry pages explain what EDI means for each kind of business.
Why companies still require it
- Scale. A large retailer receives tens of thousands of invoices a day. Only structured data can be checked and posted automatically.
- It's a condition of doing business. Many retailers, carriers and manufacturers won't add a supplier who can't send an ASN and an invoice by EDI, and they charge penalties (chargebacks) when the documents are late or wrong.
- Law. In the US, HIPAA requires specific X12 transactions for healthcare claims, payments, eligibility checks and enrollment.
- Audit trail. Control numbers and acknowledgments prove what was sent, when, and whether it was received and read.
- It works. The documents and their meaning have been agreed across whole industries for decades. A new partner who uses the 856 already knows what an 856 is.
What EDI is not
- Not a PDF or a spreadsheet attached to an email. Those need a person to read them. EDI is data a system can load.
- Not one fixed file layout. It's a standard plus a partner-specific agreement. Two retailers can both "use the 850" and still require different segments.
- Not an API. An API is a way for two systems to call each other directly, usually with JSON. EDI is a document standard that is exchanged as files. Many companies use both, side by side; X12 vs EDIFACT vs APIs explains how they differ and how they meet.
When someone says "we do EDI", ask three questions: which standard and version, which documents, and how the files travel. The answers tell you almost everything about the work involved.
Reading an X12 file
Every X12 document, from a purchase order to a hospital claim, is built from the same few ideas: segments, elements, delimiters, loops and qualifiers. Learn them once and you can read any transaction set.
Segments and elements
A segment is one line of meaning: a line item, an address, a date. It starts with a 2- or 3-character
segment ID and is followed by data elements, the individual fields. Elements are referred to by
segment ID plus a two-digit position: PO102 is the second element of the PO1 segment.
Positions never move. If the sender has nothing for an element, it still writes the separator so the following
elements keep their numbers. That's why you often see **: an empty element between two separators. At
the end of a segment, empty elements are simply left off.
PO1*1*24*CA*18.50**UP*012345678905~
N1*ST*Acme Distribution Center~
In the first line, PO105 (price basis) wasn't sent, so PO106 is still the sixth element. In the second, the N1 has
no N103 or N104, so the segment just ends after N102. A file that ends a segment with *~ breaks a
rule many translators enforce, and is a common reason for rejection.
The delimiters
| Role | Common character | Where the file defines it |
|---|---|---|
| Element separator | * | The 4th character of the file, right after ISA |
| Component (sub-element) separator | > or : | ISA16, the last element of the ISA |
| Repetition separator | ^ | ISA11, in version 4020 and later (older files send U there instead) |
| Segment terminator | ~ | The character right after ISA16 |
The ISA segment is a fixed 106 characters, so a translator can always find the delimiters by position. Never
assume * and ~: some partners use | as the element separator, or a newline
as the terminator. Read them from the ISA, as Envelopes shows.
X12 has no escape character. If a product description contains the element separator, as in
Rail * 48 in, the receiver will read it as two elements and the file breaks. Senders must strip or
replace delimiter characters from data, or choose delimiters that can't appear in it. EDIFACT handles this
differently; see X12 vs EDIFACT.
Data types, lengths and requirements
The standard gives every element a type, a minimum and maximum length, and a requirement. These are what a translator checks when it says a file is "syntactically valid".
| Type | Meaning | Example |
|---|---|---|
| ID | A code from a list, such as unit of measure or party type | CA, ST, 00 |
| AN | Free text (alphanumeric) | Shelf bracket |
| N0, N2 | A number with an implied decimal: N2 means the last two digits are cents | 89900 in an N2 field = 899.00 |
| R | A number with an explicit decimal point, if any | 18.50, 212.5 |
| DT | A date, CCYYMMDD (or YYMMDD in the ISA) | 20261026 |
| TM | A time, HHMM, sometimes with seconds | 1430 |
- M: mandatory
- Must be sent whenever the segment is sent. BEG03, the PO number, is mandatory.
- O: optional
- The standard allows it to be left out. Your partner's guide may still require it.
- X: conditional
- Required or forbidden depending on other elements. In N1, if you send N103 (the ID qualifier) you must send N104 (the ID), and the other way round. These pairings are called syntax notes.
Segments have requirements too: in the 850, BEG is mandatory and REF is optional. And they have a maximum use: a segment or loop may repeat only so many times. The transaction set reference lists all of them for each document.
"Optional in the standard" and "optional for your partner" are different things. Most of the rejections you'll see come from partner rules, not from the standard. That's the subject of Implementation guides.
Composite and repeating elements
Some elements hold several values. A composite element splits into components with the component separator. Healthcare uses them constantly: the procedure in an 837 service line is a composite of qualifier, code and modifiers.
SV1*HC>87880>QW*50.00*UN*1***1~
| SV101-01 = HC | The code is a HCPCS/CPT procedure code. |
| SV101-02 = 87880 | The procedure itself. |
| SV101-03 = QW | A modifier. |
| SV102 = 50.00 | The charge. |
| SV103 = UN, SV104 = 1 | One unit. |
| SV107 = 1 | Points at the first diagnosis in the claim's HI segment. |
A repeating element (version 4020 and later) holds the same kind of value several times, split by the repetition separator, such as a list of condition codes. You'll mostly meet repetitions in healthcare 5010 files.
Loops
A loop is a group of segments that repeats together. The loop is named after its first segment, and it ends when a segment appears that doesn't belong to it.
N1*BY*Acme Distribution*92*ACME01~ N1*ST*Acme Distribution Center*92*DC14~ N3*4100 Industrial Pkwy~ N4*Joliet*IL*60431*US~
The first N1 loop is the buyer (BY), with no address. The second is the ship-to (ST), with an N3 street and N4 city, state, postal code and country. The N3 and N4 belong to the N1 just above them, which is why the order of segments matters.
PO1*1*24*CA*18.50*PE*UP*012345678905*VN*NS-1180~ PID*F****Shelf bracket, galvanized, 12 in~ PO1*2*10*EA*42.00*PE*UP*012345678912*VN*NS-2210~ PID*F****Wall-mount rail, 48 in~
Loops can nest: in an 856, each carton loop sits inside an order loop, which sits inside the shipment loop. X12
uses a special segment, HL, to build those trees; Ship notices walks
through one.
Qualifiers
A qualifier is a code that says what the next value means. The same segment carries completely different information depending on its qualifier, so you can never read a value without it.
REF*DP*038~ REF*BM*BOL-889120~ REF*CN*7741200931~ DTM*002*20261109~ DTM*011*20261105~
| REF*DP | Department number 038. |
| REF*BM | Bill of lading number BOL-889120. |
| REF*CN | Carrier's PRO (tracking) number 7741200931. |
| DTM*002 | Delivery requested on 9 November. |
| DTM*011 | Shipped on 5 November. |
Qualifiers come in front of IDs as well: in N1*ST*Acme Distribution Center*92*DC14,
92 says DC14 is a code the buyer assigned. Another partner might send UL and a 13-digit
GLN, or 9 and a DUNS+4 number, for the very same location. Most mapping mistakes come from reading a
value without its qualifier.
Reading a whole document
Here is North Supply's answer to the order above: an 855 purchase order acknowledgment. Before reading the notes, try to say what each line means using only what this module covered.
ST*855*0001~ BAK*00*AC*PO-48213*20261026*****20261027~ N1*ST*Acme Distribution Center*92*DC14~ N3*4100 Industrial Pkwy~ N4*Joliet*IL*60431*US~ PO1*1*24*CA*18.50*PE*UP*012345678905*VN*NS-1180~ ACK*IA*24*CA*068*20261105~ PO1*2*10*EA*42.00*PE*UP*012345678912*VN*NS-2210~ ACK*IQ*8*EA*068*20261107~ CTT*2~ SE*11*0001~
-
BAKis the 855's beginning segment: an original (00) acknowledgment, with changes (AC, "acknowledge with detail and change") of order PO-48213 from 26 October, sent on 27 October. - The ship-to N1 loop repeats the order's, so the buyer can match it.
-
Each
PO1loop echoes an ordered line, and itsACKgives the answer: line 1 is accepted (IA), 24 cases, shipping (068) on 5 November; line 2 has a quantity change (IQ): only 8 of the 10 will come, on 7 November. CTT*2counts two lines;SE*11*0001closes the document after 11 segments.
Open this 855 in the Segment Explorer to click through every element and see its name from the X12 dictionary. Orders explains the 855 in full.
Envelopes and control numbers
Documents travel inside nested envelopes, like letters in a mailbag. The envelopes say who the file is from and to, whether it's a test, and how much is inside, so the receiver can prove nothing was lost.
Three envelopes
Each header has a matching trailer. The trailer repeats the header's control number and counts what's inside:
| Trailer | Element 1 counts | Element 2 must equal |
|---|---|---|
| SE | Segments from ST to SE, both included | ST02, the transaction set control number |
| GE | Transaction sets (ST…SE pairs) in the group | GS06, the group control number |
| IEA | Functional groups in the interchange | ISA13, the interchange control number |
A complete file
This is the whole file that carried Acme's order, envelopes included. Count along: the SE says 18 segments, the GE says 1 set, the IEA says 1 group, and each trailer's second element matches its header.
ISA*00* *00* *ZZ*ACMEBUYER *ZZ*NORTHSUPPLY *261026*0830*U*00401*000004521*0*T*>~ GS*PO*ACMEBUYER*NORTHSUPPLY*20261026*0830*4521*X*004010~ ST*850*0001~ BEG*00*SA*PO-48213**20261026~ CUR*BY*USD~ REF*DP*038~ ITD*08*3*2**10**30~ DTM*002*20261109~ TD5**2*ODFL*M~ N1*BY*Acme Distribution*92*ACME01~ N1*ST*Acme Distribution Center*92*DC14~ N3*4100 Industrial Pkwy~ N4*Joliet*IL*60431*US~ N1*VN*North Supply Co*92*V20931~ PO1*1*24*CA*18.50*PE*UP*012345678905*VN*NS-1180~ PID*F****Shelf bracket, galvanized, 12 in~ PO1*2*10*EA*42.00*PE*UP*012345678912*VN*NS-2210~ PID*F****Wall-mount rail, 48 in~ CTT*2*34~ SE*18*0001~ GE*1*4521~ IEA*1*000004521~
Open it in the Segment Explorer: its control checks recount everything for you.
The ISA, element by element
The ISA is the only fixed-width segment in X12. Every element has an exact length, padded with spaces, so the segment is always 106 characters including its terminator. That's how a translator finds the delimiters before it has read anything else.
| Element | Example | What it is |
|---|---|---|
| ISA01–04 | 00, 10 spaces, 00, 10 spaces |
Authorization and security information. Almost always empty (00 plus spaces). |
| ISA05 / ISA06 | ZZ ACMEBUYER␣␣␣␣␣␣ |
Sender ID qualifier and sender ID, padded to 15. Qualifiers: 01 DUNS,
08 UCC/EAN, 12 phone number, 14 DUNS+suffix,
ZZ mutually defined.
|
| ISA07 / ISA08 | ZZ NORTHSUPPLY␣␣␣␣ |
Receiver ID qualifier and receiver ID. A VAN routes the file by these two. |
| ISA09 / ISA10 | 261026 0830 |
Date (YYMMDD, the only two-digit year in X12) and time (HHMM) the interchange was made. |
| ISA11 | U or ^ |
Before version 4020: the standards ID, always U. From 4020: the repetition separator. |
| ISA12 | 00401 |
The version of the ISA/IEA envelope itself (00401, 00501…). The documents inside give their own version in GS08. |
| ISA13 | 000004521 |
Interchange control number, nine digits with leading zeros. |
| ISA14 | 0 |
1 asks the receiver for a TA1 interchange acknowledgment; 0 doesn't. |
| ISA15 | T |
Usage: T test, P production. Production systems act on P files: they ship, bill
and pay.
|
| ISA16 | > |
Component separator. The character after it is the segment terminator. |
Send T until the partner tells you, in writing, that you're live. A test order sent with
P can be picked, shipped and invoiced for real. Many partners also use different IDs, or a separate
mailbox, for testing.
The GS and ST
GS*PO*ACMEBUYER*NORTHSUPPLY*20261026*0830*4521*X*004010~ ST*850*0001~
| GS01 = PO | Functional identifier: what kind of documents the group holds. PO = purchase orders (850). |
| GS02 / GS03 | Application sender and receiver codes. Often the same as the ISA IDs; some partners use a different code per division or system. |
| GS04 / GS05 | Date (CCYYMMDD) and time. |
| GS06 = 4521 | Group control number, repeated in GE02. |
| GS07 = X | Responsible agency: X12. |
| GS08 = 004010 |
The version of the documents inside: 004010, 005010, or an industry variant such as
004010VICS or 005010X222A1.
|
| ST01 = 850 | Transaction set: a purchase order. |
| ST02 = 0001 | Transaction set control number, repeated in SE02. Unique within the group. |
| ST03 |
Only in 5010 and later: the implementation guide, such as 005010X222A1 for an 837
professional claim.
|
Functional identifiers you'll see in GS01
| GS01 | Sets | GS01 | Sets |
|---|---|---|---|
| PO | 850 purchase order | SM | 204 load tender |
| PR | 855 PO acknowledgment | GF | 990 tender response |
| PC | 860 PO change | QM | 214 shipment status |
| SH | 856 ship notice | IM | 210 freight invoice |
| IN | 810 invoice | OW / SW | 940 / 945 warehouse |
| RA | 820 remittance | HC | 837 claim |
| IB | 846 inventory | HP | 835 claim payment |
| FA | 997 / 999 acknowledgments | PS | 830 planning schedule |
Several documents in one file
One interchange can hold several groups, and a group can hold many sets. Here two orders and one change travel together. The orders share a PO group; the change (an 860) needs its own PC group, because a group holds one kind of document.
ISA*00* *00* *ZZ*ACMEBUYER *ZZ*NORTHSUPPLY *261027*1500*U*00401*000004530*0*T*>~ GS*PO*ACMEBUYER*NORTHSUPPLY*20261027*1500*4530*X*004010~ ST*850*0001~ BEG*00*SA*PO-48220**20261027~ PO1*1*12*CA*18.50*PE*UP*012345678905~ CTT*1*12~ SE*5*0001~ ST*850*0002~ BEG*00*SA*PO-48221**20261027~ PO1*1*40*EA*42.00*PE*UP*012345678912~ CTT*1*40~ SE*5*0002~ GE*2*4530~ GS*PC*ACMEBUYER*NORTHSUPPLY*20261027*1500*4531*X*004010~ ST*860*0001~ BCH*04*SA*PO-48213**1*20261026~ POC*1*QI*36*36*CA*18.50*PE*UP*012345678905~ CTT*1~ SE*5*0001~ GE*1*4531~ IEA*2*000004530~
GE*2 counts the two 850s. The second group gets the next group control number, 4531. ST02 starts again at 0001 in each group. IEA*2 counts the two groups. (Real orders carry more segments; these are cut down so the envelopes stand out.)
Control number rules
- Never reuse an interchange control number with the same partner. Receivers keep a list of ISA13 values they've seen and reject or silently drop duplicates, to avoid processing the same order twice.
- Increase them steadily. Most partners expect each new ISA13 to be higher than the last. A gap is usually fine; going backwards often isn't. Never reset a counter when you move to a new server or translator.
- Resend with a new number. When a file has to be sent again, build a new interchange. Resending the identical file with the old ISA13 is what duplicate checks are designed to catch.
- Acknowledgments point back by number. A 997 names the group it answers by GS06 and each set by ST02 (Acknowledgments). If your numbers aren't unique, you can't tell which file an acknowledgment is about.
Your translator, or an API such as the JSON-to-EDI API, keeps a counter for each partner and assigns the next number for you. Hand-built files are where duplicate and mismatched numbers usually come from.
Choosing and agreeing IDs
Before the first file, both partners agree on the qualifier and ID each side will use in the ISA, and the
application codes in the GS. A partner's guide normally states theirs and asks for yours. Common choices are a
DUNS number (01), a phone number (12), or a mutually defined code (ZZ).
Some large partners use one ID for test and another for production.
Get the receiver qualifier wrong and the file is undeliverable on a VAN, or rejected with a TA1 on a direct connection, even though every segment inside it is perfect. Troubleshooting has a worked case.
Implementation guides and partner rules
The X12 standard says what an 850 may contain. Each trading partner's implementation guide says what their 850 must contain. Reading those guides is most of the job.
Why no two partners are the same
The standard is deliberately broad, so it can serve every industry. The 850 has dozens of segments and thousands of codes. A partner uses a small slice of that, and adds its own rules about which slice. Those rules are written down in an implementation guide, also called a spec, a mapping guide, or, in healthcare, a companion guide that sits on top of the HIPAA guide.
Here is the same line, an order for 24 cases, as three different partners require it:
PO1*1*24*CA*18.50*PE*UP*012345678905*VN*NS-1180~
PO1*1*24*CA*18.50**BP*778812*UK*10012345678902~
PO1*001*288*EA*1.5417**UP*012345678905~ PO4*12*1*EA~
None of these is wrong. Partner A identifies the product by UPC and the supplier's item number. Partner B wants its own item number (BP) and a case-level GTIN-14 (UK), and leaves the price basis empty. Partner C orders in eaches (288 = 24 × 12), prices per each, numbers lines 001, 002, and adds a PO4 to say 12 eaches make a pack. A supplier that serves all three needs three slightly different maps.
What's in a guide, and how to read it
Most guides follow the layout of the standard: an introduction, then each segment in order with its elements. Look for these things first:
-
Contacts, connection and IDs. Who to email, how files travel (AS2, VAN, SFTP), the ISA and GS IDs for
test and production, and the version (GS08), such as
004010or004010VICS. - Which documents and when. For example: "856 must arrive before the truck", "810 no earlier than ship date", "997 within 24 hours".
- Segment usage. Each segment is marked mandatory, optional, or "must use"/"used"/"not used". A segment that's optional in the standard but "must use" in the guide is mandatory for you.
- Element usage and codes. Which elements they send or expect, and which codes they accept. "N101: ST, BT only" means any other party code will be rejected.
- Samples. Most guides end with an example file. Compare yours against it line by line.
- Business rules in the notes. The rules that cause chargebacks are often in free-text notes, not the segment tables: "one PO per ASN", "cartons must carry SSCC-18 labels".
A guide page, translated
A typical entry for the 850's REF segment, and what it means for your map:
| Guide says | What it means |
|---|---|
REF Reference Identification · Usage: Must use · Max use: 5 |
Optional in the standard, but this partner always sends at least one, so your system must accept it. |
REF01 128 · M · ID 2/3 · Codes: DP, IA |
The qualifier is always DP (department) or IA (internal vendor number). Anything else is an error. |
REF02 127 · M · AN 1/30 |
The value, 1 to 30 characters. |
REF03 352 · Not used |
Don't send a description, and don't expect one. |
Note: DP must be printed on the carton label. |
A business rule: the department number travels on to the 856 and the label. Easy to miss. |
The numbers 128, 127 and 352 are the X12 data element numbers: every element in the standard has one, and it's the same wherever that element appears. REF01 is element 128 in every transaction set.
The differences you'll meet most often
| Area | How partners differ |
|---|---|
| Product IDs | UPC, EAN, GTIN-14, buyer's item, vendor's item, or several at once, in a required order. |
| Party IDs | Their own location codes (92), DUNS (1 or 9), or GLN (UL). Some require ship-to and bill-to; others only ship-to. |
| Units of measure | Ordering in cases vs eaches; which UOM codes are allowed (CA, EA, CS, PK…). |
| Dates | Which DTM qualifiers they send (002, 010, 037, 038…), and which they expect back. |
| Envelope | ISA IDs and qualifiers, separators, one ST per file or many, TA1 requested or not. |
| 856 structure | Pick-and-pack (shipment, order, pack, item) vs standard pack (shipment, order, item); see Ship notices. |
| Allowances and charges | Whether freight, discounts and fees go in SAC segments, and which codes. |
| Timing | How soon an 855, 856 or 997 must arrive, and the penalty if it doesn't. |
Partners publish new versions of their guides, often with a deadline. Keep the version you built against, note its date, and read the change log of each new one. A map that worked for years can start failing the day a partner's new rule takes effect.
Industry conventions
Between the standard and a single partner's guide there's often a middle layer: an industry convention that many partners follow.
-
Retail: the VICS conventions (now maintained by GS1 US) narrow X12 for retail, shown as
004010VICSor005010VICSin GS08. See the retail path. - Automotive: AIAG guidelines in North America, and Odette in Europe.
-
Healthcare: the HIPAA implementation guides (TR3s) for 5010, such as
005010X222A1for professional claims, are required by law; each payer's companion guide adds to them. See Healthcare. - Grocery and food service: UCS conventions, often with their own document variants.
A convention gets you most of the way, but each partner's guide still has the final word.
Keeping track of many partners
Once you have more than a handful of partners, keep a record of each one's rules in a structured form instead of a folder of PDFs: which documents, which segments, which codes, which IDs. Comparing a new partner's guide with what you already support shows exactly what needs to change, and lets you check outgoing files against each partner's rules before they leave.
The Spec Exchange tool on this site does that: write a partner's rules once, compare guides side by side, and check EDI data against them. Mapping and testing a new partner shows where it fits in onboarding.
Orders and order changes
The 850 purchase order starts most supply-chain conversations. The 855 answers it, the 860 changes it, and the 865 answers the change. Together they settle what will ship, when, and at what price.
The conversation
Every business document gets a 997 back, which only says the file was received and readable. The 855 is the business answer: whether the supplier can fill the order as written. Not every partner uses the 855, 860 or 865; many retailers send only 850s and expect changes to arrive as new or cancelled orders. Their guide says which.
The 850 purchase order
ST*850*0001~ BEG*00*SA*PO-48213**20261026~ CUR*BY*USD~ REF*DP*038~ ITD*08*3*2**10**30~ DTM*002*20261109~ TD5**2*ODFL*M~ N1*BY*Acme Distribution*92*ACME01~ N1*ST*Acme Distribution Center*92*DC14~ N3*4100 Industrial Pkwy~ N4*Joliet*IL*60431*US~ N1*VN*North Supply Co*92*V20931~ PO1*1*24*CA*18.50*PE*UP*012345678905*VN*NS-1180~ PID*F****Shelf bracket, galvanized, 12 in~ PO1*2*10*EA*42.00*PE*UP*012345678912*VN*NS-2210~ PID*F****Wall-mount rail, 48 in~ CTT*2*34~ SE*18*0001~
An 850 has three areas. The heading (BEG to the N1 loops) applies to the whole order. The detail is one PO1 loop per line. The summary (CTT) closes it with control totals.
| Segment | What it carries |
|---|---|
| BEG |
BEG01 purpose (00 original, 01 cancellation, 05 replace,
07 duplicate); BEG02 order type; BEG03 PO number; BEG05 PO date.
|
| CUR | Currency, here US dollars from the buyer's (BY) side. |
| REF | References: department (DP), promotion, contract, vendor number (IA). |
| ITD |
Payment terms. 08 basic discount offered: 2% if paid in 10 days, otherwise due in 30 ("2% 10,
net 30"). ITD02 3 means the terms run from invoice date.
|
| DTM |
Dates. 002 delivery requested, 010 requested ship, 037 ship not
before, 038 ship no later than, 001 cancel after.
|
| TD5 | Routing: carrier ODFL by its SCAC (TD502 2 = SCAC), by motor (M). |
| N1 loops |
Parties: buyer (BY), ship-to (ST) with address, vendor (VN). Others
you'll see: bill-to (BT), ship-from (SF), and the store a line is for (Z7
mark-for).
|
| PO1 |
Line number, quantity, unit, unit price, price basis (PE per each), then pairs of product ID
qualifier and value.
|
| PID |
Description: F free text in PID05, or S structured codes such as colour and
size.
|
| CTT | Number of PO1 lines (2) and the hash total of their quantities (24 + 10 = 34). |
Kinds of order
BEG02 says what kind of order it is, and that changes how the supplier must fulfil it.
| BEG02 | Order type | What changes |
|---|---|---|
| SA | Stand-alone | A normal one-off order. The default in most retail. |
| DS | Drop ship | Ship straight to the buyer's customer. The ship-to is a consumer's address, and the packing slip must look like the retailer's. |
| BK | Blanket | A long-term agreement for a total quantity, with no delivery of its own. |
| RL | Release | "Ship this much now" against a blanket order (BEG04 holds the release number). |
| KN | Purchase order for a store's own needs | Partner-specific; check the guide for how it differs. |
A drop-ship order
ST*850*0001~ BEG*00*DS*PO-90017**20261103~ REF*CO*WEB-2231907~ TD5**2*UPSN*U*Ground~ N1*ST*Dana Whitfield~ N3*88 Birch Lane*Apt 4~ N4*Madison*WI*53703*US~ PER*IC**TE*6085550199~ PO1*1*1*EA*42.00**UP*012345678912*VN*NS-2210~ CTT*1*1~ SE*11*0001~
BEG02 DS marks a drop-ship order. REF*CO is the consumer's own order number, which often
has to be printed on the packing slip. The ship-to N1 is a person, with a phone contact (PER) for the carrier. The
carrier and service level come from the retailer in TD5. Real drop-ship guides add gift messages, return addresses
and packing-slip text, all partner-specific.
One order, many stores
Retailers often order for several stores at once and want the supplier to pack each store's share separately, delivered through a distribution center. Two common patterns:
PO1*1*36*CA*18.50*PE*UP*012345678905~ SDQ*CA*92*0112*12*0118*18*0140*6~
PO1*1*36*CA*18.50*PE*UP*012345678905~ N1*Z7**92*0112~ QTY*01*12~ N1*Z7**92*0118~ QTY*01*18~
On the left, SDQ (destination quantity) splits line 1's 36 cases between stores 0112 (12), 0118 (18) and 0140 (6),
all identified by buyer codes (92). On the right, the same idea with a mark-for party per store.
Which pattern, if either, is entirely up to the partner. The 856 must then show each store's cartons separately;
see Ship notices.
The 855 acknowledgment
ST*855*0001~ BAK*00*AC*PO-48213*20261026*****20261027~ N1*ST*Acme Distribution Center*92*DC14~ N3*4100 Industrial Pkwy~ N4*Joliet*IL*60431*US~ PO1*1*24*CA*18.50*PE*UP*012345678905*VN*NS-1180~ ACK*IA*24*CA*068*20261105~ PO1*2*10*EA*42.00*PE*UP*012345678912*VN*NS-2210~ ACK*IQ*8*EA*068*20261107~ CTT*2~ SE*11*0001~
BAK02 is the overall answer, and each ACK answers one line:
| BAK02 | Meaning |
|---|---|
| AT | Accepted, no detail |
| AD | Accepted with detail, no changes |
| AC | Accepted with detail and changes |
| RD | Rejected with detail |
| RJ | Rejected, no detail |
| ACK01 | Line status |
|---|---|
| IA | Item accepted |
| IB | Backordered |
| IQ | Quantity changed |
| IP | Price changed |
| IR | Item rejected |
| ID | Item deleted |
Here line 2 will ship 8 of 10. The buyer's system should update the expected receipt, and the shortage shouldn't
be a surprise when the 856 arrives. A supplier that accepts everything with AT and then ships short
is a common source of disputes.
The 860 change and the 865 answer
When the buyer changes an order already sent, it sends an 860 that refers to the original PO. Each changed line has a POC segment saying what changed.
ST*860*0001~ BCH*04*SA*PO-48213**1*20261026~ DTM*002*20261112~ N1*BY*Acme Distribution*92*ACME01~ N1*ST*Acme Distribution Center*92*DC14~ N3*4100 Industrial Pkwy~ N4*Joliet*IL*60431*US~ POC*1*QI*36*36*CA*18.50*PE*UP*012345678905*VN*NS-1180~ POC*2*DI*0**EA***UP*012345678912*VN*NS-2210~ CTT*2~ SE*11*0001~
-
BCH*04: a change (01would cancel the whole order). BCH03 is the original PO number, BCH05 the change number (1), BCH06 the original PO date. - The delivery date moves to 12 November (DTM 002).
-
POC line 1: quantity increase (
QI), the new quantity is 36 cases (POC03), with 36 left to receive (POC04). -
POC line 2: delete the item (
DI). Other change codes:QDquantity decrease,PCprice change,AIadd item,CAchanges to line items.
ST*865*0001~ BCA*00*AC*PO-48213**1*20261026~ N1*ST*Acme Distribution Center*92*DC14~ N3*4100 Industrial Pkwy~ N4*Joliet*IL*60431*US~ POC*1*QI*36**CA*18.50*PE*UP*012345678905~ ACK*IA*36*CA*068*20261110~ POC*2*DI*0**EA***UP*012345678912~ ACK*ID~ CTT*2~ SE*11*0001~
The 865 mirrors the 860, with an ACK per change: line 1's increase is accepted and ships 10 November; line 2's
deletion is confirmed (ID). An 865 can also come from the seller unprompted, to propose a
change to an order.
Partners disagree about what an 860 means: replace the whole order, or change only the lines listed? Is a line
not mentioned unchanged, or cancelled? Some partners send a full replacement 850 (BEG01 05) instead
of an 860. Settle this in testing, with examples of each case, before it reaches production.
Where the order goes next
Once the order is agreed, the supplier picks and ships it and sends an 856 ship notice, then bills it with an 810 invoice. If a warehouse ships for the supplier, the order is passed on as a 940. If the buyer arranges the truck, a 204 load tender goes to the carrier.
Ship notices and the HL structure
The 856 advance ship notice (ASN) tells the receiver what's on the truck before it arrives: which orders, which cartons, which items. It's the document retailers police most closely, and the one with the most structure.
Why the ASN matters so much
At a busy distribution center, trucks are booked to the minute. When the ASN has arrived and matches the labels on the cartons, receiving is a scan: each carton's barcode is looked up in the ASN, and the system knows which order and items it holds without opening it. When the ASN is missing, late, or doesn't match the labels, someone has to open and count every carton.
That's why retailers charge suppliers for ASN problems. Typical chargeback reasons: ASN not received before the truck, ASN doesn't match the shipment, carton labels missing or unreadable, wrong structure. The amounts and rules are in each retailer's compliance or routing guide.
Hierarchical levels (HL)
An ASN describes a tree: one shipment holds orders, each order holds cartons (packs), each carton holds items. X12
builds the tree with the HL segment.
- HL01 numbers every level in the set, 1, 2, 3… in order.
- HL02 points at the parent level's HL01. The shipment, at the top, has no parent.
-
HL03 says what kind of level it is:
Sshipment,Oorder,Ttare (pallet),Ppack (carton),Iitem. Healthcare uses numbers instead: 20 information source, 22 subscriber, and so on. - HL04 is
1if other levels hang under this one,0if not.
The segments after each HL, up to the next HL, describe that level.
A pick-and-pack ASN
North Supply ships Acme's order PO-48213 in three cartons: two cartons of 12 brackets and one carton of 10 rails.
ST*856*0001~ BSN*00*SHP-55102*20261105*1430*0001~ HL*1**S*1~ TD1*CTN25*3****G*212.5*LB~ TD5**2*ODFL*M~ REF*BM*BOL-889120~ REF*CN*7741200931~ DTM*011*20261105~ DTM*017*20261108~ N1*ST*Acme Distribution Center*92*DC14~ N3*4100 Industrial Pkwy~ N4*Joliet*IL*60431*US~ N1*SF*North Supply Co*92*V20931~ N4*Rockford*IL*61110*US~ HL*2*1*O*1~ PRF*PO-48213***20261026~ HL*3*2*P*1~ MAN*GM*000123456789012343~ HL*4*3*I*0~ LIN*1*UP*012345678905*VN*NS-1180~ SN1*1*12*CA~ HL*5*2*P*1~ MAN*GM*000123456789012350~ HL*6*5*I*0~ LIN*1*UP*012345678905*VN*NS-1180~ SN1*1*12*CA~ HL*7*2*P*1~ MAN*GM*000123456789012367~ HL*8*7*I*0~ LIN*2*UP*012345678912*VN*NS-2210~ SN1*2*10*EA~ CTT*8~ SE*33*0001~
| Segment | What it says |
|---|---|
| BSN |
Original (00) ship notice SHP-55102, created 5 November at 14:30. BSN05 0001 names the
structure: shipment, order, packaging, item (pick and pack).
|
| TD1 | 3 cartons (CTN25 = corrugated carton), gross weight (G) 212.5 pounds. |
| TD5 | Carrier ODFL, motor freight. |
| REF BM / CN | The bill of lading and the carrier's PRO number. The receiver uses these to match the truck to the ASN. |
| DTM 011 / 017 | Shipped 5 November; estimated delivery 8 November. |
| N1 ST / SF | Ship-to (the DC, by the buyer's code DC14) and ship-from. |
| PRF | The purchase order this order level belongs to, and its date. |
| MAN*GM | The carton's SSCC-18, the number in the barcode on its GS1-128 label. |
| LIN / SN1 | The item (by UPC and vendor number) and the quantity shipped. SN101 points back at the PO line. |
| CTT*8 | In an 856, CTT01 counts HL segments. |
The 856 always describes what actually shipped, which isn't always what was ordered or promised in the 855. When they disagree, the buyer's receiving and accounts payable teams will notice; see the three-way match. Open this 856 in the Segment Explorer.
Carton labels and the SSCC-18
Each carton (or pallet) gets a unique 18-digit Serial Shipping Container Code. It's printed as a GS1-128 barcode
on the shipping label, with application identifier (00) in front, and the same number is sent in the carton's
MAN*GM segment.
- The company prefix comes from the shipper's GS1 membership; the serial part is assigned by the shipper and must not repeat for at least a year.
- The check digit is calculated from the other 17 digits, like a UPC's. A label number with a wrong check digit won't scan into the right ASN.
- The label usually also shows ship-from, ship-to, carrier, PO number, and for retail often the department and the store (mark-for). The layout is in the retailer's labelling guide.
Other structures
Pick and pack (S-O-P-I) fits mixed cartons. Partners also ask for these:
| BSN05 | Levels | Used when |
|---|---|---|
| 0001 | S · O · P · I (pick and pack) | Cartons can hold different items. Each carton is listed with its contents. |
| 0002 | S · O · I · P (standard carton pack) | Each carton holds one item in a standard quantity. Items are listed, with their cartons under them. |
| 0004 | S · O · I (no packaging) | Bulk or loose shipments where cartons aren't tracked. |
| (partner) | S · O · T · P · I | Shipments on pallets. The T level is a pallet with its own SSCC; cartons sit under it. |
| (partner) | S · O · S(tore) · P · I | Cross-dock to stores: an order level per store, identified by a mark-for N1 (Z7 or BY), with that store's cartons under it. |
The same shipment as standard pack
HL*2*1*O*1~ PRF*PO-48213***20261026~ HL*3*2*I*1~ LIN*1*UP*012345678905*VN*NS-1180~ SN1*1*24*CA~ HL*4*3*P*0~ MAN*GM*000123456789012343~ HL*5*3*P*0~ MAN*GM*000123456789012350~ HL*6*2*I*1~ LIN*2*UP*012345678912*VN*NS-2210~ SN1*2*10*EA~ HL*7*6*P*0~ MAN*GM*000123456789012367~
Now the item comes first with its total quantity (24 brackets), and its two cartons hang under it. Same shipment, same labels, different tree. Sending pick-and-pack to a partner that expects standard pack is a classic first-ASN rejection.
Timing and accuracy rules
- Send it when the truck leaves, and before it arrives. Many retailers require the ASN within an hour of departure, or before a set time. Some reject an ASN sent before ship date.
- One ASN per truck (per bill of lading) is the usual rule. Some partners want one ASN per PO, or per store.
- Every carton on the truck must be in the ASN, and every carton in the ASN on the truck. Reprinted labels must be updated in the ASN too.
-
Corrections go as a replacement (BSN01
05) or a cancellation (01) and a new ASN, depending on the guide. Some partners don't accept corrections after the truck has arrived. - The 856 isn't only retail. Manufacturers send it against schedules (see planning schedules), and the same idea appears as the 945 in warehousing and DESADV in EDIFACT.
Which segments each level needs varies more in the 856 than in any other document. One retailer requires TD1 at the order level, another forbids it; one wants the store in an N1 at order level, another in a separate level. Build each partner's ASN from its own guide and sample.
Invoices, payments and deductions
The 810 bills for what shipped. The buyer checks it against the order and the receipt, pays, and explains the payment with an 820. When something doesn't match, the difference comes back as a deduction, an 812, or an 824 rejection.
From invoice to cash
Not every invoice goes through all of these. A clean invoice gets a 997, then an 820 when it's paid. The 824 and 812 appear only when something is wrong, and many buyers explain deductions only inside the 820, or in a web portal instead of EDI.
The 810 invoice
ST*810*0001~ BIG*20261106*INV-7702*20261026*PO-48213~ N1*RE*North Supply Co*92*V20931~ N3*PO Box 4410~ N4*Rockford*IL*61110*US~ N1*BT*Acme Distribution*92*ACME01~ ITD*08*3*2**10**30~ DTM*011*20261105~ IT1*1*24*CA*18.50*PE*UP*012345678905*VN*NS-1180~ PID*F****Shelf bracket, galvanized, 12 in~ IT1*2*10*EA*42.00*PE*UP*012345678912*VN*NS-2210~ PID*F****Wall-mount rail, 48 in~ TDS*89900~ SAC*C*D240***3500**********Freight~ CTT*2~ SE*16*0001~
| Segment | What it carries |
|---|---|
| BIG |
Invoice date (6 November), invoice number INV-7702, the PO date and PO number it bills against. BIG07 can
mark a credit memo (CR) or debit memo (DR).
|
| N1 RE / BT | Remit-to (where to send the money) and bill-to. |
| ITD | The payment terms, usually copied from the order: 2% 10, net 30. |
| DTM*011 | The ship date the invoice is for. |
| IT1 | Invoice lines, laid out like PO1: line, quantity invoiced, unit, unit price, price basis, product IDs. |
| TDS | Total invoice amount, with two implied decimals: 89900 = 899.00. |
| SAC |
An allowance (A) or charge (C). Here a freight charge (D240) of
35.00, also with implied decimals: 3500.
|
| CTT | Two invoice lines. |
Check the arithmetic the way the buyer's system will: 24 × 18.50 = 444.00, plus 10 × 42.00 = 420.00, plus 35.00 freight = 899.00, which is TDS01. Getting this wrong is the most common reason an 810 is rejected. Open the 810, then one that doesn't add up, in the Segment Explorer.
TDS01 and SAC05 are type N2: no decimal point, last two digits are cents. IT104 (the unit price) is type R: the decimal point is written. Mixing these up multiplies or divides an invoice by 100.
The three-way match
Accounts payable compares three things before paying: the order (850, plus any 860 changes) for what was agreed, the receipt (the 856 and what the dock actually scanned) for what arrived, and the 810 for what's billed.
| Line | Ordered (850) | Received | Invoiced (810) | Result |
|---|---|---|---|---|
| Brackets | 24 CA @ 18.50 | 24 CA | 24 CA @ 18.50 | Matches: pay 444.00 |
| Rails | 10 EA @ 42.00 | 8 EA | 10 EA @ 42.00 | Billed 2 more than received: pay 336.00, deduct 84.00 |
| Freight | Not on the order (prepaid terms) | — | 35.00 | Not agreed: deduct 35.00, or hold the invoice |
What happens next depends on the buyer: some hold the whole invoice until it's corrected, some pay what matches and deduct the rest, some reject it with an 824. The supplier then sees the difference in the 820 or an 812 and has to decide whether to dispute it.
The 820 remittance advice
The money itself moves through the banks. The 820 tells the supplier what a payment is for, so accounts receivable can apply it to the right invoices.
ST*820*0001~ BPR*C*1283.02*C*ACH*CTX*01*071000013*DA*000999111***01*071000039*DA*000222333*20261206~ TRN*1*PAY-0061204*1555555555~ CUR*PR*USD~ N1*PR*Acme Distribution*92*ACME01~ N1*PE*North Supply Co*92*V20931~ RMR*IV*INV-7702**881.02*899.00*17.98~ DTM*003*20261106~ RMR*IV*INV-7715**402.00*420.00~ ADX*-18.00*01~ SE*11*0001~
| BPR |
The payment. BPR01 C: the money travels with this remittance. 1,283.02, a credit (BPR03
C) by ACH in CTX format, from the payer's bank account to the payee's, effective 6 December.
Account and routing numbers here are fictional.
|
| TRN | The payment's trace number, which also appears on the bank statement. This is how the remittance is matched to the money. |
| N1 PR / PE | Payer and payee. |
| RMR (first) | Invoice INV-7702: invoiced 899.00, paid 881.02, discount taken 17.98 (2% for paying within 10 days). |
| RMR (second) | Invoice INV-7715: invoiced 420.00, paid 402.00. |
| ADX | An adjustment of −18.00 on that invoice, reason code 01 (pricing error). |
881.02 + 402.00 = 1,283.02, the amount in BPR02. When these don't agree, cash application stalls. Some 820s carry
no money movement at all (BPR01 I, remittance information only), and some buyers send the remittance
through their bank instead.
Deductions: the 812 and chargebacks
A deduction is money the buyer keeps back from a payment. Some are agreed (early-payment discounts, promotional allowances). Others are penalties (chargebacks) or disputes (short shipments, damages, pricing). The 812 explains one adjustment in detail:
ST*812*0001~ BCD*20261112*DM-2219*C*49*D*20261106*INV-7702***PO-48213~ N1*BY*Acme Distribution*92*ACME01~ N1*VN*North Supply Co*92*V20931~ CDD*02*D*1*37.00~ LIN**UP*012345678912~ CDD*01*D*2*12.00~ LIN**UP*012345678905~ SE*9*0001~
-
BCD: debit memo DM-2219 dated 12 November for 49.00 (debit,D) against invoice INV-7702 of 6 November, order PO-48213. -
Each
CDDis one adjustment with its reason code and amount, followed by the item it's about: 37.00 on the rail, 12.00 on the bracket. - 37.00 + 12.00 = 49.00, the BCD total.
Retail chargebacks for compliance (late ASN, bad labels, early delivery) are often sent outside EDI, on a portal or a statement, with a fee per incident. Keep the supporting proof: the 997 for your ASN, its send time, the label images. A dispute usually needs that proof to succeed.
The 824 application advice
A 997 says a file could be read. An 824 says a document was read and then rejected by the business application: the invoice refers to an unknown PO, the ASN is missing a required label number. It's how many retailers report problems with 856s and 810s.
ST*824*0001~ BGN*00*AA-55102*20261110*1130~ N1*BY*Acme Distribution*92*ACME01~ OTI*TR*BM*BOL-889120***20261109**418*0001*856~ TED*007*SSCC-18 missing on carton level*MAN*14~ SE*6*0001~
-
OTI*TR: the original transaction is rejected. It's identified by its bill of lading, the date, its group control number (418), set control number (0001) and type (856), so the supplier can find the exact file. -
TED: the error. Code007(missing data), a message, the segment (MAN) and its position.
An 824 usually needs a person: fix the data, then send a corrected document, often as a new document with a new number rather than a resend. Troubleshooting covers how to work through one.
Variations you'll meet
-
Credit memos. Returns and price corrections are often sent as an 810 with BIG07
CRand positive amounts, which the buyer treats as a credit. Some partners want negative quantities instead; their guide says which. - Consolidated invoices. One invoice covering several shipments or POs. Many retailers forbid them: one invoice per PO per shipment.
- Self-billing (evaluated receipts). In manufacturing, the customer pays from what it received, without an invoice at all, and sends the supplier a remittance. See the manufacturing path.
- Freight invoices. Carriers bill with the 210, not the 810; see Transportation.
- Healthcare doesn't use invoices: providers send claims (837) and payers answer with payments (835); see Healthcare.
Inventory, catalogs and sales data
Before anything is ordered, partners share what's available, what it costs and what's selling. Retailers and distributors use the 846, 832 and 852; manufacturers receive forecasts and delivery schedules in the 830 and 862.
Who sends what
| Set | Name | Usually from → to | Answers the question |
|---|---|---|---|
| 846 | Inventory inquiry/advice | Supplier → retailer, or warehouse → goods owner | How much can you ship right now? |
| 832 | Price/sales catalog | Supplier → buyer | What do you sell, how is it packed, what does it cost? |
| 852 | Product activity data | Retailer → supplier | What sold, and what's left on the shelf, store by store? |
| 830 | Planning schedule | Manufacturer → its supplier | What will we need over the coming weeks and months? |
| 862 | Shipping schedule | Manufacturer → its supplier | Exactly what to deliver, on which days, this week? |
| 867 | Product transfer and resale | Distributor → manufacturer | What did the distributor sell on, and to whom? |
The 846 inventory advice
Retailers that sell online, and especially those that drop-ship (see kinds of order), need to know daily or hourly what each supplier can ship, so they don't sell what isn't there.
ST*846*0001~ BIA*00*DD*INV-ADV-20261107*20261107*0500~ N1*SU*North Supply Co*92*V20931~ LIN*1*UP*012345678905*VN*NS-1180~ PID*F****Shelf bracket, galvanized, 12 in~ QTY*33*480*CA~ DTM*018*20261107~ LIN*2*UP*012345678912*VN*NS-2210~ PID*F****Wall-mount rail, 48 in~ QTY*33*96*EA~ QTY*QP*200*EA~ CTT*2~ SE*13*0001~
-
BIA: an original report (00) of distributor inventory (DD), with its own reference and the date and time it was taken. -
Each
LINloop is one item.QTY*33is the quantity available for sale: 480 cases of brackets, 96 rails. -
The second QTY on the rail uses another qualifier (here
QP, 200 on order but not yet received), so the retailer can see more is coming. Partners choose which quantities they want; some take only the available quantity, some want on-hand (17), committed and inbound too. DTM*018: the date the quantity is available.
Some partners want every item in every 846 (a full snapshot: an item that's missing means zero). Others want only items whose quantity changed. Sending changes to a partner that expects snapshots can make your whole catalog look out of stock.
The 832 price/sales catalog
Before a retailer can order a new item, its system needs the item: identifiers, description, pack, cost and suggested retail. The 832 delivers that.
ST*832*0001~ BCT*PC*CAT-2027*1*******00~ DTM*007*20270101~ N1*SU*North Supply Co*92*V20931~ LIN*1*UP*012345678905*VN*NS-1180~ PID*F****Shelf bracket, galvanized, 12 in~ PO4*12*1*EA~ CTP*WS*WHL*18.95**CA~ CTP**MSR*2.49**EA~ LIN*2*UP*012345678912*VN*NS-2210~ PID*F****Wall-mount rail, 48 in~ CTP*WS*WHL*43.00**EA~ CTT*2~ SE*14*0001~
-
BCT*PC: a price catalog, number CAT-2027.DTM*007says the prices take effect on 1 January 2027. -
PO4*12*1*EA: the case holds 12 eaches. This is how the buyer converts between cases and eaches. -
CTPlines give prices: wholesale (WHL) 18.95 per case, manufacturer's suggested retail (MSR) 2.49 per each.
A new price in the 832 must reach your order and invoice systems on the same effective date, or the next 810 bills the old price and the three-way match fails. Many retailers now take item data through product data pools (GS1 GDSN) instead of the 832; their guide says which.
The 852 product activity data
The retailer reports what sold and what's in stock, usually weekly, by store. Suppliers use it to plan production and to suggest orders; in vendor-managed inventory the supplier uses it to decide the orders itself.
ST*852*0001~ XQ*H*20261101*20261107~ N9*IA*V20931~ N1*RL*Acme Store 112*92*ST112~ LIN*1*UP*012345678905~ ZA*QS*37*EA~ ZA*QA*118*EA~ LIN*2*UP*012345678912~ ZA*QS*9*EA~ ZA*QA*22*EA~ CTT*2~ SE*12*0001~
XQ: a report for information (H), covering 1 to 7 November.-
N9*IA: the supplier's vendor number at the retailer.N1*RL: the reporting location, store 112. -
ZAactivity lines per item: quantity sold (QS) and quantity on hand available (QA). Others: received (QR), returned by consumers (QU), on order (QP).
A large retailer's 852 can cover thousands of stores and items in one file. Plan for big files, and check which units the quantities are in: sales are usually in eaches even when you sell in cases.
Planning and shipping schedules (830 and 862)
Manufacturers, automotive above all, don't send one purchase order per delivery. They agree a contract (often a blanket order) and then send their supplier a rolling forecast, the 830, and for the near term a precise delivery schedule, the 862. The supplier ships against the schedule and sends an 856 for each delivery.
ST*830*0001~ BFR*00**REL-2611-07*DL*A*20261109*20270207*20261106~ N1*MI*Midwest Assembly Plant*92*MAP01~ N1*SU*North Supply Co*92*V20931~ LIN**BP*BRK-1180*VP*NS-1180~ UIT*EA~ SHP*01*1200*050*20261102~ FST*400*C*D*20261116~ FST*400*C*D*20261123~ FST*1600*D*M*20261201~ FST*1600*D*M*20270101~ CTT*1*4000~ SE*13*0001~
| BFR |
Original schedule REL-2611-07, delivery based (DL) with actual quantities (A),
covering 9 November to 7 February, made on 6 November.
|
| N1 MI / SU | The plant issuing the schedule and the supplier. |
| LIN / UIT | The part, by the buyer's part number and the vendor's, in eaches. |
| SHP | The last receipt the plant recorded: 1,200 received on 2 November. Suppliers compare this with what they shipped to catch lost deliveries. |
| FST (C) |
Firm (C) quantities for discrete (D) dates: 400 each for 16 and 23 November.
Firm means "ship this".
|
| FST (D) |
Planning (D) quantities in monthly buckets (M): about 1,600 in December and
January. Planning means "get ready", not "ship".
|
| CTT | One item; the quantities add up to 4,000. |
ST*862*0001~ BSS*00*SS-2611-19*20261113*DL*20261116*20261122~ N1*ST*Midwest Assembly Plant*92*MAP01~ N1*SU*North Supply Co*92*V20931~ LIN**BP*BRK-1180~ UIT*EA~ FST*200*C*D*20261117~ FST*200*C*D*20261119~ CTT*1*400~ SE*10*0001~
The 862 turns the week's firm 400 into two deliveries of 200, on 17 and 19 November. When an 862 and an 830 disagree for the same dates, the 862 normally wins; each customer's guide says so explicitly. Schedules replace each other: the newest one is the whole truth, not a change to the last. The manufacturing path covers cumulative quantities and self-billing.
The 867 product transfer and resale report
Distributors that resell a manufacturer's products report those sales with the 867: what was sold, to which customer, at what price. Manufacturers use it to pay distributors back for agreed special pricing (chargebacks in the distribution sense) and to track sales by end customer. It's common in electronics, chemicals, food service and pharmaceuticals.
Warehousing and 3PL
When a company stores its goods in someone else's warehouse, the two run on the 900-series documents: the owner tells the warehouse what's coming in and what to ship, and the warehouse confirms what it received, shipped and adjusted.
Two parties, five documents
The owner of the goods is called the depositor. The warehouse, often a third-party logistics provider (3PL), holds the stock but doesn't own it. Here North Supply is the depositor and Riverbend 3PL runs the warehouse in Joliet.
Each of these also gets a 997. Notice the pairs: every instruction (943, 940) has a matching confirmation (944, 945). A 940 with no 945 after a day or two is an order that may not have shipped.
The 940 warehouse shipping order
When Acme's order arrives at North Supply (an 850), North Supply's system passes it to the warehouse as a 940.
ST*940*0001~ W05*N*SO-77031*PO-48213~ N1*ST*Acme Distribution Center*92*DC14~ N3*4100 Industrial Pkwy~ N4*Joliet*IL*60431*US~ N1*WH*Riverbend 3PL - Joliet*92*RB-JOL~ N9*PO*PO-48213~ G62*10*20261109~ NTE*WHI*Stretch-wrap pallets, max 60 in high~ W66*PP*M********ODFL~ LX*1~ W01*36*CA*012345678905*VN*NS-1180~ G69*Shelf bracket, galvanized, 12 in~ LX*2~ W01*10*EA*012345678912*VN*NS-2210~ W76*46*212.5*L~ SE*17*0001~
| W05 |
A new (N) shipping order: the depositor's order number SO-77031 and the customer's PO number.
|
| N1 ST / WH | Where it goes, and which warehouse ships it. |
| N9 | References to carry through to the paperwork, here the customer's PO. |
| G62*10 | Requested ship date, 9 November. |
| NTE*WHI | Warehouse instructions in free text. Read by a person on the floor, so keep them short and clear. |
| W66 | Shipping terms and carrier: prepaid (PP), motor (M), carrier ODFL. |
| LX / W01 | Line items: quantity, unit, UPC, then the vendor's item number. G69 adds a description. |
| W76 | Totals: 46 units, 212.5 pounds. The warehouse can check these against its own item data. |
The 945 warehouse shipping advice
ST*945*0001~ W06*F*SO-77031*20261109*SHP-55102**PO-48213~ N1*ST*Acme Distribution Center*92*DC14~ N3*4100 Industrial Pkwy~ N4*Joliet*IL*60431*US~ N1*WH*Riverbend 3PL - Joliet*92*RB-JOL~ N9*BM*BOL-889120~ G62*11*20261109~ W27*M*ODFL**PP~ LX*1~ W12*CC*36*36**CA*012345678905*VN*NS-1180~ N9*LT*LOT-2610A~ LX*2~ W12*CP*10*8*2*EA*012345678912*VN*NS-2210~ W03*44*198.0*L~ SE*16*0001~
W06points back at order SO-77031, with the shipment number and the customer's PO.N9*BMgives the bill of lading;G62*11the actual ship date.-
Each
W12compares ordered with shipped. Line 1: complete (CC), 36 ordered, 36 shipped, from lot LOT-2610A. Line 2: partial (CP), 10 ordered, 8 shipped, 2 short, and no backorder will follow. W03: shipment totals, 44 units at 198 pounds.
The depositor uses the 945 to send its customer the 856 ASN and the 810 invoice for what actually shipped. If the warehouse ships short and the depositor invoices the full order, the customer will deduct the difference.
Receiving stock: the 943 and 944
When North Supply's factory sends stock to the warehouse, it announces the shipment with a 943. The warehouse counts what arrives and answers with a 944.
ST*943*0001~ W06*F*TR-3301*20261104*SHP-55090~ N1*WH*Riverbend 3PL - Joliet*92*RB-JOL~ N1*SF*North Supply Co - Rockford*92*NS-RKF~ W27*M*ODFL~ W04*240*CA*012345678905*VN*NS-1180~ W04*60*EA*012345678912*VN*NS-2210~ W03*300*2210*L~ SE*9*0001~
ST*944*0001~ W17*F*20261106*RCV-12007*TR-3301*SHP-55090~ N1*WH*Riverbend 3PL - Joliet*92*RB-JOL~ LX*1~ W07*240*CA*012345678905*VN*NS-1180*LOT-2610A~ LX*2~ W07*58*EA*012345678912*VN*NS-2210~ N9*ZZ*2 units damaged in transit~ W14*298~ SE*10*0001~
The 943 announces 240 cases and 60 rails. The 944 confirms 240 cases (assigning lot LOT-2610A) but only 58 rails, with a note that 2 were damaged. W14 totals 298 received against 300 shipped. The depositor's system should now show 58 rails available, not 60, and someone should file a claim with the carrier for the damage.
The 947 inventory adjustment
Stock changes inside the warehouse too: cycle counts find differences, items get damaged, goods are put on hold. The warehouse reports each change with a 947, so the depositor's books match the shelves.
ST*947*0001~ W15*20261107*ADJ-4471~ N1*WH*Riverbend 3PL - Joliet*92*RB-JOL~ W19*01*-2*EA*012345678912*VN*NS-2210~ W19*07*1*CA*012345678905*VN*NS-1180~ SE*6*0001~
Each W19 is one adjustment: a reason code, the quantity change (negative removes stock), the unit and
the item. Here two rails are written off and one case of brackets is added after a count. Which reason codes are
used, and what each means, is one of the first things to agree with a new warehouse.
Keeping both sides in step
- Reconcile regularly. Compare the warehouse's 846 snapshot with the depositor's own records each day or week. Differences point to a missed 944, 945 or 947.
- Watch for open orders. Every 940 should get a 945, every 943 a 944. Report the ones that haven't after a set time.
- Lots, serial numbers and expiry dates matter in food, pharmaceuticals and electronics. Agree where they travel (W12 with N9 LT, or extra segments) and make sure they come back on the 945.
-
Cancellations come as a 940 with W05
C. They only work if the warehouse hasn't picked the order yet, so agree a cut-off time.
Open the 940 and then the 945 in the Segment Explorer. Find the line that shipped short, and by how much. The warehousing path has more practice.
Transportation and freight
Between the ship notice and the delivery, a carrier moves the goods. Shippers offer loads with the 204, carriers accept with the 990, report progress with the 214 and bill with the 210.
The load lifecycle
The "shipper" is whoever pays for and books the freight. Sometimes that's the seller (prepaid freight, as here), sometimes the buyer (collect, or the buyer's routing guide). A broker or a transportation management system (TMS) can sit in between and send the same documents to many carriers.
- Truckload (TL): one shipper's goods fill a trailer, which goes straight from pickup to delivery. Tenders and responses matter most here, often with a deadline of an hour or two to accept.
- Less than truckload (LTL): many shippers share a trailer through the carrier's terminals. Often booked without a 204 at all, by bill of lading or the carrier's website, but status and invoices still come by EDI.
- Parcel carriers mostly use their own APIs and files rather than X12; see EDI and APIs.
The 204 load tender
ST*204*0001~ B2**ODFL**LD-30418**PP~ B2A*00*LT~ L11*BOL-889120*BM~ L11*PO-48213*PO~ NTE**Driver must check in at guard shack~ N1*BT*North Supply Co*92*V20931~ N3*PO Box 4410~ N4*Rockford*IL*61110*US~ S5*1*LD*212.5*L*3*PL~ G62*37*20261105*I*0800~ G62*38*20261105*K*1400~ N1*SH*North Supply Co*93*NS-RKF~ N3*2200 Harrison Ave~ N4*Rockford*IL*61104*US~ PER*IC*Dock Office*TE*815-555-0142~ OID*BOL-889120*PO-48213**PLT*3*L*212.5~ S5*2*UL*212.5*L*3*PL~ L11*PO-48213*PO~ G62*53*20261107*G*0700~ G62*54*20261107*L*1500~ N1*CN*Acme Distribution Center*93*DC14~ N3*4100 Industrial Pkwy~ N4*Joliet*IL*60431*US~ OID*BOL-889120*PO-48213**PLT*3*L*212.5~ L3*212.5*G***68500******3*L~ SE*27*0001~
| B2 | Tender to carrier ODFL (its SCAC) for shipment LD-30418, freight prepaid (PP). |
| B2A*00*LT |
An original tender (00); the second code is the application type. Changes come as
04, cancellations as 01.
|
| L11 | References for the whole load: bill of lading and PO. L11 puts the value first and the qualifier second, the opposite of REF. |
| N1 BT | Bill-to: who pays the freight invoice. |
| S5 (stop 1) |
Stop 1 is a load (LD): 212.5 pounds, 3 pallets. G62 37/38 give the pickup window, 08:00 to
14:00 on 5 November. N1 SH is the shipper's dock, with a phone contact.
|
| OID | What's being picked up: the BOL, the PO, 3 pallets, 212.5 pounds. |
| S5 (stop 2) |
Stop 2 is an unload (UL) at Acme's DC, delivery window 07:00 to 15:00 on 7 November (G62
53/54).
|
| L3 | Totals: weight 212.5, the agreed charge 685.00 (implied decimals), 3 pallets. |
A truckload tender can have many stops: several pickups, several drops. Each S5 loop is one stop, numbered in order. Open the 204 in the Segment Explorer.
The 990 response
ST*990*0001~ B1*ODFL*LD-30418*20261026*A~ N9*CN*7741200931~ K1*Pickup confirmed for Nov 5 AM~ SE*5*0001~
ST*990*0001~ B1*ODFL*LD-30419*20261026*D~ K1*No equipment available in*Rockford on requested date~ SE*4*0001~
B1 carries the SCAC, the shipment ID from the 204, the date and the answer: A accept or
D decline. When accepting, the carrier often sends its PRO number (N9*CN), which it will
use on every 214 and 210 for this load. A decline sends the shipper's system to the next carrier in its routing
guide, so a slow 990 can lose the load.
The 214 shipment status
ST*214*0001~ B10*7741200931*LD-30418*ODFL~ L11*BOL-889120*BM~ L11*PO-48213*PO~ N1*SH*North Supply Co*93*NS-RKF~ N3*2200 Harrison Ave~ N4*Rockford*IL*61104*US~ PER*IC*Dock Office*TE*815-555-0142~ N1*CN*Acme Distribution Center*93*DC14~ N3*4100 Industrial Pkwy~ N4*Joliet*IL*60431*US~ LX*1~ AT7*X3*NS***20261105*0842*CT~ MS1*Rockford*IL*US~ MS2*ODFL*TRL5521~ L11*1*QN~ LX*2~ AT7*AF*NS***20261105*0955*CT~ MS1*Rockford*IL*US~ MS2*ODFL*TRL5521~ L11*1*QN~ AT8*G*L*212.5*3~ LX*3~ AT7*X1*NS***20261107*0648*CT~ MS1*Joliet*IL*US~ L11*2*QN~ LX*4~ AT7*D1*NS***20261107*0731*CT~ MS1*Joliet*IL*US~ L11*2*QN~ AT8*G*L*212.5*3~ SE*32*0001~
B10 identifies the load by the carrier's PRO number, the shipper's shipment ID and the SCAC. Each
LX loop is one event:
| AT701 | Event | When and where |
|---|---|---|
| X3 | Arrived at pickup location | 08:42 central time, Rockford, trailer TRL5521 (MS2), stop 1 (L11 QN) |
| AF | Departed pickup location with the shipment | 09:55, with weight and pallet count (AT8) |
| X1 | Arrived at delivery location | 06:48 on 7 November, Joliet, stop 2 |
| D1 | Completed unloading at delivery | 07:31 |
AT702 is the reason: NS normal status. When something goes wrong, the reason code explains it
(weather, missed appointment, refused by consignee), and partners often count late or missing 214s against the
carrier's scorecard. Some partners want one 214 per event, sent within minutes, not one at the end.
The 210 freight invoice
ST*210*0001~ B3**FI-5520193*LD-30418*PP**20261108*90248**20261107*035*ODFL~ C3*USD~ N9*BM*BOL-889120~ N9*PO*PO-48213~ N9*CN*7741200931~ N1*SH*North Supply Co*93*NS-RKF~ N3*2200 Harrison Ave~ N4*Rockford*IL*61104*US~ PER*IC*Dock Office*TE*815-555-0142~ N1*CN*Acme Distribution Center*93*DC14~ N3*4100 Industrial Pkwy~ N4*Joliet*IL*60431*US~ N1*BT*North Supply Co*92*V20931~ N3*PO Box 4410~ N4*Rockford*IL*61110*US~ N7*ODFL*TRL5521*********TV~ LX*1~ L5*1*Steel shelving hardware*70*FC~ L0*1***212.5*G***3*PLT**L~ L1*1*685*FR*68500****400~ L1*1***14248****FUE~ L1*1***7500****LFT~ L3*212.5*G***90248******3*L~ SE*25*0001~
-
B3: freight invoice FI-5520193 for shipment LD-30418, prepaid, billed 8 November, amount due 902.48 (implied decimals), delivered (035) 7 November, carrier ODFL. -
L5andL0: what was carried (freight class 70) and how much: 212.5 pounds on 3 pallets. -
L1lines are the charges: line haul 685.00 at a flat rate (FR), fuel surcharge (FUE) 142.48, liftgate (LFT) 75.00. L3: the total, 902.48. 685.00 + 142.48 + 75.00 = 902.48.
The shipper (or its freight audit service) checks the 210 against the tendered rate in the 204 (685.00) and the agreed accessorial charges. The liftgate charge was not in the tender. If the contract doesn't cover it, it'll be disputed, much like a three-way match on goods. Payment usually comes with an 820.
Things that trip people up
- Which ID is which. The shipper's shipment ID (B204 / B1 / B10), the bill of lading, the PO, and the carrier's PRO number all identify the same load. Map them carefully; partners match on different ones.
- Time zones. AT7 and G62 carry a time code (CT, ET, LT for local). A delivery "at 07:31" means nothing without it.
- Stop numbers. 214s refer to stops by number (L11 QN or a stop-off segment). The numbers must match the 204's S5 order.
-
Tender changes. A 204 change (B2A
04) usually replaces the whole tender. The carrier's system needs to know whether it was already accepted. - EDIFACT and APIs. International freight uses EDIFACT messages such as IFTMIN (instructions) and IFTSTA (status); many carriers now offer APIs for tracking. See X12 vs EDIFACT vs APIs.
Healthcare claims and eligibility
In the US, HIPAA requires healthcare providers, payers and clearinghouses to use specific X12 5010 transactions for claims, payments, eligibility, claim status, authorizations and enrollment. Same grammar as retail EDI, very different documents.
What's different about healthcare EDI
-
The guides are law. Each transaction has a HIPAA implementation guide (a TR3) that every payer must
accept. Its ID goes in GS08 and ST03, such as
005010X222A1. Payers then publish companion guides with their own additions. - Everything is version 5010 (with 6020 and 8020 adopted for some transactions in future rules; your partners will say when).
- The 999, not the 997, acknowledges files, because it reports errors against the implementation guide as well as the standard. See Acknowledgments.
- Files contain protected health information (PHI). Patient names, birth dates, member IDs and diagnoses. They must be encrypted in transit, kept only as long as needed, and never pasted into public tools or emails. The examples here are fictional.
- Clearinghouses sit between most providers and payers: they check claims, convert formats, and route files to hundreds of payers through one connection.
| Set | Guide (GS08/ST03) | From → to | Purpose |
|---|---|---|---|
| 837P | 005010X222A1 | Provider → payer | Professional claim (doctors, clinics) |
| 837I | 005010X223A2 | Provider → payer | Institutional claim (hospitals, facilities) |
| 837D | 005010X224A2 | Provider → payer | Dental claim |
| 835 | 005010X221A1 | Payer → provider | Claim payment and remittance advice |
| 270 / 271 | 005010X279A1 | Provider ↔ payer | Eligibility and benefits inquiry and response |
| 276 / 277 | 005010X212 | Provider ↔ payer | Claim status request and response |
| 277CA | 005010X214 | Payer → provider | Claim acknowledgment: accepted into processing, or rejected |
| 278 | 005010X217 | Provider ↔ payer | Prior authorization and referral |
| 834 | 005010X220A1 | Employer → payer | Benefit enrollment and maintenance |
| 820 | 005010X218 | Employer → payer | Premium payment |
| 999 | 005010X231A1 | Receiver → sender | Implementation acknowledgment |
The claim cycle
In practice most of these pass through a clearinghouse, so the provider's 999 and 277CA may come from the clearinghouse first and from the payer later.
The healthcare HL tree
Healthcare transactions use HL segments just like the 856, with numeric level
codes. In an 837, the tree is: billing provider (20) → subscriber (22, the insured
person) → patient (23, only when the patient is a dependent, not the subscriber). Claims hang under
the lowest level.
Loops in healthcare guides have numbers as well as names: 2000A (billing provider level), 2010AA (billing provider name), 2000B (subscriber), 2300 (claim), 2400 (service line). Payers' rejection messages quote them, so learn to find them in the guide.
The 837P professional claim
ST*837*0001*005010X222A1~ BHT*0019*00*BATCH-20261107-01*20261107*0915*CH~ NM1*41*2*Lakeside Family Clinic*****46*LFC0001~ PER*IC*Billing Office*TE*3125550147~ NM1*40*2*Sample Clearinghouse*****46*CLRHSE01~ HL*1**20*1~ PRV*BI*PXC*207Q00000X~ NM1*85*2*Lakeside Family Clinic*****XX*1234567893~ N3*200 Lake Shore Dr~ N4*Chicago*IL*606110001~ REF*EI*123456789~ HL*2*1*22*0~ SBR*P*18*GRP4410******CI~ NM1*IL*1*Sample*Jane****MI*XYZ123456789~ N3*100 Main St~ N4*Chicago*IL*60601~ DMG*D8*19850412*F~ NM1*PR*2*Example Health Plan*****PI*EHP01~ CLM*PCN-77120*185.00***11>B>1*Y*A*Y*Y~ REF*G1*PA-55301~ HI*ABK>J0690*ABF>R05~ NM1*82*1*Rivera*Ana****XX*1245319599~ PRV*PE*PXC*207Q00000X~ LX*1~ SV1*HC>99213*135.00*UN*1***1>2~ DTP*472*D8*20261103~ REF*6R*L1~ LX*2~ SV1*HC>87880>QW*50.00*UN*1***1~ DTP*472*D8*20261103~ REF*6R*L2~ SE*32*0001~
| BHT |
Beginning of hierarchical transaction: an original (00) claim batch (CH =
chargeable), with its batch number and creation time.
|
| NM1*41 / *40 | The submitter (who built the file) and the receiver (here a clearinghouse). |
| HL 20 + PRV, NM1*85 |
The billing provider: its taxonomy code (specialty), its NPI (XX), address and tax ID
(REF*EI). ZIP codes for billing providers must be nine digits.
|
| HL 22 + SBR |
The subscriber: primary payer (P), the patient is the subscriber (18 = self),
group GRP4410, commercial insurance (CI). HL04 0: no dependent level, so the
subscriber is the patient.
|
| NM1*IL, DMG | The insured person: name, member ID (MI), address, birth date and sex. |
| NM1*PR | The payer, by its payer ID (PI). |
| CLM |
The claim: the provider's claim number PCN-77120, total charge 185.00, place of service
11 (office) as part of a composite, and yes/no flags for signatures and assignment of
benefits.
|
| REF*G1 | A prior authorization number (see the 278 below). |
| HI | Diagnoses: ABK marks the principal ICD-10 code, ABF the others. |
| NM1*82 | The rendering provider: the clinician who saw the patient, with her own NPI. |
| LX / SV1 | Service lines: procedure (CPT 99213, an office visit) and charge 135.00, then a lab test with a modifier. SV107 points at the diagnoses in HI (1 and 2). |
| DTP*472, REF*6R | Date of service, and the provider's own line ID, which comes back in the 835 so payments can be matched to lines. |
The line charges must add up to CLM02: 135.00 + 50.00 = 185.00. A claim where they don't is rejected before anyone looks at it. Open the 837P, or the 837I hospital claim, which uses SV2 with revenue codes instead of SV1.
The 835 payment and remittance
ST*835*0001*005010X221A1~ BPR*I*142.50*C*ACH*CCP*01*071000013*DA*000111222*1123456789**01*071000039*DA*000333444*20261120~ TRN*1*EFT-90012231*1123456789~ N1*PR*Example Health Plan~ N1*PE*Lakeside Family Clinic*XX*1234567893~ LX*1~ CLP*PCN-77120*1*185.00*152.50*20.00*12*EHP26110300417~ NM1*QC*1*Sample*Jane****MI*XYZ123456789~ SVC*HC>99213*135.00*102.50**1~ DTM*472*20261103~ CAS*CO*45*12.50~ CAS*PR*3*20.00~ REF*6R*L1~ SVC*HC>87880>QW*50.00*50.00**1~ DTM*472*20261103~ REF*6R*L2~ PLB*1234567893*20261231*WO>EHP2610OVP*10.00~ SE*18*0001~
| BPR / TRN |
The payment: 142.50 by ACH (BPR01 I means this file is remittance information; the money
moves separately), and its trace number, which matches the bank deposit.
|
| CLP |
Claim PCN-77120, processed as primary (1): charged 185.00, paid 152.50, patient owes 20.00.
The payer's own claim number is EHP26110300417.
|
| SVC (line 1) | 99213: charged 135.00, allowed and paid 102.50. |
| CAS |
Why it wasn't paid in full. CO*45: 12.50 written off under the contract (charge exceeds the
fee schedule). PR*3: 20.00 is the patient's copay.
|
| SVC (line 2) | The lab test, paid in full: 50.00. |
| REF*6R | The line IDs from the 837, so each payment lands on the right line. |
| PLB |
A provider-level adjustment: 10.00 taken back for an earlier overpayment (WO), not tied to
this claim.
|
The arithmetic balances at every level: 135.00 − 12.50 − 20.00 = 102.50 for line 1; 102.50 + 50.00 = 152.50 for
the claim; 152.50 − 10.00 = 142.50 for the payment. CAS group codes are CO contractual,
PR patient responsibility, OA other, PI payer initiated; the reason codes
(45, 3…) are a national list maintained outside X12.
Eligibility: the 270 and 271
HL*3*2*22*0~ TRN*1*TRC-100045*9123456789~ NM1*IL*1*Sample*Jane****MI*XYZ123456789~ DMG*D8*19850412*F~ DTP*291*D8*20261107~ EQ*30~
HL*3*2*22*0~ TRN*2*TRC-100045*9123456789~ NM1*IL*1*Sample*Jane****MI*XYZ123456789~ DTP*346*D8*20260101~ EB*1*IND*30*PR*Gold PPO~ EB*B*IND*98***27*25*****Y~ EB*C*IND*30***23*1500*****Y~ MSG*Deductible met to date 820.00~
The clinic asks whether Jane Sample is covered on 7 November for health benefit plan coverage in general
(EQ*30). The payer answers with EB segments: active coverage (1) for the individual
under the Gold PPO; a 25.00 copay (B) for office visits (service type 98); a 1,500.00
deductible (C) for the calendar year (23). TRN echoes the inquiry's trace number so the
answer can be matched.
Claim status (276/277), authorizations (278) and enrollment (834)
TRN*2*STAT-TRC-1~ STC*F1>65*20261118**185.00*152.50*20261118*ACH*20261120*EFT-90012231~ REF*1K*EHP26110300417~ REF*EJ*PCN-77120~
The STC composite F1>65 says the claim is finalized and paid (category F1, status
code 65 "claim/line has been paid"), followed by the charged and paid amounts, payment method, date and EFT
number. Category codes starting with A are acknowledgments (accepted or rejected on receipt),
P pending, F finalized, E errors in the request.
-
278: the provider asks the payer to approve a service in advance (here a knee arthroscopy, CPT 29881),
with the diagnosis and planned date. The payer's response carries a certification number, which goes on the
claim as
REF*G1. Open the 278. -
834: an employer tells the health plan who's enrolled: one INS loop per member (subscriber
Y, dependentsN), with HD for the coverage and DTP for start dates. Enrollment files are often full replacements sent monthly, with change files in between. Open the 834. - 820 premium payment: the employer pays the plan for those members; see the 820 premium sample.
Every payer accepts the HIPAA guide, but their companion guides add rules: which situational segments they need, how they want secondary claims, what they put in the 835's reference fields. Clearinghouses publish payer lists with these rules. Validate test claims with the clearinghouse or payer before going live, and treat every real file as PHI.
X12 vs EDIFACT vs APIs
X12 and EDIFACT are the two EDI standards: agreed document formats, exchanged as files. APIs are something else: a way for one system to call another directly. Companies often use all three, and it helps to know exactly where each one fits.
One order, three ways
Here is the same two-line purchase order as X12, as EDIFACT, and as the JSON a typical ordering API might accept.
X12 850
ST*850*0001~ BEG*00*SA*PO-48213**20261026~ DTM*002*20261109~ N1*BY**UL*5412345000013~ N1*ST**UL*5412345000020~ PO1*1*24*CA*18.50**EN*4012345678901~ PO1*2*10*EA*42.00**EN*4012345678918~ CTT*2*34~ SE*9*0001~
EDIFACT ORDERS
UNH+1+ORDERS:D:96A:UN' BGM+220+PO-48213+9' DTM+137:20261026:102' DTM+2:20261109:102' NAD+BY+5412345000013::9' NAD+DP+5412345000020::9' LIN+1++4012345678901:EN' QTY+21:24' PRI+AAA:18.50' LIN+2++4012345678918:EN' QTY+21:10' PRI+AAA:42.00' UNS+S' CNT+2:2' UNT+15+1'
JSON for an API
POST /orders
{
"po_number": "PO-48213",
"po_date": "2026-10-26",
"deliver_by": "2026-11-09",
"buyer_gln": "5412345000013",
"ship_to_gln": "5412345000020",
"lines": [
{"gtin": "4012345678901",
"qty": 24, "uom": "case",
"price": "18.50"},
{"gtin": "4012345678918",
"qty": 10, "uom": "each",
"price": "42.00"}
]
}
The business content is identical: who's buying, where it goes, which products, how many, at what price. The differences are in who defines the format, how it's packaged, how it travels, and how errors are reported.
All three are cut down to show the shape. A real EDIFACT ORDERS follows a subset such as EANCOM plus the partner's own guide; a real API's JSON is whatever that one API's documentation says. No two ordering APIs use the same field names.
EDIFACT
UN/EDIFACT is the United Nations standard, used across Europe, Asia, global shipping, and by multinational retailers and automotive companies. The ideas map closely to X12; the names and punctuation differ.
UNA:+.? ' UNB+UNOC:3+5412345000013:14+4012345000009:14+261026:0830+4521' UNH+1+ORDERS:D:96A:UN:EAN008' BGM+220+PO-48213+9' DTM+137:20261026:102' DTM+2:20261109:102' NAD+BY+5412345000013::9' NAD+DP+5412345000020::9' NAD+SU+4012345000009::9' CUX+2:EUR:9' LIN+1++4012345678901:EN' QTY+21:24' PRI+AAA:18.50' LIN+2++4012345678918:EN' QTY+21:10' PRI+AAA:42.00' UNS+S' CNT+2:2' UNT+17+1' UNZ+1+4521'
| UNA |
Service string advice (optional): declares the six special characters. : component separator,
+ element separator, . decimal mark, ? release (escape) character,
a space (reserved), ' segment terminator.
|
| UNB … UNZ | The interchange, like ISA … IEA: syntax UNOC version 3, sender and receiver (GLNs with qualifier 14), date and time, interchange reference 4521. UNZ counts messages and repeats the reference. |
| UNH … UNT |
One message, like ST … SE. ORDERS:D:96A:UN:EAN008 means the ORDERS message from directory
D.96A, in the EANCOM subset. UNT counts the segments (17) and repeats the message reference (1).
|
| BGM | Beginning of message: document type 220 (order), number, function 9 (original). |
| DTM | Dates as qualifier:value:format. 137 is the document date, 2 the delivery date, 102 means CCYYMMDD. |
| NAD | Parties by GLN: buyer (BY), delivery party (DP), supplier (SU). EDIFACT relies on GLNs far more than X12 does. |
| LIN / QTY / PRI | Line items: the GTIN (EN), quantity ordered (21), net price (AAA). |
| UNS+S / CNT | UNS separates the detail from the summary section. CNT gives control totals (here number of lines). |
Escaping, which X12 doesn't have
FTX+DEL+++Use gate 3?: rear entrance' NAD+DP+5412345000020::9++O?'BRIEN LOGISTICS'
The ? releases the next character, so ?: is a literal colon and O?'BRIEN is
O'BRIEN, not the end of the segment. In X12 the same data has to be cleaned of delimiters before sending (see
delimiters).
X12 and EDIFACT side by side
| Concept | X12 | EDIFACT |
|---|---|---|
| Interchange envelope | ISA / IEA | UNB / UNZ |
| Group envelope | GS / GE | UNG / UNE (rarely used) |
| Document envelope | ST / SE | UNH / UNT |
| Purchase order | 850 | ORDERS |
| Order response | 855 | ORDRSP |
| Order change | 860 | ORDCHG |
| Ship notice | 856 | DESADV |
| Invoice | 810 | INVOIC |
| Remittance advice | 820 | REMADV |
| Inventory report | 846 | INVRPT |
| Sales report | 852 | SLSRPT |
| Delivery forecast / schedule | 830 / 862 | DELFOR / DELJIT |
| Transport instruction / status | 204 / 214 | IFTMIN / IFTSTA |
| Syntax acknowledgment | 997 / 999 | CONTRL |
| Application error report | 824 | APERAK |
| Version naming | 004010, 005010 | Directories D.96A, D.01B, D.21A |
| Common subsets | VICS (retail), HIPAA guides | EANCOM (retail), Odette (automotive) |
| Escape character | None | ? |
APIs: a different thing, not a way to send EDI
An API (application programming interface) lets one program call another directly: "create this order", "give me the status of that shipment". Most modern APIs use JSON over HTTPS, with a key or token to say who's calling, and answer immediately with a success or an error.
EDI is a document standard. An API is an integration style. They solve overlapping problems in different ways:
| EDI (X12, EDIFACT) | API | |
|---|---|---|
| Who defines the format | Standards bodies, then narrowed by each partner's guide | Each API's owner, in its own documentation |
| What moves | Documents in batches: files with envelopes and control numbers | Individual requests and responses, usually one record at a time |
| Timing | Batch: minutes to hours, on a schedule | Real time: seconds |
| How it travels | AS2, SFTP, VAN, OFTP2 (see Moving the files) | HTTPS calls to the API's address |
| Proof and errors | MDN, then 997/999, then business responses (855, 824) | The HTTP status and error message in the response |
| Onboarding a new partner | Same standard document, partner-specific guide | A new API to learn for each partner |
| Strong at | High volume, many partners, a shared vocabulary across an industry, audit trails | Lookups and live updates: stock, rates, tracking, order status |
It's tempting to list "API" next to AS2 and SFTP as a way to send EDI. It isn't one: an API exchanges its own requests, in its own format. When a company says it "does EDI by API", it means one of the cases below, and it's worth asking which.
Where EDI and APIs meet
- Your own systems talk to your EDI through an API. Instead of building X12 yourself, your application sends JSON to a translator's API, which builds the 850 or 810, adds the envelopes and sends the file by the partner's transport. The JSON-to-EDI API on this site works this way: JSON in, X12 out, and received X12 back as JSON. The partner still receives a normal EDI file.
- A partner offers both. Many marketplaces, carriers and 3PLs offer an API alongside EDI. You choose one for each document: for example, EDI for orders and invoices, the API for real-time tracking.
- A platform hides EDI behind an API. Integration platforms let you send and receive EDI documents as JSON calls; they handle the EDI side. The trading partner still sees EDI.
- APIs replace a document. Some flows move from EDI to API entirely, like parcel tracking or shipping-rate lookups. Partners still exchange the documents that need an audit trail (orders, invoices) by EDI.
Other formats you'll hear about
- XML and flat files. Some partners exchange their own XML or CSV layouts by SFTP. These are agreed formats, not EDI standards, but they're handled with the same tools.
- Healthcare: HL7 v2 and FHIR (an API standard) move clinical data; X12 remains the standard for claims and payments.
- Banking: ISO 20022 XML messages are replacing many bank formats; X12 820s and EDIFACT PAYMUL still appear in corporate payments.
Which one will you use?
Rarely your choice alone: your partners decide most of it.
- North American retail, distribution, transport, healthcare: X12, often 004010 or 005010, plus partner APIs for some real-time needs.
- European and international trade, automotive, ocean freight: EDIFACT, often in EANCOM or Odette subsets.
- Global companies often run both: X12 with US partners, EDIFACT with European ones, and the same internal data behind both. A translator maps each to the same back-office fields; see Mapping.
- New, smaller partners may offer only an API or a web portal. That's fine: it's a different integration, not a different kind of EDI.
Moving the files
The standard decides what a file says. The transport decides how it gets from your system to your partner's, and what proof you get that it arrived. Most connections use one of four methods.
The main methods
| Method | How it works | Proof of delivery | Typical use |
|---|---|---|---|
| AS2 | Direct, point to point over HTTPS. Each file is signed and encrypted with certificates. | A signed receipt (MDN) for every file | Large retailers and manufacturers, high volume |
| SFTP | Files are put in, and picked up from, folders on an SSH server run by one of the partners. | None built in: rely on the 997/999 | 3PLs, carriers, banks, healthcare clearinghouses, smaller partners |
| VAN | A value-added network: a mailbox service that receives your files and delivers them to each partner's mailbox, even on another VAN. | VAN tracking reports, then 997s | Many partners through one connection |
| OFTP2 | Odette File Transfer Protocol over the internet, with certificates and signed receipts. | Signed end-to-end response (EERP) | European automotive |
| Web EDI / portal | The partner's website: key in or upload documents, download orders. | What the portal shows | Very small suppliers with few orders |
An API isn't on this list on purpose. APIs exchange their own requests and responses, not EDI files, so they're a different kind of integration rather than a way to deliver an 850.
AS2 and the MDN
AS2 sends each file as an HTTPS request to the partner's AS2 address (a URL). The sender signs the file with its private key and encrypts it with the receiver's public certificate. The receiver decrypts it, checks the signature, and returns a Message Disposition Notification (MDN): a receipt, itself signed, that includes a hash (a fingerprint) of exactly what it received.
Original-Message-ID: <LUNAR-20261026-083012-4521@northsupply.example> Final-Recipient: rfc822; ACMEBUYER Disposition: automatic-action/MDN-sent-automatically; processed Received-Content-MIC: 4ZrX6J0n2m4R0x8yYpG3qkQf1vU=, sha-256
-
processed means the file was received, decrypted and the signature checked.
processed/error: decryption-failedorauthentication-failedmeans it wasn't. - Received-Content-MIC is the hash. The sender compares it with its own hash of what it sent: if they match, neither side can later claim the file was different. That's called non-repudiation.
- An MDN can come back on the same connection (synchronous) or later in a separate call (asynchronous). Partners choose one; a mismatch means files go through but receipts never arrive.
AS2 certificates usually last one to three years. On the day one expires, files stop going through, with nothing wrong in the EDI itself. Keep a list of every partner's certificate and your own, with expiry dates, and exchange new ones weeks ahead. Most partners need time to load a new certificate.
An MDN proves delivery only. A file can get a clean MDN and still be rejected by the 997 because a segment count is wrong; see Acknowledgments.
SFTP
One partner runs an SFTP server; the other logs in with a user name and an SSH key (or password) and puts files into an inbound folder or collects them from an outbound folder.
-
Folders and names. Agree which folder is which, and how files are named. A common pattern:
SENDERID_RECEIVERID_850_000004521.edi. Partners often pick up anything in the folder, so never write a file there half-finished: upload under a temporary name and rename it when complete. - Polling. Each side checks for new files on a schedule, every few minutes. Agree whether files are deleted or moved after pickup.
- Encryption of the file. SFTP encrypts the connection, but some partners also want the file itself encrypted with PGP, so it stays protected while it sits on the server. Common in banking and healthcare.
- No receipt. Nothing tells you the partner picked the file up and read it, except the 997 or 999. Watch for missing acknowledgments.
VANs
With a VAN, you send everything to your own mailbox. The VAN reads the receiver in the ISA (ISA07 and ISA08) and delivers the file to that partner's mailbox, even if the partner uses a different VAN: VANs connect to each other ("interconnects").
- The ISA must be exactly right. A wrong qualifier or ID means the file is undeliverable, and may sit in an error queue until someone notices. See choosing and agreeing IDs.
- Billing by volume. VANs traditionally charge per document or per kilocharacter (thousand characters). Large 846 or 852 files can be expensive.
- Tracking. VAN reports show when a file was delivered to the partner's mailbox and when they picked it up.
- One connection, many partners. That convenience is why VANs persist, especially for companies with hundreds of small partners.
Setting up a connection
Partners exchange a connection profile before the first test file. For AS2, that's typically:
| Item | Example |
|---|---|
| AS2 identifier | NORTHSUPPLY / ACMEBUYER (often the same as the ISA ID, but not always) |
| URL | The HTTPS address that receives files, separate for test and production |
| Certificates | Public certificates for signing and encryption, with expiry dates |
| Algorithms | Signing (SHA-256) and encryption (AES-256) |
| MDN | Signed or unsigned, synchronous or asynchronous, and where async MDNs go |
| Network | IP addresses to allow through each side's firewall |
For SFTP: host, port, user, key, folder names and file naming. For a VAN: the VAN's name and your partner's ISA qualifier and ID. Then send a test file and confirm each step: delivered, MDN back, 997 back.
Troubleshoot from the bottom up
When "the partner didn't get it", work through the layers in order. Each has its own proof:
- Did it leave? Your translator's or AS2 software's send log.
- Did it arrive? The MDN (AS2), the VAN delivery report, or the file on the SFTP server.
- Was the envelope accepted? A TA1, if requested, or the absence of an envelope rejection.
- Could it be read? The 997 or 999.
- Was it accepted by the business? The 855, 824, or the partner's portal.
Most time is lost looking at the EDI content when the problem is a certificate, a firewall or a wrong ISA ID. Troubleshooting works through real cases.
Acknowledgments
Every file you send should come back with an answer. Different answers prove different things: that the file arrived, that its envelope was readable, that its syntax was valid, and that the business accepted it. Knowing which is which saves hours on partner calls.
Four questions, four answers
| Question | Answered by | Checks |
|---|---|---|
| Did the file arrive? | MDN (AS2), VAN report, EERP (OFTP2) | Delivery only. See AS2 and the MDN. |
| Was the envelope readable? | TA1 |
The ISA and IEA: IDs, dates, control numbers. |
| Was the syntax valid? | 997 or 999 |
Each group and transaction set against the standard (997) or an implementation guide (999). |
| Did the business accept it? | 855, 824, 864, 277CA, a portal |
Prices, items, locations, member IDs: whether the content makes sense. |
A file can pass every layer but the last. A purchase order with a perfect 997 can still be rejected because an item number doesn't exist. Equally, a 997 rejection means the business never saw the document, however correct its prices were.
The TA1 interchange acknowledgment
The sender asks for a TA1 by setting ISA14 to 1. The receiver answers about the envelope only, before
reading anything inside it. Many partners never request one; some send a TA1 only when they reject an interchange.
TA1*000004521*261026*0830*A*000~
TA1*000004522*261026*0915*R*006~
| TA101–103 | Which interchange this answers: its control number (ISA13), date and time. |
| TA104 | A accepted, E accepted with errors, R rejected. |
| TA105 |
A note code. 000 no error; 001 control numbers in ISA and IEA don't match;
006 invalid sender ID; 008 invalid receiver ID; 022 invalid control
structure.
|
A TA1 sits directly inside its own ISA/IEA, with no GS or ST. A rejection with 006 or
008 almost always means the IDs in ISA05–ISA08 don't match the partner's setup; see
choosing and agreeing IDs.
The 997 functional acknowledgment
The 997 is the usual answer in retail, distribution, warehousing and transportation. It answers one functional group (one GS/GE) and reports on each transaction set inside it.
ST*997*0001~ AK1*PO*4521~ AK2*850*0001~ AK5*A~ AK9*A*1*1*1~ SE*6*0001~
| AK1 | The group being answered: its functional ID (GS01 PO) and control number (GS06 4521). |
| AK2 | One transaction set in that group: type 850, control number ST02 0001. |
| AK5 |
The result for that set: A accepted, E accepted with errors,
R rejected.
|
| AK9 | The result for the whole group, then three counts: sets in the group (1), sets received (1), sets accepted (1). |
Now a rejection. The partner sent an 850 whose first line item had a unit of measure that isn't a valid code:
ST*997*0001~ AK1*PO*4522~ AK2*850*0001~ AK3*PO1*7**8~ AK4*3*355*7*ZZ~ AK5*R*5~ AK9*R*1*1*0~ SE*8*0001~
| AK3 |
The segment in error: PO1, the 7th segment of the set (ST is 1), no loop ID, error code
8: segment has data element errors.
|
| AK4 |
The element in error: position 3 (PO103), data element number 355 (unit of measure code), error
7: invalid code value. AK404 copies the bad value, ZZ.
|
| AK5*R*5 | Set rejected, reason 5: one or more segments in error. |
| AK9*R*1*1*0 | Group rejected: one set sent, one received, none accepted. |
Error codes you'll see most
| Where | Code | Meaning |
|---|---|---|
| AK304 | 1 | Unrecognized segment ID |
| AK304 | 2 | Unexpected segment (valid, but not here) |
| AK304 | 3 | Mandatory segment missing |
| AK304 | 7 | Segment not in proper sequence |
| AK403 | 1 | Mandatory data element missing |
| AK403 | 4 / 5 | Data element too short / too long |
| AK403 | 7 | Invalid code value |
| AK403 | 8 | Invalid date |
| AK502 | 3 | ST and SE control numbers don't match |
| AK502 | 4 | Segment count in SE01 is wrong |
| AK901 | P | Partially accepted: at least one set in the group was rejected |
Counting segment positions for AK302 starts at ST = 1, not at the ISA. When a partner says "segment 7", count from the ST. Open the 997 sample in the Segment Explorer.
The 999 implementation acknowledgment
Healthcare (HIPAA 5010) uses the 999 instead of the 997. It works the same way, but it also checks the transaction against the implementation guide named in ST03 and GS08, so it can report things the standard allows but the guide doesn't, such as a segment the guide marks "not used".
ST*999*0001*005010X231A1~ AK1*HC*1001*005010X222A1~ AK2*837*0001*005010X222A1~ IK3*NM1*22*2010BA*8~ IK4*9*67*1~ IK5*R*5~ AK9*R*1*1*0~ SE*8*0001~
| ST03 / AK103 / AK203 | The guide versions: 005010X231A1 for the 999 itself, 005010X222A1 (professional claims) for what it's answering. |
| IK3 |
Like AK3: segment NM1 at position 22, in loop 2010BA (the subscriber name), with
element errors.
|
| IK4 |
Like AK4: NM109, element 67 (identification code), error 1: required element missing. The
member ID wasn't sent.
|
| IK5 | Like AK5: rejected, one or more segments in error. |
The 999 adds codes starting with I for guide rules, for example IK304 I4 (a segment the
guide says not to use is present) and IK403 I6 (a code the standard allows but the guide doesn't). A
999 may also include CTX segments that say which claim or business unit the error belongs to.
After the 999, a healthcare clearinghouse or payer usually sends a 277CA (claim acknowledgment) saying which individual claims were accepted into its system and which were rejected for business reasons. See claim status. Open the 999 sample.
Business acknowledgments
Once a document passes the syntax check, the receiver's application decides whether it accepts the content. Those answers are documents in their own right:
- 855: the supplier accepts, changes or rejects each line of a purchase order.
- 824 application advice: used by many retailers to reject invoices or ASNs, quoting the reference number and a reason in free text or codes.
- 864 text message: a free-text notice, sometimes used for rejections by partners that don't support the 824.
- 990: a carrier's acceptance or decline of a load tender.
- 277CA in healthcare, as above.
ST*824*0001~ BGN*00*RJ-88120*20261110~ N1*SU*North Supply Co*92*V20931~ OTI*TR*IV*INV-7731~ REF*PO*PO-48213~ TED*ZZZ*Invoice total does not match line items~ SE*7*0001~
OTI*TR marks the document as rejected (TR) and identifies it as invoice INV-7731.
TED gives the error. Many retailers send these from a portal instead; either way, a rejected invoice
isn't in the payment queue, so read them daily.
Timing and rules
- When. Partner guides usually require a 997 within hours, often 24 at most. Some require one within minutes for ASNs.
- Never acknowledge an acknowledgment. Nobody sends a 997 for a 997 or a TA1.
- One 997 per group. A group with 50 invoices gets one 997 with 50 AK2/AK5 pairs. Some partners only want the AK1/AK9 summary, without AK2s, when everything is accepted.
- Which version. Answer in the version the partner sent (GS08), unless the guide says otherwise.
-
Accepted with errors.
Emeans the receiver processed the document despite problems. It isn't a pass: read the AK3/AK4 and fix the map before the partner stops tolerating it.
Reconciling: the missing 997
The most common acknowledgment problem is a 997 that never arrives. Keep a record of every group you send, keyed by partner and GS06, and match each incoming 997's AK1 to it.
| Sent | Partner | Type | GS06 | 997 | Status |
|---|---|---|---|---|---|
| Nov 9 08:02 | Acme | 856 | 4588 | Nov 9 08:11 | Accepted |
| Nov 9 08:30 | Acme | 810 | 4589 | Nov 9 08:44 | Rejected, AK5 4 |
| Nov 9 09:15 | Riverbend | 940 | 4590 | — | Overdue: check transport |
Set an alert for anything without an answer after the agreed time. A missing 997 usually means the file never arrived (go back to the transport layers), or arrived with an envelope so broken the partner's system couldn't route it. Troubleshooting covers both.
Troubleshooting rejected files
Most EDI problems fall into a handful of patterns. A steady method finds them faster than reading the file from the top: work out which layer failed, find the exact segment, compare it with the partner's guide, then fix the cause, not just the file.
A method that works
- Find the layer. Did the file leave, arrive, pass the envelope, pass syntax, pass the business? The transport layers and the four acknowledgments tell you where to look.
- Get the exact file. The one the partner received, from your send log or the partner, not one regenerated from your system later. Note its ISA13, GS06 and ST02.
- Find the exact place. Use the AK3/AK4 (or IK3/IK4) position, the 824 text, or the partner's portal message. Count segment positions from the ST.
- Compare with the guide. The partner's guide, not the standard, decides what's right. Check the requirement, the code list and the length.
- Fix the cause. A wrong value is usually a map rule, a missing cross-reference (item, location, unit) or bad source data. Fix that, then resend.
- Resend correctly. New control numbers unless the partner asks for the same ones. Tell the partner it's a resend so they don't process a duplicate.
Worked cases
Each case is a real pattern with fictional data. The fixes are typical; your partner's guide and your own system decide the details.
Case 1: "Number of included segments does not match"
Acme's 997 rejects an 850 with AK5*R*4. Code 4 means SE01 doesn't equal the number of segments from
ST to SE.
PO1*3*10*CA*41.00*PE*UP*012345678929~ CTT*2*94~ SE*10*0002~
Count from ST (1) to SE (included): this set has 9 segments, not 10. SE02 0002 also doesn't match ST02 0001, and CTT01 says 2 lines when there are 3. All three come from a map that builds the trailer before the last line is added, or a counter that isn't reset between sets. Open this file in the Segment Explorer and let the checks find all four mistakes, including the GE.
Case 2: the invoice that doesn't add up
The 997 for an 810 comes back accepted, but a week later an 824 rejects it: "Invoice total does not match line items."
IT1*1*24*CA*18.50*PE*UP*012345678905~ IT1*2*10*EA*42.00*PE*UP*012345678912~ TDS*90400~
24 × 18.50 = 444.00 and 10 × 42.00 = 420.00, so the lines total 864.00. TDS01 has implied decimals, so 90400 means
904.00: 40.00 too much. The 40.00 was a freight charge in the ERP that the map added to the total but didn't send
as a SAC segment. Fix: send the charge as SAC*C*D240***4000 (or drop it from the total
if the contract says freight is free). The 997 couldn't catch this: the syntax was fine.
Open it in the Segment Explorer.
Case 3: the ASN with a bad carton label
The retailer's receiving dock scans cartons that don't match any ASN, and charges back for an "inaccurate ASN".
HL*3*2*P*1~ MAN*GM*00012345678901234~
An SSCC-18 has 18 digits; this has 17. The label printer and the ASN were fed from different fields, and a leading zero was lost when one was stored as a number. Fix the source field to text and compare a printed label with the ASN before the next shipment. See carton labels and open the file.
Case 4: files stopped arriving overnight
No 850s since midnight; the partner says they're sending. There's no MDN and no 997 in either direction, so the
problem is below the EDI. The AS2 log shows authentication-failed: the partner's signing certificate
was renewed and the new one never loaded. Fix: load the new certificate, ask the partner to resend. Prevent it
with a certificate expiry list (see AS2).
Case 5: "Invalid interchange receiver ID"
A new partner returns TA1*000004610*261103*1012*R*008~. Code 008 means the ISA receiver ID isn't one
they recognise. Your ISA had ZZ and ACME, but their guide says 01 and their
9-digit DUNS number for production, and a different ID for test. Fix the partner profile, not the map. See
the ISA.
Case 6: a delimiter inside the data
A 997 rejects an 850 with "too many data elements" on a PID segment. The product description was
12*24 in shelf: the * in the text was read as an element separator, so everything after
it moved one position. Fix: remove or replace delimiter characters in text fields in the map (or agree different
delimiters). The same happens with ~ or the component separator. See
delimiters.
Case 7: a duplicate
The partner's system rejects an interchange as a duplicate. The send job was restarted after a server patch and reused control number 000004588. Partners keep a history of control numbers per sender; a repeat is either skipped or rejected. Fix: control numbers must come from one counter that survives restarts. See control numbers.
Case 8: the date nobody could read
An 856 is rejected with AK4*2*373*8: invalid date in DTM02. The map sent 261109 (YYMMDD)
in a version where the date is 8 digits, CCYYMMDD. A version change (004010 to 005010, or a new partner) is when
this usually appears. Fix the date format in the map for that version.
Common patterns at a glance
| Symptom | Usual cause | Where to look |
|---|---|---|
| No MDN, no 997 | Certificate, URL, firewall, SFTP folder | Transport logs |
| TA1 rejected | ISA IDs or qualifiers, test vs production flag | Partner profile |
| 997 AK5 3 or 4 | Trailer built wrong | Map's counters |
| 997 AK4 code 7 | Code not in partner's list (unit, qualifier) | Cross-reference tables |
| 997 AK4 code 1 | Source data blank | ERP record |
| 997 accepted, then 824 or chargeback | Business rule: totals, items, locations, timing | Partner guide and ERP |
| Everything accepted, nobody received goods | Wrong ship-to location code | Location cross-reference |
Preventing the next one
- Validate before sending. Check counts, required elements and code lists against the partner's guide in your translator, so errors stop at your side. The Workbench and the API both check counts and envelopes.
- Monitor what's missing. Overdue 997s, 855s and 945s are early warnings; see reconciling.
- Keep the files. Archive every inbound and outbound file with its control numbers for as long as your contracts and the law require. You'll need the exact file in every dispute.
- Write it down. Each fix belongs in the partner's notes, so the next person doesn't solve it again.
The Segment Explorer has three files with mistakes under "Find the mistakes". Load each one, read the checks, and click the failing elements to see what the standard expects.
Mapping and testing a new partner
Bringing on a trading partner ("onboarding") follows the same steps every time: read their guide, decide where each element comes from in your system, build and test the map, connect, and go live carefully. This module walks through it with North Supply adding Acme as a customer.
What a map is
A map is a set of rules that turns your system's data into a partner's EDI (outbound) or a partner's EDI into your data (inbound). Each rule says where one element's value comes from, or where it goes, and how it changes on the way.
{
"line": 1,
"qty": 24,
"uom": "CS",
"unitPrice": 18.5,
"upc": "012345678905",
"sku": "NS-1180"
}
PO1*1*24*CA*18.50*PE*UP*012345678905*VN*NS-1180~
Even this one line has four rules: the line number and quantity copy across; the unit CS becomes
Acme's CA through a cross-reference table; the price is formatted with two decimals; and the
identifiers get qualifiers (UP for the UPC, VN for the vendor's number) in the order
Acme's guide asks for.
The mapping specification
Before building, write the rules down as a table: one row per element the partner uses. It's the document both sides check during testing, and the one the next person will read. Here's part of the specification on Acme's side, for the 850s it sends to North Supply:
| Element | Req. | Source | Rule |
|---|---|---|---|
| BEG01 | M | constant | 00 (original) |
| BEG02 | M | order.type | SA stand-alone; DS if order.dropShip |
| BEG03 | M | order.poNumber | As is, max 22 characters |
| BEG05 | M | order.date | CCYYMMDD |
| N104 (ST) | M | shipTo.id | Cross-reference to Acme location code (DC14) |
| PO103 | M | line.uom | Cross-reference: CS→CA, EA→EA, PK→PK |
| PO104 | M | line.unitPrice | Two decimals, no thousands separator |
| PO107 | M | line.upc | 12 digits, keep leading zeros |
| CTT01 | M | calculated | Number of PO1 segments |
The "Req." column is the partner's requirement from their guide, which can be stricter than the standard. Collect every code list the partner uses (units, qualifiers, location codes) and decide where each lives in your system.
Spec Exchange lets two partners share a guide and agree on each element in one place, instead of emailing PDFs and spreadsheets back and forth.
Cross-references: the part that breaks
Most go-live problems aren't in the map's logic but in its lookup tables. Plan for these from the start:
- Items. The partner orders by UPC or their own item number; your system knows your SKU. Every item they can order needs a match, and new items need adding before the first order.
- Locations. Ship-to and bill-to codes (DC14, a GLN, a store number) mapped to your customer addresses.
- Units of measure. CA vs CS, EA vs PC. Also the pack size: is a "case" 12 or 24?
- Partner IDs. ISA and GS IDs, test and production.
- Codes inside the partner's guide. Reason codes, payment terms, carrier codes.
Decide what happens when a lookup fails: stop the document and alert someone, or send it with a default? For inbound orders, stopping is usually safer: an order to the wrong address costs more than a delayed one.
Testing
Testing goes in stages, each with its own proof. Test files carry T in ISA15 and usually go to
separate test IDs or URLs.
| Stage | What you prove | Passes when |
|---|---|---|
| Connectivity | Files can travel both ways | A test file arrives and an MDN or 997 comes back |
| Syntax | Your files meet the standard and the guide | Partner's 997/999 accepted, no AK3/AK4 |
| Content | Values are right, not just valid | Partner reviews each test document against the scenario |
| Scenarios | The unusual cases work | Changes, cancellations, partial shipments, backorders, multiple ship-tos all pass |
| Inbound | You process their files correctly | Their test orders create the right orders in your system |
Use the partner's real scenarios, not just the simplest order. Retailers often give a test script: "send an ASN for PO 1 with two cartons, one of them mixed". Build test files quickly with the Workbench or the API, and check them in the Segment Explorer.
Go-live checklist
- Partner has signed off each document type in testing.
- Production IDs, URLs, certificates and folders are set up, and ISA15 is
P. - Control numbers for production start fresh, or continue as agreed.
- Cross-reference tables are complete for every item and location in use.
- Monitoring is on: overdue 997s, failed lookups, rejected documents.
- A start date is agreed, and whether paper or email orders stop that day or run in parallel.
- Someone checks every document by hand for the first days, against what the partner sees.
- Contacts on both sides know whom to call.
Many partners go live with one location or a few items first. If something's wrong, it affects a handful of orders, not the whole business.
After go-live
Maps change. Partners publish new guide versions, move to a new X12 version, add requirements (a new reference number, a stricter ASN timing), or change VANs. Keep each partner's guide version with the map built from it, test every change in the test environment first, and keep the mapping specification up to date. That table is what makes the next change a day's work instead of a week's.
How EDI connects to your systems
An EDI file is only useful once it's in the system that does the work: the ERP that books the order, the warehouse system that picks it, the transportation system that ships it, the accounting system that bills it. This module follows one order through those systems and shows how each one is connected.
The systems involved
| System | What it does | EDI it usually sends or receives |
|---|---|---|
| ERP (enterprise resource planning) | The company's core records: customers, items, prices, orders, inventory value, invoices, payments. | 850, 855, 860, 810, 820, 846, 832, 830 |
| OMS (order management system) | Takes orders from every channel (EDI, website, marketplaces) and decides where each is fulfilled. Sometimes part of the ERP. | 850, 855, 860, 856 |
| WMS (warehouse management system) | Runs the warehouse: receiving, put-away, picking, packing, labels, counts. | 940, 945, 943, 944, 947, 856 |
| TMS (transportation management system) | Plans and books freight: picks carriers, tenders loads, tracks them, audits freight bills. | 204, 990, 214, 210 |
| Accounting / AP and AR | Pays suppliers and collects from customers. Often part of the ERP, sometimes a separate tool. | 810, 820, 812, 824 |
| Translator | Converts between EDI and each system's own format, checks the files, and keeps the partner settings. See Translators and integration platforms. | All of them |
| Communications | Sends and receives the files: AS2, SFTP, VAN. Often built into the translator. See Moving the files. | All of them |
Healthcare has its own versions: a practice management or hospital billing system plays the ERP's role, and a clearinghouse handles much of the translation and connectivity. See EDI in healthcare.
One order through every system
North Supply sells to Acme, stores its goods at Riverbend 3PL, and ships with ODFL. Here's PO-48213 from start to finish, showing which system does what:
- Acme's ERP creates the order. Acme's translator turns it into an 850 and sends it by AS2.
- North Supply's translator receives it, returns a 997, and converts the 850 into the format North Supply's ERP imports (JSON, XML, CSV or database rows).
- North Supply's ERP creates a sales order, checks stock and price, and the translator sends Acme an 855.
- The ERP sends the order to Riverbend's WMS as a 940 (through both translators).
- North Supply's TMS (or the WMS) books the freight: a 204 to ODFL, which answers with a 990.
- The WMS picks, packs and labels, then sends a 945. North Supply's ERP turns that into an 856 for Acme.
- ODFL's system sends 214 status updates to the TMS, and later a 210 freight bill.
- North Supply's ERP invoices Acme with an 810. Acme's AP system matches it to the order and receipt, pays, and sends an 820.
That's eight systems in three companies, plus a carrier, and every handoff is a map. When something goes wrong, the first question is always "which handoff?"
How a translator talks to a business system
The EDI side is standard. The other side, where the translator meets your ERP, WMS or TMS, depends on what that system offers. There are five common ways:
| Pattern | How it works | Good for | Watch for |
|---|---|---|---|
| Files in folders | The translator writes a file (CSV, XML, JSON, fixed-width) to a folder; the system imports it on a schedule. Outbound works the other way. | Older systems, simple setups | Half-written files, files imported twice, nobody noticing a stuck folder |
| Staging tables | The translator writes rows to database tables; a job in the system picks them up and marks them done. | On-premises ERPs with database access | Direct database access is fragile across upgrades |
| API calls | The translator or an integration platform calls the system's API: "create sales order", "get shipments since". | Cloud ERPs, WMSs and TMSs | Rate limits, authentication expiry, partial failures |
| Built-in EDI module | The ERP or WMS has EDI support built in, or a certified connector from the EDI provider. | Common partners and standard documents | Limits on custom partner rules |
| Message queue / events | Systems publish events ("order shipped") to a queue; the integration layer listens and builds the EDI. | Large companies, near-real-time needs | More moving parts to monitor |
The JSON, XML and flat files these patterns carry are covered in Data formats; APIs in APIs, webhooks and events.
Connecting an ERP
The ERP holds the master data every EDI document refers to. Most integration problems trace back to it:
- Customer and partner records need the partner's IDs: ISA ID, location codes (DC14), vendor number (V20931).
- Items need the partner's item numbers or GTINs, units of measure and pack sizes. See cross-references.
- Orders need fields for the partner's PO number, requested dates and any reference the partner wants echoed back on the ASN and invoice.
- Order types: a drop-ship order or a blanket release may need different handling in the ERP.
Large ERPs usually have their own integration formats (SAP has IDocs, for example; many cloud ERPs have REST APIs and import templates). The translator maps EDI to those, not to the database directly.
Connecting a WMS
A WMS needs orders to pick and returns confirmations. The usual connection:
order_no,client,ship_to_code,ship_to_name,line,sku,qty,uom,carrier,ship_by SO-77031,NORTHSUPPLY,DC14,Acme Distribution Center,1,NS-1180,36,CA,ODFL,2026-11-09 SO-77031,NORTHSUPPLY,DC14,Acme Distribution Center,2,NS-2210,10,EA,ODFL,2026-11-09
- Inbound to the WMS: 940s (or orders straight from the ERP), 943 advance notices, item master updates.
- Outbound from the WMS: shipment confirmations (945), receipts (944), adjustments (947), inventory snapshots (846), and often the carton data for the 856.
- Labels: the WMS prints the carton labels, so it should also supply the SSCCs for the ASN. See carton labels.
- Multi-client: a 3PL's WMS needs the client ID on every record. See EDI in warehousing.
Connecting a TMS
A shipper's or broker's TMS sends tenders and receives answers, status and bills. A carrier's TMS (or dispatch system) does the reverse.
- Shipments in: from the ERP or WMS (orders ready to ship, weights, pallet counts).
- Tenders out, answers in: 204 and 990, often with a timer: no answer in time and the TMS moves to the next carrier.
- Status in: 214s update shipment tracking, and the TMS may pass status on to the customer, in a 214 or an API.
- Bills in: 210s are audited against the rates in the TMS before payment.
- APIs alongside EDI: many TMSs connect to carriers by API for rates, tracking and parcel labels, and by EDI for truckload tenders and invoices. See APIs.
Running it day to day
- One place to see every document. Most translators have a tracking screen: what came in, what went out, what failed, which acknowledgments are missing.
- Errors need an owner. A failed import into the ERP isn't an EDI error, but someone has to see it. Decide who watches which queue.
- Keep master data clean. A new item or ship-to location added in the ERP but not in the cross-reference is the most common Monday-morning failure.
- Change control. An ERP upgrade or a new WMS release can change an import format. Test the maps whenever either side changes.
Which system sends which document depends on your software and how it's set up. Some companies send the 856 from the WMS, others from the ERP; some have no TMS at all. Draw your own flow before changing anything.
JSON, XML, CSV and flat files
EDI is how companies talk to each other. Inside a company, and between a translator and a business system, data usually travels in other formats. This module shows the same order in each of them, and what goes wrong when converting between them.
The order we'll convert
Two lines of Acme's purchase order, in X12 (the envelope is left out):
ST*850*0001~ BEG*00*SA*PO-48213**20261026~ DTM*002*20261109~ N1*ST*Acme Distribution Center*92*DC14~ PO1*1*24*CA*18.50*PE*UP*012345678905~ PO1*2*10*EA*42.00*PE*UP*012345678912~ CTT*2~ SE*8*0001~
Everything is positional: you know 24 is the quantity only because it's the second element of PO1. The other formats name each value instead.
JSON
JavaScript Object Notation: names and values, with objects in braces and lists in brackets. It's what most modern APIs and cloud systems use.
{
"poNumber": "PO-48213",
"orderDate": "2026-10-26",
"requestedDelivery": "2026-11-09",
"shipTo": { "code": "DC14", "name": "Acme Distribution Center" },
"lines": [
{ "line": 1, "qty": 24, "uom": "CA", "unitPrice": 18.50, "upc": "012345678905" },
{ "line": 2, "qty": 10, "uom": "EA", "unitPrice": 42.00, "upc": "012345678912" }
]
}
- Easy to read and write in every programming language, and the natural format for APIs.
- Types: strings in quotes, numbers without. Keep IDs like UPCs as strings, or leading zeros disappear.
- No fixed field names. Every system invents its own ("poNumber", "po_no", "customerPO"), so a map is still needed. A JSON Schema can describe and validate the expected shape.
- The JSON-to-EDI API takes JSON like this and returns the X12, envelopes and counts included.
XML
Extensible Markup Language: named tags that open and close, with attributes. Older than JSON, more verbose, and still common in enterprise systems, e-invoicing and some industries.
<PurchaseOrder number="PO-48213" date="2026-10-26">
<RequestedDelivery>2026-11-09</RequestedDelivery>
<ShipTo code="DC14">Acme Distribution Center</ShipTo>
<Line number="1">
<Quantity uom="CA">24</Quantity>
<UnitPrice>18.50</UnitPrice>
<UPC>012345678905</UPC>
</Line>
<Line number="2">
<Quantity uom="EA">10</Quantity>
<UnitPrice>42.00</UnitPrice>
<UPC>012345678912</UPC>
</Line>
</PurchaseOrder>
- Schemas (XSD) define exactly which tags are allowed and required, so files can be validated strictly, much like an implementation guide.
- Namespaces keep tag names from different standards apart; they're the most common reason an XML file "looks right" but fails validation.
- XML standards for business documents exist too: UBL (used for e-invoicing, see Invoicing tools), cXML (used by procurement networks for punchout catalogs and orders), and GS1 XML.
-
Special characters like
&and<must be escaped, the way EDI delimiters must be kept out of text.
CSV and spreadsheets
Comma-separated values: one row per record, one column per field. The simplest format, and the one small partners and older systems most often offer.
po_number,order_date,ship_to,line,qty,uom,unit_price,upc PO-48213,2026-10-26,DC14,1,24,CA,18.50,012345678905 PO-48213,2026-10-26,DC14,2,10,EA,42.00,012345678912
- Flat. Header data (PO number, ship-to) repeats on every line. Nested data, like the cartons inside an ASN, needs several files or a type column.
-
Spreadsheets damage data. Opening a CSV in a spreadsheet and saving it can turn
012345678905into1.23457E+10and dates into another format. Never round-trip integration files through a spreadsheet. -
Commas in text need the value in quotes:
"Bracket, galvanized". Agree on the delimiter, quoting and encoding (UTF-8) in writing. - The Workbench can export an EDI file to CSV or Excel for reading, which is safe because nothing is sent back.
Fixed-width flat files
Older ERPs and mainframes often exchange fixed-width files: each field sits at a fixed position and length, padded with spaces or zeros. Many EDI translators call any non-EDI file a "flat file", but this is the classic kind.
HDRPO-48213 20261026DC14 20261109 DTL0001000024CA 0001850012345678905 DTL0002000010EA 0004200012345678912
| Record | Positions | Field |
|---|---|---|
| HDR | 1–3, 4–22, 23–30, 31–40, 41–48 | Record type, PO number, order date, ship-to code, requested date |
| DTL | 1–3, 4–7, 8–13, 14–16, 17–23, 24–35 | Record type, line, quantity, unit, price (2 implied decimals, so 0001850 = 18.50), UPC |
Without the layout document, a flat file is unreadable. Keep it with the map; one shifted position breaks every field after it.
Other formats you'll meet
-
EDIFACT: the other EDI standard, with
'and+instead of~and*. See X12 vs EDIFACT. - IDoc: SAP's intermediate document format, the usual way EDI enters and leaves SAP systems.
- Excel workbooks: common for catalogs and forecasts from small partners; treat them like CSV, with the same risks.
- PDF: invoices and orders still arrive as PDFs; OCR tools can extract data from them, but expect errors to check. See Invoicing tools.
Comparing them
| X12 / EDIFACT | JSON | XML | CSV | Fixed-width | |
|---|---|---|---|---|---|
| Fields identified by | Position in a segment | Name | Tag | Column | Character position |
| Nesting (orders → lines → cartons) | Loops, HL | Yes | Yes | No | Record types |
| Shared standard between companies | Yes | Rarely | Some (UBL, cXML) | No | No |
| Validation | Standard plus partner guide | JSON Schema | XSD | Custom | Custom |
| Typical use | Between companies | APIs, cloud systems | Enterprise systems, e-invoicing | Small partners, imports | Older ERPs, mainframes |
What goes wrong when converting
- Leading zeros dropped from UPCs, SSCCs and ZIP codes when a field is treated as a number.
- Decimals: X12 R elements carry an explicit point (18.50); N2 elements imply it (1850). Fixed-width files often imply it too. Mixing them up multiplies prices by 100.
-
Dates and times: CCYYMMDD in X12, ISO
2026-11-09in JSON and XML, anything at all in CSV. Time zones disappear unless someone keeps them. - Character sets: accented names and symbols can break older EDI partners who only accept basic characters. Agree on UTF-8 or a restricted set.
- Repeating data: JSON lists and XML repeated tags become EDI loops; counts (CTT, HL) must be recomputed, never copied.
- Empty vs missing: an empty string, a null and a missing field can mean different things to the receiving system.
Open the 850 in the Workbench and use the EDI ↔ JSON tab to see the same file as named fields, then change a value and turn it back into EDI.
APIs, webhooks and events
More and more systems connect through APIs: an ERP creating orders in a WMS, a TMS asking a carrier for a rate, a marketplace sending an order to a supplier. This module explains how APIs work, how they sit next to EDI, and the habits that keep API integrations reliable.
What an API call looks like
A web API is a set of addresses (endpoints) a program can call over HTTPS. Each call has a method, an address, headers (including who's calling) and usually a JSON body. The answer has a status code and a JSON body.
POST /v2/orders HTTP/1.1
Host: api.riverbend-3pl.example
Authorization: Bearer eyJhbGciOi...
Content-Type: application/json
Idempotency-Key: SO-77031
{
"client": "NORTHSUPPLY",
"orderNo": "SO-77031",
"customerPo": "PO-48213",
"shipTo": { "code": "DC14" },
"carrier": "ODFL",
"lines": [
{ "sku": "NS-1180", "qty": 36, "uom": "CA" },
{ "sku": "NS-2210", "qty": 10, "uom": "EA" }
]
}
HTTP/1.1 201 Created
Content-Type: application/json
{
"id": "ord_8f3k2",
"orderNo": "SO-77031",
"status": "released",
"createdAt": "2026-11-08T14:02:11Z"
}
This does the same job as a 940, but directly, one order per call, with an answer in a second instead of a 997 in an hour.
The parts you'll deal with
| Part | What it means |
|---|---|
| Methods |
GET reads, POST creates, PUT/PATCH updates,
DELETE removes.
|
| Status codes |
200/201 success; 400 your data is wrong; 401/403
not allowed; 404 not found; 409 conflict (often a duplicate);
429 too many requests; 5xx the other side failed: try again later.
|
| Authentication | An API key in a header, or OAuth 2.0: you exchange credentials for a short-lived token and refresh it before it expires. Keep keys out of code and logs. |
| Pagination | Lists come in pages ("next" links or cursors). An integration that only reads page one misses data quietly. |
| Rate limits | A maximum number of calls per minute or hour. Slow down and retry on 429. |
| Versions |
APIs change. Most put a version in the address (/v2/) or a header, and announce when old
versions stop working.
|
| Documentation | Usually an OpenAPI (Swagger) description plus guides. Like an implementation guide, it's the contract. |
Polling, webhooks and events
How does your system find out that something happened on the other side?
- Polling: ask every few minutes ("any shipments since 14:00?"). Simple, but slow and wasteful, and easy to miss records if the time window is wrong.
- Webhooks: the other system calls your address when something happens ("order SO-77031 shipped"). Fast, but your endpoint must be up, must check the call is genuine (usually a signature header), and must cope with the same event arriving twice.
- Event streams and queues: inside larger companies, systems publish events to a queue and any number of integrations consume them. This is how a single "shipped" event can produce a 945, an 856 and an email at once.
POST /hooks/wms HTTP/1.1
Host: integrations.northsupply.example
X-Signature: sha256=6f1d0c...
{
"event": "order.shipped",
"orderNo": "SO-77031",
"shippedAt": "2026-11-09T15:40:00-06:00",
"bol": "BOL-889120",
"lines": [
{ "sku": "NS-1180", "qty": 36, "lot": "LOT-2610A" },
{ "sku": "NS-2210", "qty": 8 }
]
}
North Supply's integration turns this event into the 856 for Acme and the 810 for 44 units, exactly as it would from a 945.
Habits that keep API integrations reliable
-
Idempotency. Send a unique key with every create (the
Idempotency-Keyabove) so a retry after a timeout doesn't create the order twice. It does the job that duplicate control numbers do in EDI. -
Retry with back-off. Retry
429and5xxresponses after a growing delay; don't retry400s: fix the data. - Log every call. Keep the request, response and time. In a dispute, it's your equivalent of the archived EDI file.
- Watch token expiry. OAuth tokens and API keys expire or get rotated; the integration should refresh them and alert when it can't.
-
Validate before sending. Most
400errors are missing fields or wrong codes, the same as 997 rejections. - Reconcile. APIs don't send acknowledgments the way EDI does. Compare counts daily: orders sent vs orders the other side has.
Where APIs and EDI meet
An API isn't a way to deliver an EDI file; the two are different ways for systems to talk. But most companies use both, and they meet in a few places:
- Inside the company: EDI comes in from partners; APIs carry the same data between the translator, ERP, WMS and TMS. See integration patterns.
- APIs that build or read EDI: your system posts JSON to a service that returns the finished X12 (the JSON-to-EDI API works this way). The file still travels to the partner by AS2, SFTP or a VAN.
- Partners that offer both: some retailers, marketplaces and carriers accept orders, shipments or tracking by API as well as EDI. The data is the same; the rules (required fields, codes) still come from their guide.
- Healthcare: FHIR APIs are growing for clinical data and some administrative uses, while claims and payments still run on the HIPAA X12 transactions.
Use what your partner supports. EDI suits high volumes of standard documents with many partners; APIs suit real-time questions and one-to-one connections. Neither is a replacement for agreeing the data with your partner first.
Tools for working with APIs
-
curl and PowerShell (
Invoke-RestMethod) for quick calls from a terminal; the API docs show both. - API clients such as Postman, Insomnia or Bruno, for saving and sharing collections of requests.
- OpenAPI tools that turn an API description into documentation or client code.
- Integration platforms (iPaaS) with ready-made connectors to common ERPs, WMSs and TMSs. See Translators and integration platforms.
- Webhook testers that give you a temporary address to see what a system sends before you build the real endpoint. Never send real customer data to them.
Product names are examples, not recommendations. Choose by what your systems and partners support.
Translators and integration platforms
Every EDI setup needs software that reads and writes the files, keeps partner settings, and connects to your business systems. The options range from a web portal to a full integration platform. This module explains what each kind of tool does and how to choose.
What the software has to do
Whatever you choose, these jobs need doing. Products differ in how many they cover and how much you configure yourself:
| Job | What it involves |
|---|---|
| Communications | AS2, SFTP and VAN connections; certificates; schedules. See Moving the files. |
| Envelopes and acknowledgments | ISA/GS/ST, control numbers, duplicate checks, sending and matching 997s and 999s. See Acknowledgments. |
| Validation | Checking files against the standard and each partner's guide. |
| Mapping | Converting between EDI and your systems' formats, with cross-reference tables. See Mapping and testing. |
| Partner management | IDs, versions, which documents each partner exchanges, test and production settings. |
| Business system connections | Files, APIs, connectors to your ERP, WMS, TMS. See integration patterns. |
| Tracking and alerts | A searchable history of every document, failed-document queues, missing-acknowledgment alerts. |
The main kinds of tools
| Kind | How it works | Suits | Examples |
|---|---|---|---|
| Web EDI portal | Orders appear on a website; you key in ASNs and invoices. No integration with your systems. | A handful of orders a month | Portals from EDI networks; many retailers offer one |
| Full-service (managed) EDI | A provider runs the translator, connections and maps for you, and delivers data to your systems in a format you choose. Often with ready-made maps for large retailers. | Small and mid-size companies without EDI staff | SPS Commerce, TrueCommerce, and others |
| Translator software | You install or subscribe to a translator and build maps and partner setups yourself. | Companies with an EDI analyst or team | IBM Sterling B2B Integrator, OpenText, Cleo, Lightwell, and others |
| Integration platform (iPaaS) | A cloud platform for connecting many systems with ready-made connectors, workflows and mapping; most include or add on EDI. | Companies integrating many cloud systems as well as EDI | Boomi, MuleSoft, Microsoft Azure Logic Apps, and others |
| Cloud provider services | Building blocks that convert EDI to JSON or XML and back inside your own cloud account. | Teams that build their own integrations | AWS B2B Data Interchange, Azure Logic Apps integration accounts |
| Built into the ERP or WMS | An EDI module or certified connector inside the business system. | Standard documents with common partners | Offered by many ERPs and WMSs |
| Libraries and APIs | Code that parses or builds EDI, called from your own programs. | Developers, custom systems | Open-source parsers; the JSON-to-EDI API |
Product names are here so you recognise them in job posts and partner calls. Features, pricing and even names change; compare current offerings against your own partners and systems.
How to choose
Answer these before looking at products:
- Who are your partners, and what do they require? Documents, versions, transport (AS2, VAN, SFTP). A tool with ready-made maps for your main partners saves weeks.
- Which systems must it connect to? Your ERP, WMS, TMS and accounting, and how each accepts data (files, API, connector).
- How much volume, and how fast? Documents a month, peak days, and how quickly answers are needed (a 990 in minutes vs an 846 once a day).
- Who will run it? With no EDI staff, a managed service is usually cheaper than hiring. With a team, owning the maps gives control.
- How will you see problems? Tracking screens, alerts, and who gets them.
- What will it cost in total? See below.
How EDI is priced
| Cost | What to ask |
|---|---|
| Subscription or licence | Per year or month? Per user, per server, per partner? |
| Per document or per kilocharacter | Common with VANs and managed services. How are large files (846, 852) counted? |
| Partner setup | A fee per new partner or per map? What if the partner changes its guide? |
| Connectors | Is your ERP connector included, or extra? |
| Support and changes | Who changes a map when a partner updates its rules, and how quickly? |
| Your own time | Monitoring, fixing rejections, testing new partners. Often the largest cost. |
Building your own
Parsing X12 looks easy: split on ~ and *. The hard parts are everything around it:
delimiters read from the ISA, control numbers that survive restarts, 997s, partner-specific rules, AS2 with
certificates and MDNs, and a tracking screen someone can use at 6 a.m. Teams that build their own usually combine
a library or API for the EDI itself with a proven tool for communications, and spend most of their effort on
monitoring.
Whatever you use, keep the knowledge outside the tool: a mapping specification per partner, the partner's guide version, and test files. With those kept up to date, you can move to a different tool without rebuilding everything from the old one.
Invoicing tools and e-invoicing
The EDI 810 is only one way an invoice travels. Customers also ask for invoices through procurement networks, supplier portals, national e-invoicing systems or plain PDF. This module covers the invoicing tools on both sides and how they connect to EDI.
Ways an invoice can travel
| Channel | Format | Typical customers |
|---|---|---|
| EDI | X12 810, EDIFACT INVOIC | Retailers, distributors, manufacturers, carriers (210) |
| Procurement networks | cXML, the network's own formats, or keyed into the network's site | Large companies buying indirect goods and services |
| Supplier portals | Upload a file or key the invoice on the customer's website | Companies that want every supplier in one place |
| E-invoicing networks | Structured XML such as UBL, through networks like PEPPOL | Governments, and businesses in countries that require e-invoicing |
| PDF, read by the customer's AP team or an OCR tool | Everyone else |
A supplier with many customers often needs all of these at once. The goal is to create each invoice once, in the ERP or accounting system, and let tools deliver it in whatever form each customer wants.
Tools on the sending side (accounts receivable)
- Accounting system or ERP creates the invoice: QuickBooks, Xero, NetSuite, Microsoft Dynamics 365, SAP and many others. This is the record; everything else is delivery.
- EDI translator or managed EDI turns the invoice into an 810 for EDI customers. See Translators.
- Network or portal connectors submit invoices to procurement networks and portals automatically instead of keying them.
- E-invoicing providers (for PEPPOL, an "access point") convert invoices to the required XML and deliver them.
- Cash application matches incoming payments and 820 remittances back to open invoices, and flags deductions.
Tools on the receiving side (accounts payable)
- AP automation tools receive invoices from every channel (EDI, e-invoice, PDF by email), extract the data, route approvals and pay. Examples include BILL, Tipalti, Coupa and many ERP add-ons.
- OCR and document capture read PDFs and scans. Accuracy has improved, but someone still checks totals, tax and PO numbers. Structured invoices (EDI, XML) skip this step entirely.
- Matching compares invoice, order and receipt: the three-way match. Invoices that pass are paid without anyone touching them.
- Procurement suites (such as SAP Business Network, formerly Ariba, or Coupa) cover ordering, supplier onboarding and invoicing together.
Product names change and new tools appear constantly. Check what your customers and suppliers already use before choosing.
E-invoicing and PEPPOL
Many governments now require invoices as structured data rather than PDFs, so tax authorities and buyers can process them automatically. In the European Union, public bodies must accept e-invoices that follow the European standard (EN 16931), and a growing number of countries require e-invoicing between businesses too. Italy has done so since 2019, and others are phasing it in; rules and dates differ by country, so check the current requirements where you sell.
PEPPOL is an international network for these documents. Each company joins through an access point (a provider), and invoices are sent as UBL XML using the PEPPOL BIS Billing specification. It works much like a VAN: you send to your access point, it delivers to your customer's.
<Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"
xmlns:cbc="...CommonBasicComponents-2" xmlns:cac="...CommonAggregateComponents-2">
<cbc:ID>INV-7731</cbc:ID>
<cbc:IssueDate>2026-11-10</cbc:IssueDate>
<cbc:DocumentCurrencyCode>EUR</cbc:DocumentCurrencyCode>
<cac:OrderReference><cbc:ID>PO-48213</cbc:ID></cac:OrderReference>
<cac:InvoiceLine>
<cbc:ID>1</cbc:ID>
<cbc:InvoicedQuantity unitCode="CS">24</cbc:InvoicedQuantity>
<cbc:LineExtensionAmount currencyID="EUR">444.00</cbc:LineExtensionAmount>
</cac:InvoiceLine>
<cac:LegalMonetaryTotal>
<cbc:PayableAmount currencyID="EUR">899.00</cbc:PayableAmount>
</cac:LegalMonetaryTotal>
</Invoice>
The same facts as the 810 (invoice number, date, PO, lines, total), named with tags instead of positions. Tax
details, which an e-invoice must carry in full, are left out here. Unit codes come from a UN/ECE list (CS
for case), not X12's (CA), so a cross-reference is needed when one system feeds both.
Connecting invoicing tools to EDI
- One invoice, many outputs. Map from the ERP's invoice once into a neutral format (JSON or XML), then to 810, UBL or cXML per customer. Fixes then happen in one place.
- Same numbers everywhere. The invoice number, PO number and totals must match across the 810, the PDF copy and the ERP, or matching fails on the customer's side.
- Remittance closes the loop. Load 820s (or the bank's remittance data) into cash application so payments and deductions match invoices automatically.
- Freight invoices too. Carriers' 210s often go to a freight audit service rather than AP. See the 210.
- Healthcare is different. Claims (837) and payments (835) replace invoices; see Healthcare claims.
Checks before any invoice leaves
- Lines, charges and tax add up to the total (case 2 shows what happens otherwise).
- Quantities match what actually shipped (the 856 or 945), not what was ordered.
- Prices match the order or the agreed price list.
- The customer's required references are present: PO, department, store, contract.
- It goes through the channel this customer requires; a PDF emailed to a customer that requires EDI may never be paid.
Open the 810 and the 810 that doesn't add up in the Segment Explorer and compare their totals.
EDI in retail and distribution
For suppliers selling to retailers, wholesalers and distributors. In retail, EDI isn't optional: large retailers won't buy from a supplier who can't trade electronically, and they measure every document you send.
What EDI means here
For a retail supplier, EDI is the order-to-cash cycle with no paper: the retailer orders, you confirm, you tell them what's on the truck, you invoice, they pay. Each step is a document, and most retailers set a deadline for each one.
| Document | What it means for a supplier |
|---|---|
| 850 | The order. Usually your only order: retailers don't phone or email orders once EDI is live. |
| 855 | Your promise: which lines you'll ship, at what price and when. Some retailers require it within 24 hours. |
| 860 | The retailer changed its mind. Missing one means shipping the wrong quantity. |
| 856 | The ASN. The retailer's dock receives against it; a wrong or late ASN is the most common chargeback. |
| 810 | Your invoice. It must match the order and the ASN, or it's held or short-paid. |
| 820 / 812 | What they paid, and what they deducted and why. |
| 846 / 852 / 832 | Stock you have to sell, what sold in each store, and the catalog of items and prices. |
How one order flows
One order from Acme Distribution to North Supply, from the purchase order to the payment. Solid arrows are EDI documents; the dotted green arrows are the cartons themselves.
Inside the invoice, line by line
The 810 North Supply sends for that order. Each line is colored by what kind of data it carries; pick a kind above the file to see only those lines.
doc | ST*810*0001~ | Start of an 810 invoice. `0001` is this transaction's control number; SE repeats it. ref | BIG*20261106*INV-7702*20261026*PO-48213~ | Invoice date (Nov 6), your invoice number `INV-7702`, the order date and the retailer's PO number `PO-48213`. The PO is what the retailer matches the invoice on. party | N1*RE*North Supply Co*92*V20931~ | `RE` = remit to: who gets paid. `V20931` is your vendor number in the retailer's system (`92` = assigned by the buyer). party | N3*PO Box 4410~ | Remit-to street address. party | N4*Rockford*IL*61110*US~ | City, state, ZIP and country. party | N1*BT*Acme Distribution*92*ACME01~ | `BT` = bill to: the company being invoiced. money | ITD*08*3*2**10**30~ | Payment terms: 2% off if paid within 10 days of the invoice date (`3`), otherwise the full amount in 30 days. date | DTM*011*20261105~ | `011` = date shipped. It must match the ship date in the 856. # Line items item | IT1*1*24*CA*18.50*PE*UP*012345678905*VN*NS-1180~ | Line 1: 24 cases (`CA`) at $18.50, for the item with UPC (`UP`) 012345678905, your item number (`VN`) NS-1180. Same IDs and price as the 850 line. item | PID*F****Shelf bracket, galvanized, 12 in~ | A free-form (`F`) description of line 1. item | IT1*2*10*EA*42.00*PE*UP*012345678912*VN*NS-2210~ | Line 2: 10 each (`EA`) at $42.00. item | PID*F****Wall-mount rail, 48 in~ | Description of line 2. # Totals and charges count | TDS*89900~ | Invoice total with two implied decimals: 89900 = $899.00. That's 444.00 + 420.00 for the lines plus 35.00 freight. money | SAC*C*D240***3500**********Freight~ | A charge (`C`; an allowance would be `A`). `D240` is the charge code for freight, and 3500 = $35.00. count | CTT*2~ | The number of IT1 lines, 2. The retailer's translator checks it. doc | SE*16*0001~ | End of the transaction: 16 segments from ST to SE, and the same control number as ST.
Follow one value through every document
The same few values travel through the whole cycle, each time in a different element. This is how the retailer's systems tie the ASN and invoice back to the order, and the payment back to the invoice. A value that's missing or different in one document is what causes a mismatch or a chargeback.
The 856 splits line 1 into two cartons of 12 (SN102 in each), so the retailer adds them up to compare
with the 24 ordered. The 820 pays $881.02: the $899.00 invoice less the 2% early-payment discount on the goods
($17.98 in RMR06).
What's different in retail
- Compliance programs. Retailers score suppliers on ASN timing and accuracy, label quality and invoice accuracy. Each failure can cost a fixed fee or a percentage of the order.
- ASN before the truck. The 856 must usually arrive before the goods, often within an hour of shipping, and every carton's SSCC must match its label.
-
VICS / GS1 US conventions. Many retail guides follow the industry conventions, visible as
004010VICSin GS08. The conventions help, but each retailer still adds its own rules. - Identifiers. Products by GTIN (UPC); locations by GLN or the retailer's store and DC numbers. Keep the item catalog (832) in sync before orders arrive.
- Deductions. Retailers pay the net amount and explain deductions in the 820 or 812. Reconciling them is a job of its own.
- Drop ship and marketplaces. Online retailers often send orders you ship straight to their customer, sometimes by EDI, sometimes through an API or portal.
Advice for retail suppliers
- Get the retailer's guide and compliance manual first. Read the chargeback section before anything else: it tells you what they care about most. See Implementation guides.
- Connect EDI to your ERP and warehouse. Keying orders by hand from a portal works for a few orders a week and breaks after that. See How EDI connects to your systems.
- Print labels and ASNs from the same data. Most ASN chargebacks come from a label and an ASN built separately. See carton labels.
- Track deductions. Every deduction has a reason code and a deadline to dispute it. Log each one, including small amounts, so you can dispute the wrong ones before the deadline passes.
- Expect each retailer to differ. Two retailers' 856s can need different hierarchies. Plan for a separate map for each retailer.
The rules here are common patterns, not any retailer's actual requirements. Always work from the guide and compliance manual your customer gives you.
EDI in warehousing and 3PL
For warehouses and third-party logistics providers that store and ship goods for their clients, and for the clients that use them. A 3PL often runs EDI with dozens of clients, each with its own systems and habits.
What EDI means here
For a warehouse, EDI is how work arrives and how proof of the work goes back. Every pick, receipt and adjustment the floor does should end in a document that keeps the client's books matching your shelves.
| Document | What it means for a warehouse |
|---|---|
| 940 | A shipping order: work for the floor. Usually created from the client's customer's 850. |
| 945 | Your proof of shipment. The client invoices its customer from it, so it must say exactly what left. |
| 943 / 944 | Stock on its way to you, and what you actually counted in. |
| 947 | Every change to stock that isn't a receipt or a shipment: damage, counts, holds. |
| 846 | A daily stock snapshot the client reconciles against its own records. |
| 856 | Many 3PLs send the ASN to the client's customer on the client's behalf. |
How one order flows through a warehouse
North Supply doesn't ship from its own building: Riverbend 3PL stores its stock and ships for it. The retailer's order becomes a 940 for the warehouse, and the warehouse's 945 becomes the ship notice and invoice.
Inside the shipping advice, line by line
The 945 is the warehouse's proof of what left the building. North Supply invoices from it, so every quantity matters.
doc | ST*945*0001~ | Start of a 945 warehouse shipping advice. ref | W06*F*SO-77031*20261109*SHP-55102**PO-48213~ | `F` = final report for this order. Then the owner's order number from the 940 (`SO-77031`), the date shipped, the shipment ID (`SHP-55102`) and the retailer's PO number. party | N1*ST*Acme Distribution Center*92*DC14~ | Ship to: the retailer's distribution center 14. party | N3*4100 Industrial Pkwy~ | Ship-to street address. party | N4*Joliet*IL*60431*US~ | City, state, ZIP and country. party | N1*WH*Riverbend 3PL - Joliet*92*RB-JOL~ | `WH` = the warehouse that shipped it. ref | N9*BM*BOL-889120~ | A reference: `BM` = bill of lading number. The carrier, the 856 and the 210 use the same one. date | G62*11*20261109~ | `11` = shipped on this date. party | W27*M*ODFL**PP~ | How it went: by motor carrier (`M`), the carrier's SCAC code, prepaid freight (`PP`). # Line items item | LX*1~ | Line 1 starts. item | W12*CC*36*36**CA*012345678905*VN*NS-1180~ | `CC` = shipped complete: 36 cases ordered, 36 shipped, for UPC 012345678905 (item NS-1180). ref | N9*LT*LOT-2610A~ | `LT` = lot number of the cases that shipped. Food, medicine and electronics clients need it for recalls. item | LX*2~ | Line 2 starts. item | W12*CP*10*8*2*EA*012345678912*VN*NS-2210~ | `CP` = shipped partial: 10 ordered, 8 shipped, 2 short. North Supply must invoice 8, not 10. # Totals count | W03*44*198.0*L~ | Totals: 44 units, 198.0 pounds (`L`). 36 + 8 = 44. doc | SE*16*0001~ | End: 16 segments from ST to SE.
Follow one value through every document
Three companies, five documents, and each one names the order in its own way. The PO number is the only value that appears everywhere; the owner's order number and the shipment ID link the warehouse documents in between.
The last row is where warehouse EDI goes wrong most often: the 945 reports 8 shipped, so the 856 and the 810 must say 8 as well. An ASN or invoice built from the order instead of the 945 would claim 10, and the retailer's dock would find 2 missing.
What's different for warehouses
- Many clients, one warehouse system. Each client maps the 940 differently. Normalize them into one internal format at the edge, so the floor sees the same thing every time.
- Instructions in text. Packing and labeling instructions often arrive in NTE segments. Decide which ones the system acts on and which go to a person.
- Lots, serials and dates. Food, pharmaceutical and electronics clients need them on the 944 and 945. Agree with each client which segments carry them.
- Inventory accuracy. The client's books depend on your 944s, 945s and 947s. A missed 947 shows up weeks later as an unexplained difference in the 846.
- Not every client uses EDI. Smaller clients send CSV files, spreadsheets or use your portal or API. Your WMS needs all of them to land in the same place.
Advice for warehouses and their clients
- Make onboarding a repeatable process. A standard 940/945 guide of your own, which new clients map to, saves a new map per client. See Mapping and testing.
- Watch for missing confirmations. Every 940 should get a 945, every 943 a 944. Report the ones that haven't after a set time.
- Bill from the same data. Storage, receiving and pick fees are usually billed from receipts, shipments and stock on hand, so EDI data quality is billing quality.
- Know how your WMS connects. Most WMSs take orders through import files, database tables or an API, with a translator in front. See how a WMS connects.
- For clients: reconcile the 846 against your own records daily at first, then weekly. Differences point to a missed 944, 945 or 947.
EDI in transportation and logistics
For carriers, brokers, freight forwarders and the shippers who book them. Transportation EDI is about speed: tenders expire, status is expected in near real time, and invoices are audited line by line.
What EDI means here
For a carrier, EDI is how freight is won, tracked and paid for. Shippers and brokers run transportation management systems (TMS) that send tenders to many carriers and expect fast, machine-readable answers.
| Document | What it means for a carrier |
|---|---|
| 204 | A load offered to you. Freight you might win, if you answer in time. |
| 990 | Your yes or no. A slow 990 is a lost load. |
| 214 | Where the load is. Shippers score you on how complete and timely these are. |
| 210 | Your freight bill. It's audited against the tender and the rate contract. |
| 820 | Payment, often from a freight audit and payment service rather than the shipper. |
How one load flows
North Supply ships 3 pallets to Acme's distribution center. The shipper tenders the load, the carrier accepts, reports each event and bills for the move.
Inside the load tender, line by line
The 204 is built in layers: first the whole load (who pays, which references), then one block per stop (where, when, what), then the totals. Pick a kind of data above the file to see only those lines.
doc | ST*204*0001~ | Start of a 204 motor carrier load tender. # The whole load ref | B2**ODFL**LD-30418**PP~ | The carrier's SCAC code, the shipper's shipment ID `LD-30418` (every later document quotes it), and `PP` = freight prepaid by the shipper. doc | B2A*00*LT~ | `00` = a new tender (`01` would cancel it), `LT` = load tender. ref | L11*BOL-889120*BM~ | A reference number. `BM` = bill of lading. L11 can repeat for each reference the shipper wants on the paperwork. ref | L11*PO-48213*PO~ | `PO` = the purchase order this freight fills, so the consignee can match it. doc | NTE**Driver must check in at guard shack~ | A free-text note for the driver. People read it; systems don't. party | N1*BT*North Supply Co*92*V20931~ | `BT` = bill to: who pays the freight invoice. party | N3*PO Box 4410~ | Bill-to address. party | N4*Rockford*IL*61110*US~ | City, state, ZIP and country. # Stop 1: pick up item | S5*1*LD*212.5*L*3*PL~ | Stop 1, `LD` = load (pick up) 212.5 pounds (`L`) on 3 pallets (`PL`). date | G62*37*20261105*I*0800~ | `37` ship no earlier than Nov 5, `I` earliest pickup time 08:00. date | G62*38*20261105*K*1400~ | `38` ship no later than Nov 5, `K` latest pickup time 14:00. party | N1*SH*North Supply Co*93*NS-RKF~ | `SH` = shipper: where the truck goes for stop 1. `NS-RKF` is the location code. party | N3*2200 Harrison Ave~ | Pickup street address. party | N4*Rockford*IL*61104*US~ | Pickup city, state, ZIP and country. party | PER*IC*Dock Office*TE*815-555-0142~ | Who to call at the stop (`IC` = information contact, `TE` = telephone). item | OID*BOL-889120*PO-48213**PLT*3*L*212.5~ | What's picked up here: the BOL and PO it belongs to, 3 pallets (`PLT`), 212.5 pounds. # Stop 2: deliver item | S5*2*UL*212.5*L*3*PL~ | Stop 2, `UL` = unload the same 212.5 pounds and 3 pallets. ref | L11*PO-48213*PO~ | The PO again, at stop level: the receiving dock books the appointment on it. date | G62*53*20261107*G*0700~ | `53` deliver no earlier than Nov 7, `G` earliest delivery time 07:00. date | G62*54*20261107*L*1500~ | `54` deliver no later than Nov 7, `L` latest delivery time 15:00. party | N1*CN*Acme Distribution Center*93*DC14~ | `CN` = consignee: who receives the freight. party | N3*4100 Industrial Pkwy~ | Delivery street address. party | N4*Joliet*IL*60431*US~ | Delivery city, state, ZIP and country. item | OID*BOL-889120*PO-48213**PLT*3*L*212.5~ | What's dropped off here: the same 3 pallets. # Totals money | L3*212.5*G***68500******3*L~ | Total gross (`G`) weight 212.5, the tendered charge 68500 = $685.00 (two implied decimals), 3 pallets, pounds. doc | SE*27*0001~ | End: 27 segments from ST to SE.
Inside the freight invoice: the charge codes
The 210 repeats the references from the tender so the shipper can match it, then lists each charge on its own
L1 line with a code that says what it is for.
ref | B3**FI-5520193*LD-30418*PP**20261108*90248**20261107*035*ODFL~ | Invoice `FI-5520193` for shipment `LD-30418` (from the 204), prepaid, billed Nov 8. Amount due 90248 = $902.48, delivered (`035`) Nov 7, carrier SCAC. money | C3*USD~ | Currency: US dollars. ref | N9*BM*BOL-889120~ | The bill of lading from the 204's L11. ref | N9*PO*PO-48213~ | The purchase order from the 204's L11. ref | N9*CN*7741200931~ | `CN` = the carrier's PRO number, the carrier's own ID for the load (first sent in the 990). party | N7*ODFL*TRL5521*********TV~ | The equipment used: trailer TRL5521, `TV` = truck, van. item | L5*1*Steel shelving hardware*70*FC~ | What was carried: line 1, the description, freight class 70 (`FC`). The class drives the rate. item | L0*1***212.5*G***3*PLT**L~ | How much: 212.5 pounds gross on 3 pallets. money | L1*1*685*FR*68500****400~ | Line haul: rate 685 flat (`FR`), charge $685.00, charge code `400` = freight charge. Matches the 204's L3. money | L1*1***14248****FUE~ | `FUE` = fuel surcharge, $142.48. Usually a percentage of line haul from a published fuel table. money | L1*1***7500****LFT~ | `LFT` = liftgate service, $75.00: an accessorial. It wasn't in the tender, so expect the shipper to question it. count | L3*212.5*G***90248******3*L~ | The invoice total: $902.48 = 685.00 + 142.48 + 75.00.
| Code (L108) | Charge | When it appears |
|---|---|---|
| 400 | Freight (line haul) | Every invoice: the move itself, from the rate contract |
| FUE | Fuel surcharge | Most invoices; changes weekly with fuel prices |
| LFT | Liftgate | Delivery to a place without a dock |
| DET | Detention | The truck waited longer than the free time at a stop |
| RES | Residential delivery | Delivery to a home rather than a business |
| INS | Inside delivery | Freight carried inside the building, past the door |
Codes vary by carrier and partner; the shipper's guide lists the ones it accepts, and the rate contract says which accessorials it'll pay without question.
Follow one value through every document
A load has several IDs, and each company files it under a different one: the shipper under its shipment ID, the carrier under its PRO number, the consignee under the PO. This is where each one appears.
The PRO number doesn't exist until the carrier accepts: it first appears in the 990, and from then on the carrier's 214s and 210 lead with it. A shipper whose system only knows the shipment ID must store the PRO from the 990, or later status and invoices won't attach to the load.
What's different in transportation
- Time limits. A 204 may need a 990 within an hour or two, or the load goes to the next carrier.
- Event-driven status. Shippers often want a 214 for each event (pickup, departure, arrival, delivery, delay) within minutes.
- Many references. Shipment ID, BOL, PO, PRO number, appointment numbers. Get the matching right, or status and invoices won't attach to the right load.
- Accessorials. Extra charges (liftgate, detention, fuel) are the main source of disputes on the 210. Agree them in the rate contract.
- APIs are common alongside EDI. Tracking, rating and parcel shipping often use carriers' APIs; load tenders and invoices still mostly use EDI. See APIs and webhooks.
Advice for carriers, brokers and shippers
- Automate the 990. Accepting tenders from a dispatcher's inbox is too slow for most shippers. Connect your TMS so tenders show up in dispatch and answers go back automatically. See how a TMS connects.
- Feed 214s from the truck. Status from ELDs, driver apps or GPS, turned into 214s, beats a dispatcher keying events after the fact.
- Brokers translate in both directions. A broker receives a 204 from a shipper and sends its own to a carrier, then relays the 214s and pays the 210. IDs change at each step; keep a cross-reference.
- Audit your own 210s. Compare each invoice with the tendered rate before sending; a disputed invoice is paid late.
Practice
- Open the 204, the 990 accept and the 990 decline.
- Open the 214 and list the events with their times and places.
- Open the 210 and check that the charges add up, as in the 210 lesson.
EDI in manufacturing
For plants and their suppliers, especially in automotive, industrial and electronics. Manufacturing EDI is driven by schedules rather than one-off orders: the customer forecasts what it'll need and calls off deliveries against that forecast.
What EDI means here
For a manufacturing supplier, EDI drives production planning. The forecast tells you what to buy and build; the shipping schedule tells you what to send this week; the ASN, sent the moment the truck leaves, is often what you get paid from.
| Document | What it means for a supplier |
|---|---|
| 830 | The forecast: weeks or months of requirements, firm near-term and planning further out. |
| 862 | The shipping schedule: exact quantities and dates for the next days, against the forecast. |
| 850 | Often a blanket order for the year, with releases coming by 830 and 862. |
| 856 | Required within minutes of shipping; in self-billing, it's the basis for payment. |
| 810 / 820 | Invoice and remittance, or just the remittance under self-billing. |
How a schedule turns into deliveries
Midwest Assembly Plant doesn't send an order for each delivery. It sends a rolling forecast every week, a firm schedule for the next few days, and pays from what it receives.
Inside the forecast, line by line
The 830 tells the supplier what to buy material for and what it's committed to ship. The firm and planning quantities look the same in the file; only a code tells them apart.
doc | ST*830*0001~ | Start of an 830 planning schedule. ref | BFR*00**REL-2611-07*DL*A*20261109*20270207*20261106~ | `00` = a new schedule that replaces the last one. Release number `REL-2611-07`, delivery-based (`DL`) actual quantities (`A`), covering Nov 9 to Feb 7, generated Nov 6. party | N1*MI*Midwest Assembly Plant*92*MAP01~ | `MI` = the plant that issued the schedule. party | N1*SU*North Supply Co*92*V20931~ | `SU` = the supplier it's for. item | LIN**BP*BRK-1180*VP*NS-1180~ | The part: the buyer's part number (`BP`) BRK-1180 and your own (`VP`) NS-1180. One LIN loop per part. item | UIT*EA~ | Quantities below are in each (`EA`). item | SHP*01*1200*050*20261102~ | The last receipt the plant recorded: 1,200 (`01` = discrete quantity) received (`050`) on Nov 2. Compare it with what you shipped. date | FST*400*C*D*20261116~ | 400 on Nov 16. `C` = firm: you can be held to it. `D` = a single date. date | FST*400*C*D*20261123~ | 400 on Nov 23, firm. date | FST*1600*D*M*20261201~ | 1,600 in December. `D` = planning only (buy material, don't ship yet), `M` = a monthly bucket. date | FST*1600*D*M*20270101~ | 1,600 in January, planning. count | CTT*1*4000~ | 1 part, and the quantities add up to 4,000 (400 + 400 + 1,600 + 1,600). A check that nothing was lost. doc | SE*13*0001~ | End: 13 segments from ST to SE.
Follow one value through every document
The part number is the thread through manufacturing EDI: the plant plans, receives and pays by its own part number, so it has to be on everything you send.
Under self-billing there is no invoice: the plant pays each ASN it received, quoting your shipment number in the
820's RMR02 (with RMR01 = SI, shipper's identifying number). An ASN with a
wrong part number or quantity is paid wrong, or not at all.
What's different in manufacturing
- Forecasts replace each other. Each new 830 replaces the last one for that part. Your system must take the newest one, not add them together.
- Cumulative quantities. Schedules often state the total shipped since the start of the model year (the "cum"). If your cum and the customer's disagree, every future requirement looks wrong.
- Firm and planning periods. The near weeks of a forecast are firm (you can be held to them); later weeks are for planning materials only.
- Self-billing. Some manufacturers pay on receipt, from your ASN and their receiving, without an invoice. The ASN must be exact.
- EDIFACT and OFTP2 in Europe. European automotive uses DELFOR, DELJIT and DESADV, often over OFTP2. See EDIFACT and transport methods.
LIN**BP*MAP-44107~ UIT*EA~ SHP*02*14400*011*20260801~ FST*1200*C*W*20261116~ FST*1200*C*W*20261123~ FST*1500*D*W*20261130~
Part MAP-44107 (buyer's part number) Units: each Cum received since Aug 1: 14,400 Week of Nov 16: 1,200 firm (C) Week of Nov 23: 1,200 firm (C) Week of Nov 30: 1,500 planning (D)
The forecast is from Midwest Assembly Plant (MAP01), fictional, as is every example in this course. Which FST codes mean "firm" varies by customer; check the guide.
Advice for manufacturing suppliers
- Load forecasts into planning automatically. An 830 read by a person and keyed into MRP is late and error-prone. Most ERPs can import releases directly. See How EDI connects to your systems.
- Reconcile cums every time. Compare the customer's cum in each 830 with your shipped total and resolve differences the same day.
- Send ASNs from the shipping dock. Build the 856 when the truck is loaded, from scanned labels, not from the order.
- Expect labels and packaging rules. Automotive customers specify label formats and returnable containers; label numbers go in the 856.
Practice
- Read the 830 and 862 examples in Forecasts and schedules, then the 830 and 862 reference pages.
- Open the 856 and imagine it's the only record your customer will pay from. What would you check before sending it?
EDI in healthcare
For providers, payers, clearinghouses and billing companies. US healthcare EDI is required by HIPAA, uses X12 version 5010 with national implementation guides, and protects patient data at every step.
What EDI means here
For a provider, EDI is how you get paid: check coverage, get approval, send the claim, follow it, and post the payment. For a payer, it's the same cycle from the other side, plus enrollment from employers.
| Document | What it means |
|---|---|
| 270 / 271 | Is this patient covered, and for what? Asked before the visit. |
| 278 | Approval in advance for a procedure. |
| 837P / 837I | The claim: professional (a clinic) or institutional (a hospital). |
| 999 / 277CA | Was the claim file readable, and was each claim accepted for processing? |
| 276 / 277 | Where is my claim? |
| 835 | What was paid, adjusted or left to the patient, claim by claim. |
| 834 / 820 | Who's enrolled in a plan, and the premiums paid for them. |
How one claim flows
Jane Sample visits Lakeside Family Clinic. Before the visit the clinic checks her coverage; afterwards it bills through a clearinghouse, which checks the claim and forwards it to her plan. Every name here is made up.
Inside the remittance, line by line
The 835 explains every dollar: what was charged, paid, written off and left to the patient, claim by claim and line by line. Its adjustment codes are what billing staff read most.
doc | ST*835*0001*005010X221A1~ | Start of an 835. `005010X221A1` names the HIPAA implementation guide it follows. money | BPR*I*142.50*C*ACH*CCP*01*071000013*DA*000111222*1123456789**01*071000039*DA*000333444*20261120~ | The payment: `I` = payment with remittance detail, $142.50 by ACH, from the plan's bank account to the clinic's, effective Nov 20. (The bank numbers are made up.) ref | TRN*1*EFT-90012231*1123456789~ | The trace number of the EFT. It's on the bank deposit too: this is how the 835 is matched to the money. party | N1*PR*Example Health Plan~ | `PR` = the payer. party | N1*PE*Lakeside Family Clinic*XX*1234567893~ | `PE` = the payee, identified by its NPI (`XX`). # Claim PCN-77120 doc | LX*1~ | Starts a group of claims. money | CLP*PCN-77120*1*185.00*152.50*20.00*12*EHP26110300417~ | The claim: the clinic's own number from the 837 (`CLM01`), `1` = processed as primary, charged $185.00, paid $152.50, patient owes $20.00, `12` = PPO, and the plan's claim number. party | NM1*QC*1*Sample*Jane****MI*XYZ123456789~ | `QC` = the patient, with her member ID (`MI`). # Service line 1 item | SVC*HC>99213*135.00*102.50**1~ | Procedure code 99213 (an office visit, `HC` = CPT/HCPCS): charged $135.00, paid $102.50, 1 unit. date | DTM*472*20261103~ | `472` = date of service, Nov 3. money | CAS*CO*45*12.50~ | An adjustment. `CO` = contractual: the clinic writes it off. Reason `45` = the charge is more than the agreed fee. $12.50. money | CAS*PR*3*20.00~ | `PR` = patient responsibility. Reason `3` = copay. $20.00, which the clinic bills to Jane. ref | REF*6R*L1~ | The line's control number from the 837, so the payment posts to the right line. 102.50 + 12.50 + 20.00 = 135.00. # Service line 2 item | SVC*HC>87880>QW*50.00*50.00**1~ | A rapid strep test (87880, modifier `QW`): charged $50.00, paid in full. date | DTM*472*20261103~ | Date of service. ref | REF*6R*L2~ | Line control number L2 from the 837. # Adjustments to the whole payment money | PLB*1234567893*20261231*WO>EHP2610OVP*10.00~ | A provider-level adjustment: `WO` = recovering an earlier overpayment, $10.00 held back. That's why the EFT is $142.50, not $152.50. doc | SE*18*0001~ | End: 18 segments from ST to SE.
Follow one value through every document
The clinic's patient control number is the thread: it's created on the claim and comes back on every answer, so the billing system can match each response to the claim it sent.
The 999 doesn't know about claims at all: it answers for the whole transaction, by its control number. The 277CA and 835 answer claim by claim, by the patient control number. That's why a 999 can say "accepted" while a claim inside is still rejected in the 277CA.
What's different in healthcare
- Required by law. Covered entities must use the HIPAA transactions in version 5010 for claims, payments, eligibility, claim status, authorizations and enrollment.
- Protected health information. Files contain patient names, birth dates and diagnoses. Encrypt in transit and at rest, limit who can see files, and never use real patient data in tests or examples.
- Clearinghouses. Most providers don't connect to each payer. A clearinghouse checks claims, returns 999s and 277CAs, and forwards claims to payers.
- Loops have names. Healthcare guides refer to loops by ID (2000B, 2300, 2400). Errors and companion guides use those names.
- Money follows claims. The 835 explains payments with adjustment reason codes; matching it to the bank deposit uses the TRN trace number.
Advice for providers, billers and payers
- Let your practice management or billing system do the EDI. Most build 837s and read 835s through a clearinghouse connection; your job is clean data and reading rejections. See How EDI connects to your systems.
- Check eligibility before every visit. A 270/271 at scheduling prevents most denials for coverage.
- Work 999 and 277CA rejections daily. A rejected claim was never received, and filing deadlines keep running. See the 999.
- Post 835s automatically. Auto-posting payments and adjustments saves hours, and the adjustment codes show which denials to appeal.
- Read each payer's companion guide. They differ on IDs, required fields and how they use optional segments. See Implementation guides.
Every patient, provider and plan in this course (Jane Sample, Lakeside Family Clinic, Example Health Plan) is made up. Payers' companion guides differ: always work from the guides of the payers you send to.
Practice
- Open the 837P and find the billing provider, subscriber, claim and service lines by their loops.
- Open the 835 and work out what was paid, adjusted and left to the patient.
- Open the 999 and read it with the 999 lesson.
Segment Explorer
Every sample document in the course, element by element. Pick a document, click any value to see its name, type, length and code meaning from the X12 dictionary, and let the checks recount the envelope and totals for you.
Paste your own X12 file
Your file stays in this browser; nothing is uploaded. Remove real names and patient data before pasting anything you share.
Reading the explorer
- Element names come from the X12 dictionary (004010 to 005010). Partners' guides can rename, restrict or require elements; the guide wins.
- Code meanings are the standard's. "Not in the standard list" usually means a partner-defined code: look it up in their guide.
- Checks recount SE01, GE01 and IEA01, compare control numbers in headers and trailers, and check CTT, HL order, SSCC lengths and invoice totals. Business rules (prices, items, locations) can't be checked here.
- Samples are generated from the same examples as the JSON-to-EDI API, so they match what the API builds. The three under "Find the mistakes" are broken on purpose; Troubleshooting explains them.
Glossary
The terms you'll hear on partner calls and read in guides. Each one links to the module that explains it.
Final exam (open notes)
The course itself is free and has no tests. If you'd like proof of what you've learned, for yourself, a manager or a client, you can buy the final exam and earn a certificate.
Lunar Integrations EDI Fundamentals exam
- Open notes. Keep the course, the Segment Explorer, the reference pages and your own notes open while you take it.
- Practical. You'll read real-looking files: find the purchase order in an 856, explain why a 997 rejected a set, check an invoice's totals, read a 999.
- Covers all twenty-one modules, with a choice of industry section: retail, warehousing, transportation, manufacturing or healthcare.
- Certificate with your name and the date, when you pass.
Ask for the exam through the contact form, and we'll send the price, how to pay and how to take it.
Getting ready
- Work through the course outline and mark each module done.
- Read the industry page for the section you'll choose.
- Load every sample in the Segment Explorer once, including the three broken files.
- Keep the glossary handy.