Every X12 file is three envelopes deep. The ISA/IEA pair wraps the whole interchange, GS/GE wraps groups of the same document type, and ST/SE wraps each individual 850, 856 or 810. Get the business data perfect and the envelope wrong, and the file is rejected before anyone reads a single line item.
Envelope errors are also the hardest to see by eye, because the ISA is padded with spaces to fixed widths and its delimiters are defined by position rather than declared. This guide covers every ISA element with its length, the GS and ST segments, how the trailers count and match, how delimiters work, a full annotated example and the mistakes that produce TA1 and 997 rejections.
What Is the ISA Segment in EDI?
The ISA segment is the Interchange Control Header defined in the X12.5 interchange control structure. It is always the first 106 characters of an X12 interchange, and it is the only X12 segment with fixed-length elements: every value is padded with trailing spaces (or leading zeros for the control number) so each element sits at the same position in every file.
That fixed layout is deliberate. A receiver has to find the delimiters before it can parse anything, and it does so by position: the character immediately after ISA is the element separator, character 105 is the component separator and character 106 is the segment terminator. Everything else in the file is then read using those characters.
The ISA is closed by the IEA (Interchange Control Trailer), which repeats the control number and counts the functional groups inside.
The Three Envelope Levels
| Level | Header | Trailer | What it wraps | Acknowledged by |
|---|---|---|---|---|
| Interchange | ISA | IEA | Everything sent in one transmission between one sender ID and one receiver ID | TA1 Interchange Acknowledgment |
| Functional group | GS | GE | One or more transaction sets of the same type (all 850s, all 810s) | 997 Functional Acknowledgment or 999 Implementation Acknowledgment |
| Transaction set | ST | SE | One business document: a single PO, ship notice or invoice | 997 or 999 (AK2/IK2 level) |
One interchange can hold several groups, and one group can hold many transaction sets. A retailer sending you 40 purchase orders overnight usually sends one ISA, one GS with code PO, and 40 ST/SE pairs.
ISA Segment Elements: All 16 Explained
| Element | Name | Type and length | Example | Notes |
|---|---|---|---|---|
| ISA01 | Authorization Information Qualifier | ID, 2 | 00 | 00 = no authorization information present |
| ISA02 | Authorization Information | AN, 10 | 10 spaces | Almost always blank, padded to 10 |
| ISA03 | Security Information Qualifier | ID, 2 | 00 | 00 = no security information; 01 = password |
| ISA04 | Security Information | AN, 10 | 10 spaces | Blank unless ISA03 is 01 |
| ISA05 | Interchange ID Qualifier (sender) | ID, 2 | ZZ | 01 DUNS, 08 UCC EDI Communications ID, 12 phone, 14 DUNS plus suffix, 16 DUNS plus 4, ZZ mutually defined |
| ISA06 | Interchange Sender ID | AN, 15 | BIGBOXRETAIL | Padded with trailing spaces to 15 |
| ISA07 | Interchange ID Qualifier (receiver) | ID, 2 | ZZ | Same code list as ISA05 |
| ISA08 | Interchange Receiver ID | AN, 15 | NORTHSTARFOODS | Padded to 15 |
| ISA09 | Interchange Date | DT, 6 | 261202 | YYMMDD, the only two-digit year in the envelope |
| ISA10 | Interchange Time | TM, 4 | 0930 | HHMM, 24-hour |
| ISA11 | Repetition Separator (00402 and later) | 1 | ^ | In version 00401 and earlier this is the Interchange Control Standards Identifier, always U |
| ISA12 | Interchange Control Version Number | ID, 5 | 00501 | Version of the envelope itself: 00401, 00501 |
| ISA13 | Interchange Control Number | N0, 9 | 000004127 | Zero-padded to 9 digits; must equal IEA02 |
| ISA14 | Acknowledgment Requested | ID, 1 | 0 | 0 = no TA1 requested, 1 = send a TA1 |
| ISA15 | Interchange Usage Indicator | ID, 1 | P | P production, T test, I information |
| ISA16 | Component Element Separator | 1 | > | Splits composite elements; often > or : |
Add the 3-character ISA tag, 16 element separators and 86 characters of data, and you get 105 characters. The segment terminator makes 106. If your ISA is not exactly 106 characters, something is padded wrong.
ISA05 to ISA08: sender and receiver IDs
These four elements are how the receiving system and your VAN route the file. The qualifier and ID together must match what the partner has set up, character for character. ZZ with NORTHSTARFOODS is a different identity from 01 with a DUNS number, even if both describe the same company. Most new-partner connection failures trace back to a qualifier or ID that differs from the one in the partner's setup sheet.
ISA11: repetition separator or standards identifier
From version 00402 onward, ISA11 holds the repetition separator, the character used when an element repeats within one segment. ^ is the common choice in 005010, including all HIPAA files. In 004010 files, ISA11 is the Interchange Control Standards Identifier and is always U. If your partner trades 004010 and you send ^ in ISA11, expect a TA1 rejection.
ISA13: interchange control number
A unique, sequential number for each interchange between a sender and receiver. The receiver uses it to detect duplicates and gaps, and it must match IEA02 exactly, including leading zeros. Never reuse a control number in production; many retailers reject a duplicate ISA13 as a resend.
ISA14 and ISA15: acknowledgment and test flag
ISA14 set to 1 asks the receiver for a TA1 interchange acknowledgment. ISA15 tells the receiver whether to process the data. Sending T files into production, or P files during testing, is one of the most common go-live mistakes.
X12 Delimiters
X12 has no fixed delimiters. Each interchange declares its own in the ISA:
| Delimiter | Where it is defined | Common values |
|---|---|---|
| Element separator | Character 4 (immediately after ISA) | * |
| Repetition separator | ISA11, version 00402 and later | ^ |
| Component element separator | ISA16 (character 105) | >, : or \ |
| Segment terminator | Character 106, right after ISA16 | ~, sometimes a newline or ' |
Two practical rules. First, never hard-code * and ~ in a parser: read them from the ISA. Second, X12 has no escape or release character, so a delimiter can never appear inside data. If a product description contains *, it has to be removed or replaced before the file is built. (EDIFACT handles this with the ? release character; see X12 vs EDIFACT.)
Line breaks after each segment terminator are common and harmless for most receivers, but some strict translators treat a carriage return as data. If a partner reports a segment they cannot read, check for stray line breaks first.
The GS Segment: Functional Group Header
The GS segment groups transaction sets of the same functional type and tells the receiver which X12 release to validate against.
| Element | Name | Example | Notes |
|---|---|---|---|
| GS01 | Functional Identifier Code | PO | Must match the transaction sets inside (see the table below) |
| GS02 | Application Sender's Code | BIGBOXRETAIL | Often the same as ISA06 without padding, but can differ |
| GS03 | Application Receiver's Code | NORTHSTARFOODS | Often the same as ISA08 |
| GS04 | Date | 20261202 | CCYYMMDD |
| GS05 | Time | 0930 | HHMM, optionally with seconds |
| GS06 | Group Control Number | 4127 | Up to 9 digits, no padding; must equal GE02 |
| GS07 | Responsible Agency Code | X | X = ASC X12 |
| GS08 | Version / Release / Industry Identifier Code | 005010 | See versions below |
GS01 functional identifier codes
A group must not mix types. If you put an 856 inside a GS*PO group, the receiver's 997 will reject the whole group.
GS08 version codes
GS08 tells the receiver which release, and sometimes which industry convention, the documents follow:
004010: version 4, release 1. Still the most common release in US retail.004010VICSand004010UCS: 4010 under the retail (VICS) or grocery (UCS) industry conventions.005010: version 5, release 1. Common in newer retail programs and in transportation.005010X222A1,005010X221A1: HIPAA implementation guides for the 837P and the 835. In healthcare the guide ID also goes into ST03.
GS08 is a different field from ISA12. ISA12 (00401, 00501) is the version of the envelope; GS08 is the version of the documents inside.
ST and SE: Transaction Set Header and Trailer
| Element | Name | Example | Notes |
|---|---|---|---|
| ST01 | Transaction Set Identifier Code | 850 | The document type |
| ST02 | Transaction Set Control Number | 0001 | 4 to 9 characters, unique within the group; must equal SE02 |
| ST03 | Implementation Convention Reference | 005010X222A1 | 005010 and later; required in HIPAA |
| SE01 | Number of Included Segments | 8 | Counts every segment from ST to SE, including both |
| SE02 | Transaction Set Control Number | 0001 | Same value as ST02 |
GE and IEA: Group and Interchange Trailers
| Element | Name | Rule |
|---|---|---|
| GE01 | Number of Transaction Sets Included | Count of ST/SE pairs in the group |
| GE02 | Group Control Number | Same value as GS06 |
| IEA01 | Number of Included Functional Groups | Count of GS/GE pairs in the interchange |
| IEA02 | Interchange Control Number | Same 9-digit value as ISA13 |
These counts are what a 997 or TA1 checks first. If SE01 says 8 and the set has 9 segments, the 997 reports an error even when every business field is correct.
Annotated Example: One 850 in a Full Envelope
ISA*00* *00* *ZZ*BIGBOXRETAIL *ZZ*NORTHSTARFOODS *261202*0930*^*00501*000004127*0*P*>~
GS*PO*BIGBOXRETAIL*NORTHSTARFOODS*20261202*0930*4127*X*005010~
ST*850*0001~
BEG*00*SA*PO-771204**20261202~
REF*DP*092~
DTM*002*20261210~
N1*ST*BIGBOX DC 6094*92*6094~
PO1*1*48*CA*21.50**UP*012345678905~
CTT*1~
SE*8*0001~
GE*1*4127~
IEA*1*000004127~
Reading it from the top:
- ISA: no authorization or security info (
00plus 10 spaces, twice). The sender isBIGBOXRETAILand the receiverNORTHSTARFOODS, both under qualifierZZand padded to 15. Sent 2 December 2026 at 09:30. Repetition separator^, envelope version00501, control number000004127, no TA1 requested, production data, component separator>, segment terminator~. - GS: a purchase order group (
PO) with group control number4127, built to X12005010. - ST to SE: one 850, control number
0001. SE01 is8because there are 8 segments from ST to SE inclusive. - GE: one transaction set in group
4127. - IEA: one functional group in interchange
000004127.
Paste it into the free EDI Inspector to see each element labelled, or swap a count and watch the validation fail.
Common Envelope Errors
| Error | What the receiver sees | Fix |
|---|---|---|
| ISA element not padded to its fixed length | TA1 rejection, or the parser reads the wrong delimiters | Pad ISA02, ISA04, ISA06 and ISA08 with trailing spaces; zero-pad ISA13 to 9 digits |
| Wrong ISA05/ISA07 qualifier or ID | File routed nowhere, or rejected as unknown partner | Use the exact qualifier and ID from the partner's setup sheet |
| ISA13 does not match IEA02 | TA1 note code for a control number mismatch | Generate both from the same value |
| Duplicate ISA13 | Rejected as a duplicate interchange | Keep a persistent, incrementing counter per partner |
| GS06 does not match GE02, or ST02 does not match SE02 | 997 rejects the group or set | Write header and trailer from one variable |
| Wrong SE01, GE01 or IEA01 count | 997 AK5 or AK9 rejection | Count segments after the document is built, not before |
T in ISA15 during go-live, or P during testing | Test data posted to production, or real orders ignored | Switch ISA15 as part of the production cutover checklist |
^ in ISA11 on a 004010 interchange | TA1 rejection | Send U for 00401 and earlier envelopes |
| GS01 does not match ST01 | Group rejected | Put each document type in its own GS group |
| Delimiter character inside data | Segment split in the wrong place | Strip or replace delimiter characters before building the file |
The TA1 guide lists the interchange note codes, and the 997 guide explains how AK3, AK4, AK5 and AK9 report errors inside the group.
Envelope Checklist for a New Trading Partner
- Confirm ISA05/ISA06 and ISA07/ISA08 for both directions, test and production. Some partners use different IDs for each.
- Confirm the X12 version (ISA12 and GS08) and any industry suffix such as
VICS. - Agree on delimiters, or confirm the partner accepts whatever your ISA declares.
- Agree whether they want a TA1 (ISA14) and whether they will send 997s or 999s.
- Start control numbers at a value that will not collide with test traffic, and store them per partner.
- Switch ISA15 from
TtoPon the agreed cutover date, not before.
Where OrderSync Fits
OrderSync reads X12 interchanges from every partner, checks the envelope, counts and control numbers, and splits each interchange into individual orders. Those orders are validated against your customers, items and prices with the same pipeline that handles PDF, email and spreadsheet orders, and outbound documents are built with correct envelopes per partner.
Frequently Asked Questions
What is the ISA segment in EDI?
The ISA segment is the Interchange Control Header that starts every X12 EDI file. It is a fixed-width, 106-character segment with 16 elements identifying the sender and receiver, the date and time, the envelope version, the interchange control number, the test or production flag and the delimiters used in the rest of the file.
How long is the ISA segment?
106 characters including the segment terminator. The data elements have fixed lengths, so ISA02, ISA04, ISA06 and ISA08 are padded with spaces and ISA13 is zero-padded to 9 digits.
What is the GS segment in EDI?
The GS segment is the Functional Group Header. It groups transaction sets of the same type, identified by the GS01 code (PO for 850s, IN for 810s, SH for 856s), and states the X12 version in GS08. Each GS is closed by a GE segment with the same control number.
What is an EDI envelope?
The envelope is the set of header and trailer segments around the business documents: ISA/IEA for the interchange, GS/GE for each functional group and ST/SE for each transaction set. It tells the receiver who sent the file, what it contains and how many documents to expect.
What are the delimiters in X12 EDI?
The element separator (character 4 of the ISA, often *), the repetition separator (ISA11, often ^), the component separator (ISA16, often > or :) and the segment terminator (the character after ISA16, often ~). Each interchange defines its own.
What is the difference between ISA12 and GS08?
ISA12 is the version of the interchange envelope, for example 00501. GS08 is the version of the transaction sets in the group, for example 005010 or 004010VICS. They usually agree on the release but are separate fields.
Does the ISA13 control number have to match GS06 or ST02?
No. ISA13 must match IEA02, GS06 must match GE02 and ST02 must match SE02. Many systems use related numbers for convenience, but the standard only requires each header to match its own trailer.
What does ISA15 T or P mean?
ISA15 is the usage indicator. P means production data to be processed. T means test data. Some partners also accept I for information only.
Does EDIFACT have an ISA segment?
No. EDIFACT uses UNB for the interchange header and UNH for each message, with an optional UNA segment that declares the separators. Our X12 vs EDIFACT comparison maps the two envelopes level by level.
Related Guides
- TA1 Interchange Acknowledgment
- 997 Functional Acknowledgment
- 999 Implementation Acknowledgment
- X12 vs EDIFACT
- EDI document types and transaction codes
Sources
- X12 transaction sets, ASC X12
- ASC X12, Accredited Standards Committee X12
- ISA Interchange Control Header, X12 005010, Stedi X12 reference