Skip to content

EDI messages consist of an envelope and a hierarchical series of structural elements. The envelope contains a set of headers and trailers, each set of which describes and contains a structural element. These structural elements are as follows:

Interchange Group Transaction set/message Segment Data Element Sub Element

The hierarchical structure of an EDI message enables transaction sets/messages and groups to be batched. Even if an interchange contains only one transaction set/message and only one group, that interchange is structured with the same basic structural elements that it would have if it were batched, with the exception that there would not be multiple transaction set/message or group elements.

The headers and trailers for both X12 and EDIFACT are similar. The major difference is the UNA Service String Advice header for EDIFACT, which defines the separators used in the interchange. In X12 encoding, the separators are defined in the ISA Interchange Control Header.

Headers and Trailers

X12 Headers and Trailers

ISA Interchange Control Header GS Functional Group Header ST Transaction Set Header SE Transaction Set Trailer GE Functional Group Trailer IEA Interchange Control Trailer

\=== If an ISA header is followed immediately by an IEA trailer, the interchange is empty. If a transaction set exists, the GS header and GE trailer must be present; otherwise, they are conditional. ===


The ISA interchange control header fields in an X12-encoded message are of fixed length. For some of the fields, you can enter a value less than the fixed length of the field. If you do so, the interchange must contain trailing spaces (for a string field) or leading zeroes (for a numerical field) so that each field is of the required length.


The GS group header fields and the ST transaction set header fields are not of fixed length.


The ST01 field is the transaction set ID Code; the ST02 field is the transaction set control number. The ST03 field is the schema version identifier. The SE01 field indicates the number of segments included in the transaction set; the SE02 field is the same as the ST02 field (the transaction set control number).

EDIFACT Headers and Trailers

UNA Service String Advice UNB Interchange Control Header UNG Functional Group Header UNH Message Header UNT Message Trailer UNE Functional Group Trailer UNZ Interchange Control Trailer


The UNA header is not required. The UNB header is required. If the UNA header is present, it contains the delimiters to use when processing the incoming message; otherwise the separators defined for the EfactDelimiters pipeline property will be used.

If a UNB header is followed immediately by a UNZ trailer, the interchange is empty. If a UNG header is followed immediately by a UNE trailer, the group is empty. The UNG header and UNE trailer pair are conditional and do not have to be present in a message.

Last update: June 27, 2020