All guides
Home / Guides / The UNB / UNH Envelope

The EDIFACT Envelope: UNA, UNB, UNG, and UNH Explained

EdiPeek · Updated June 2026 · 6 min read

Every UN/EDIFACT interchange is wrapped in nested envelopes that handle delimiters, routing, and control. Understanding this structure lets you find where messages begin and end, identify the trading partners, and read the message version. The EDIFACT envelope uses UNA, UNB, UNG, and UNH.

The levels, from outside in

This parallels the X12 ISA/GS/ST structure, but with EDIFACT syntax and a few differences worth knowing.

UNA: the service string advice

The optional UNA segment, when present, sits at the very start of the interchange and declares the six special characters in a fixed order: component separator, element separator, decimal mark, release character, a reserved character, and the segment terminator. A typical UNA reads UNA:+.? '. If a file has no UNA, the defaults apply (:, +, ., ?, space, '). A parser reads UNA first so it can correctly split everything that follows.

UNB: the interchange header

The UNB identifies the interchange. Unlike the fixed-width X12 ISA, the UNB is delimiter-based and variable length. Its key data includes:

UNG: the functional group (optional)

The UNG groups messages of the same type, similar to the X12 GS. It is optional in EDIFACT and many interchanges omit it, placing messages directly inside the UNB. When present, it carries a group reference that the closing UNE echoes.

Ad slot - insert AdSense unit here

UNH: the message header

The UNH is where an actual message begins, and it carries something X12 handles differently - an explicit version. A header like UNH+1+ORDERS:D:96A:UN reads as message reference 1, message type ORDERS, directory D, release 96A, controlling agency UN. That version string is essential: it tells the receiver exactly which dictionary of segments and codes to apply, because message definitions change between releases like D96A and D01B. The closing UNT repeats the message reference and states the segment count.

How references tie it together

As in X12, each level's header and trailer must agree:

These matched references are integrity checks that detect truncation or malformed structure.

A skeleton example

UNA:+.? '
UNB+UNOC:3+5790001234567:14+5790007654321:14+240220:0900+REF00001'
UNH+1+ORDERS:D:96A:UN'
... message body ...
UNT+11+1'
UNZ+1+REF00001'

Reading the envelope: a UNA declares standard delimiters; the UNB shows an interchange from GLN 5790001234567 to GLN 5790007654321 on 2024-02-20, reference REF00001; inside is one ORDERS message under directory D96A. The references REF00001 and 1 match their trailers.

Why this matters when troubleshooting

Explore the envelope yourself

Paste an EDIFACT file and EdiPeek detects the UNA, lays out the UNB and UNH envelope with labeled fields, and summarizes sender, receiver, and message type. Nothing leaves your browser.

Open the EDIFACT viewer

Frequently asked questions

Is the UNA segment required?
No. It is optional. If it is absent, the default EDIFACT delimiters apply. When present, it overrides those defaults.
Why does the UNH carry a version?
Because EDIFACT message definitions change between directory releases. The version (like D:96A:UN) tells the receiver which dictionary of segments and codes to use.
What is the X12 equivalent of this envelope?
The ISA / GS / ST structure. See our guide to the ISA, GS, and ST envelope.