All guides
Home / Guides / The ISA / GS / ST Envelope

The X12 Envelope: ISA, GS, and ST Explained

EdiPeek · Updated June 2026 · 6 min read

Every ANSI X12 file is built from nested envelopes that handle routing and control. Understanding this envelope is essential, because it is how you find where one document ends and another begins, who sent the file, and which document type you are looking at. The X12 envelope has three levels: ISA, GS, and ST.

The three levels, from outside in

Each level has a header (ISA, GS, ST) and a matching trailer (IEA, GE, SE). They nest strictly: an interchange contains one or more groups, each group contains one or more transaction sets.

ISA: the interchange header

The ISA is unusual in X12 because it is fixed length - exactly 106 characters - with every field in a fixed position. This rigidity exists so a receiver can read the delimiters and key routing information before parsing anything else. Key ISA fields include:

Because the ISA is fixed width, errors in its length or padding are a common cause of parse failures. The delimiters themselves are read from specific ISA positions.

GS: the functional group

The GS groups transaction sets of the same functional type so they can be processed together. It carries a functional identifier code (for example PO for purchase orders, IN for invoices), the application sender and receiver, a date and time, a group control number, and the version of the standard being used (such as 004010 or 005010). That version governs how the documents inside should be interpreted.

Ad slot - insert AdSense unit here

ST: the transaction set

The ST is where an actual document begins. ST*850*0001 says this is an 850 purchase order with control number 0001. The transaction set type here is what tells you the document type - 850, 810, 856, 837, and so on. The closing SE repeats the control number and states how many segments the transaction contained, which lets the receiver verify nothing was lost or truncated.

How control numbers tie it together

Each level has a control number that its trailer must echo:

These matched pairs are an integrity check. If a header and trailer disagree, the interchange is malformed. Control numbers also help detect duplicates and missing transmissions over time.

A skeleton example

ISA*00*          *00*          *ZZ*SENDER*ZZ*RECEIVER*240220*0900*U*00401*000000123*0*P*:~
GS*PO*SENDER*RECEIVER*20240220*0900*123*X*004010~
ST*850*0001~
... transaction body ...
SE*12*0001~
GE*1*123~
IEA*1*000000123~

Reading the envelope: a production interchange (P) from SENDER to RECEIVER, containing one functional group of purchase orders under version 004010, which holds one 850 transaction. The control numbers 000000123, 123, and 0001 match their trailers.

Why this matters when troubleshooting

Explore the envelope yourself

Paste an X12 file and EdiPeek lays out the ISA, GS, and ST envelope with every field labeled, plus a summary of sender, receiver, and document type. Nothing leaves your browser.

Open the X12 viewer

Frequently asked questions

Why is the ISA fixed length?
So a receiver can reliably read the delimiters and routing information from known positions before parsing the rest of the file. Its 106-character layout is rigid by design.
What is the usage indicator?
A single character in the ISA: P for production (real data) or T for test. It prevents test data from being processed as real transactions.
What is the EDIFACT equivalent of this envelope?
The UNB / UNG / UNH structure. See our guide to the UNB and UNH envelope.