Basic structure of x12 Edi message

All EDI transactions get defined by EDI message standards. It is vital to have proper governance processes for data quality. When information is missing or in the wrong place, the EDI document might not be processed correctly.

Each X12 message is made up of a combination of the following elements:

  • Data
  • Segments
  • Loops

The data element is the smallest named unit of information in the X12 standard. Data elements can be broken down into types. The distinction between the types is strictly a matter of how they are used.

A segment is a logical grouping of data elements. In X12, the same segment can be used for different purposes. This means that a field’s meaning can change based on the segment.

Loops are sets of repeating ordered segments.

The rules for X12 envelope structure ensure the integrity of the data and the efficiency of the information exchange. The actual X12 message structure has primary levels that are hierarchical. From highest to the lowest, they are:

  • Interchange Envelope
  • Functional Group
  • Transaction Set



Interchange Envelopes (ISA/IEA)

The Interchange Envelope often referred to as the “outer envelope,” is the wrapper for all the data to be sent in one transmission. It can contain multiple Functional Groups. This characteristic means that transactions of different types can be included in the Interchange Envelope, with each type of transaction stored in a separate Functional Group.

The Interchange Envelope is defined by the header and trailer

This is the beginning segment of almost all EDI documents. The purpose of this segment is to identify the sender and receiver, date, time and control number information. The ISA segment is the only segment that is fixed length record. This is done thus that EDI systems can derive the sender, receiver, element separators, sub-element separators, and segment terminators that will be used during EDI transformation



1. Authorization Information Qualifier

2. Authorization Information

3. Security Information Qualifier

4. Security Information

5. Interchange ID Qualifier

6. Interchange Sender ID

7. Interchange ID Qualifier

8. Interchange Receiver ID

9. Date the Envelope Was Created

10. Time the Envelope Was Created

11. Interchange Control Standard Identifier

12. Interchange Control Version Number

13. Interchange Control Number

14. Acknowledgment Requested

15. Usage Indicator

16. Sub Element Separator

The following  describes the IEA segment elements:

  1. Number of Included Functional Groups

2. Interchange Control Number


Functional Groups

Functional Groups, often referred to as the “inner envelope,” are made up of one or more Transaction Sets, all of the same type, which can be batched together into one transmission. The Functional Group is defined by the header and trailer segments.

The Functional Group Header (designated GS) segment appears at the beginning:


and the Functional Group Trailer (designated GE) segment appears at the end:

Many Transaction Sets can be included in the Functional Group, but all local transactions must be of the same type.

Within the Functional Group, each Transaction Set is assigned a functional identifier code, which is the first data element of the header segment.

Transaction Set

The Transaction Set is composed of logically related pieces of information grouped into units called segments. For example, one segment used in the Transaction Set might convey the address: city, state, postal code, and other geographical information. A Transaction Set may contain multiple segments. For example, the address segment might be used repeatedly to convey multiple sets of address information.

Each Transaction Set also known as a transaction contains:

  • Transaction Set header (designated ST)
  • Transaction Set trailer (designated SE)
  • Single message, enveloped within the header and footer







In an X12 message, the various delimiters are part of the syntax, dividing up the different elements of a message. The delimiters used in a message are defined in the interchange control header, the outermost layer enveloping the message.