What is EDI (X12 Standard)? (A Beginner’s Guide)
When we want to communicate to people, we talk or send messages or mail them, but when two businesses want to communicate, they use…
What is EDI (X12 Standard)? (A Beginner’s Guide)
When we want to communicate to people, we talk or send messages or mail them, but when two businesses want to communicate, they use something called as EDI. It stands as Electronic Data Interchange. It’s a standardized way to exchange business documents like purchase orders, sales orders, ship notices etc. When I first came across EDI, it felt quite confusing at first, just a sequence of strange segments and numbers. But as I started to look at it from the business perspective of it, things clicked. EDI is simply a common language that lets two companies’ computer systems talk to each other.
Every type of business transaction in EDI is assigned an transaction set number. For example, 810 is Invoice, 856 is Advance Ship Notice etc. These numbers ensure that no matter which companies are talking to each other, both systems know what kind of document they’re dealing with.
How Businesses Actually use EDI
Let’s take an example of 2 business B1 and B2. B1 needs to purchase 1000 shoes from B2. Traditionally, B1 will email or fax a purchase order and someone at B2 will re-enter this into their system. This is slow and error-prone.
With EDI, it works like this instead:
- B1’s system generates an 850 Purchase Order in X12 format.
- That file is sent electronically to B2.
- B2’s system receives it, and automatically understands it, and creates a sales order without anyone typing anything.
- When the order is shipped, B2 sends an 856 Advance Ship Notice to B1.
- Later, it sends 810 Invoice so B1 can make the payment.
- Then, B1’s system sends 997 Functional Acknowledgment saying “okay, got it!”
How EDI File Travels
Creating an EDI file is half the job and the other half is sending it securely to your trading partner. Over the years, businesses have used different methods. Most common means of transport include VANs, AS2, SFTP/FTPS, API-based EDI. Someone gave me analogy of it as, VANs are like digital post office, AS2 as a courier, SFTP as a dropbox and API-based as developer friendly option.
What is X12?
There are several standards across the world for EDI. Most widely used one in US is ANSI X12 — developed by the American National Standards Institute.
Here are common X12 transactions sets:

X12 Transaction Sets
Building Blocks of an EDI file
An EDI file may look like gibberish at first as it’s a long string of characters separated by * and ~. But it is highly structured.
- is a element separator and ~ is a segment separator. Below is the sample EDI for 850 (Purchase Order) (Reference took from stedi.com)
ISA*00* *00* *ZZ*STEDI *ZZ*ACME *210901*1234*U*00801*000000001*0*T*>~
GS*PO*SENDERGS*007326879*20210901*1234*1*X*008020~
ST*850*000000001~
BEG*24*SP*PO-00001**20210901~
N1*2L*STEDI INC.~
REF*K6*The EDI platfrom for developers~
PER*SR**EA*team@stedi.com~
PO1**1*1N*500*PM*GE*Stedi Core~
PO1**1*C0*0.001*PE*GE*Mappings~
CTT*2~
SE*9*000000001~
GE*1*1~
IEA*1*000000001~
After observing the above EDI, the segments are those who are at the leftmost part of each line, these are ISA, GS, ST, BEG, N1, REF, PER, PO1, CTT, SE, GE, IEA. These segments represent a specific kind of information. Also, the EDI above is formatted (It’s not necessary that the EDI you receive is formatted it can come as a single line without line breaks). Also, some segments in EDI are not mandatory and are optional.
Now if we break it down:
- ISA/IEA -> Outer envelope (its like the box you ship the documents in)
- GS/GE -> Group of related transactions
- ST/SE -> The actual transaction (purchase order itself)
- Segments (BEG, N1, PO1 etc) -> Each line holds a specific piece of information like who ordered, what item, how many, where to ship to, bill to etc.
The another thing in EDI that you will notice is loops. A loop is simply a repetitive group of segments that belong together. Think of it as like having multiple items in a cart. Each item has its own product ID, quantity and price.
Let’s take an example. If a retailer buys 2 products so, in 850 purchase order, we will have a PO1 loop repeat.
PO1*1*10*EA*15.00*PE*BP*123456
PID*F****Red T-Shirt
PO1*2*5*EA*45.00*PE*BP*654321
PID*F****Blue Jeans
In the above EDI, we can see that:
- Each PO1 segment is one line item segment.
- PID (product description) belongs to PO1 and together they form PO1 loop. This can be repeated as many times.
Let’s take example of another loop. N1 loop:
N1*ST*ABC Store*9*111111111
N3*123 Main St
N4*New York*NY*10001
N1*BT*ABC HQ*9*222222222
N3*456 Market Ave
N4*Chicago*IL*60601
In the above EDI:
- N1 indicates the name of the party (Bill to (BT), Ship to (ST), etc.)
- N3 represents the street address.
- N4 represents the city, state and zip.
- This repeats for each party in transaction.
EDI has been there since 1970s, but it is still the backbone of logistics, retail, healthcare, and manufacturing. EDI is used by big corporations as well as small suppliers to do their business with big retailers or distributors.
For more understanding of multiple segments related to a transaction, you can visit stedi.com. I found it very useful.
So, the next time you order something from Amazon, remember that behind the scenes, an EDI transaction probably made it happen! Happy Coding!
메타데이터
- post_id
- beab9508d0c1
- slug
- what-is-edi-x12-standard-a-beginners-guide-beab9508d0c1
- url
- https://towardsdev.com/what-is-edi-x12-standard-a-beginners-guide-beab9508d0c1
- canonical_url
- https://towardsdev.com/what-is-edi-x12-standard-a-beginners-guide-beab9508d0c1
- author_url
- https://medium.com/@shreya.dikshit99000
- status
- ok
- fetched_at
- 2026-07-17 21:06:32