UNB - Interchange Header

The opening segment of every EDIFACT interchange that identifies the sender, recipient, and transmission parameters.

Purpose

The UNB (Interchange Header) segment is the first segment in any UN/EDIFACT interchange. It forms the outermost envelope of an EDI transmission, identifying who is sending the data, who should receive it, when it was prepared, and under what syntax rules it should be parsed. The UNB segment is essential for routing and is the first thing a receiving system reads to determine how to process the incoming data.

Every UNB segment must be paired with a corresponding UNZ (Interchange Trailer) segment. Together, they create the interchange envelope that can contain one or more messages, each wrapped in their own UNH/UNT pair.

Data Elements

The UNB segment contains several important data elements and composites:

  • S001 - Syntax Identifier: Specifies the syntax version in use.
    • 0001 - Syntax Identifier: Typically UNOA, UNOB, UNOC, or UNOD, indicating the character set.
    • 0002 - Syntax Version Number: The version of the syntax rules (e.g., 3 for version 3, 4 for version 4).
  • S002 - Interchange Sender: Identifies the sender with a code and optional qualifier (e.g., GLN, DUNS number).
  • S003 - Interchange Recipient: Identifies the intended recipient using the same code format as the sender.
  • S004 - Date and Time of Preparation: The date (YYMMDD) and time (HHMM) when the interchange was created.
  • 0020 - Interchange Control Reference: A unique reference assigned by the sender to identify this specific interchange. This value must match the reference in the corresponding UNZ segment.
  • S005 - Recipient's Reference/Password (conditional): A password or reference agreed upon between trading partners for authentication.
  • 0026 - Application Reference (conditional): Identifies the application or process that generated the interchange.
  • 0029 - Processing Priority Code (conditional): Indicates the priority for processing (e.g., A for highest).
  • 0031 - Acknowledgement Request (conditional): If set to 1, the sender requests a CONTRL acknowledgement message.
  • 0032 - Interchange Agreement Identifier (conditional): References a specific agreement between trading partners.
  • 0035 - Test Indicator (conditional): If set to 1, indicates the interchange is a test transmission.

Format and Syntax

The general format of a UNB segment is:

UNB+syntaxId:version+senderCode:qualifier+recipientCode:qualifier+date:time+controlRef'

Composite elements use the colon (:) as a component separator, while the plus sign (+) separates data elements. The segment ends with the segment terminator, usually an apostrophe (').

Messages That Use UNB

The UNB segment is not specific to any message type. It appears in every EDIFACT interchange regardless of content. Any time an EDIFACT transmission is sent, whether it contains INVOIC, ORDERS, DESADV, CONTRL, or any other message type, the interchange begins with UNB and ends with UNZ.

Example

A typical UNB segment for an interchange between two trading partners:

UNB+UNOC:3+5412345678908:14+8798765432106:14+240315:1430+IC20240315001+++EANCOM'

This interchange uses UNOC syntax version 3. The sender is identified by GLN 5412345678908 (qualifier 14 = EAN/GS1), the recipient by GLN 8798765432106. It was prepared on 15 March 2024 at 14:30. The interchange control reference is IC20240315001, and the interchange agreement identifier is EANCOM.