Every HL7 v2 message starts with the same segment: MSH, the Message Header. Before a receiving system looks at a single patient detail, it reads MSH to work out who sent the message, who it is for, what type of message it is, which version of the standard it follows and how it should be acknowledged. If MSH is wrong, nothing after it matters. The message is rejected, routed to the wrong place or silently ignored.
This guide walks through the MSH segment fields one by one, shows a worked example and lists the fields that cause the most interface problems in practice.
MSH|^~\&|LABSYS|MAINLAB|EHRAPP|GENHOSP|20261020143005||ORU^R01^ORU_R01|MSG000123|P|2.5.1|||AL|NE||UNICODE UTF-8
Paste this into the free AckHarbor™ HL7 Message Viewer and each field will be labelled for you. Below is what every position means.
MSH is unusual because its first two fields define the syntax for the rest of the message.
|. It counts as field 1, which is why field numbering in MSH is off by one compared with other segments.^~\&: component separator ^, repetition separator ~, escape character \ and subcomponent separator &. Version 2.7 and later can add a fifth character, #, as the truncation character.A receiver that hard-codes these characters instead of reading them from MSH-2 will break the day a sender uses a different set.
LABSYS).MAINLAB).EHRAPP).GENHOSP).Interface engines often route on these four values. A typo in MSH-4 after a site go-live is a classic reason messages end up in an error queue.
The time the sending system created the message, in the format YYYYMMDDHHMMSS, optionally followed by fractional seconds and a time-zone offset (for example 20261020143005-0400). This is the creation time of the message, not the time of the clinical event. Event times belong in segments such as EVN or OBR.
Rarely used. Most interfaces leave it empty.
The most important field for processing. It has three components:
ADT, ORM, ORU or ACK.A01 (admit) or R01 (unsolicited observation result).ORU_R01, which tells the parser what segment grammar to expect (from v2.3.1 onwards).For a deeper look, see our article on MSH-9 message types.
A unique identifier assigned by the sender. The receiver echoes it back in MSA-2 of the acknowledgement, which is how the sender matches each ACK to the original message. Duplicate control IDs can cause messages to be treated as resends and dropped.
Tells the receiver how to treat the message: P for production, T for training and D for debugging. Sending T messages into a production system, or P messages into a test system, is a common go-live mistake.
The HL7 v2 version the message follows, such as 2.3, 2.5.1 or 2.8. Receivers use it to choose the right parsing rules. A mismatch here is a frequent reason for an AR (application reject) acknowledgement.
Most interfaces leave both empty.
These two fields control the enhanced acknowledgement mode:
The allowed values are AL (always), NE (never), ER (error/reject only) and SU (successful completion only). If both fields are empty, original acknowledgement mode applies and the receiver returns one ACK with AA, AE or AR in MSA-1. Our article What an HL7 ACK really tells you covers those codes in detail.
USA.ASCII, 8859/1 or UNICODE UTF-8. If this field disagrees with the actual bytes sent, names with accents get garbled.Later versions add more fields, such as MSH-22 to MSH-25 for sending and receiving organisations and networks, but most real-world interfaces stop well before those.
When an interface fails, check these first:
T versus P mismatches between environments.Our list of the top 5 interface errors shows how several of these appear in real error queues.
Want every key segment on one page? Download the free AckHarbor™ HL7 Quick Reference at ackharbor.com/quick-reference/. It covers MSH, PID, PV1, OBR, OBX and the acknowledgement codes in one printable sheet.
What does MSH stand for in HL7?
MSH stands for Message Header. It is the first segment of every HL7 v2 message.
Why is MSH-1 the field separator?
The character immediately after "MSH" defines the field separator, and the standard counts it as field 1. That is why the encoding characters are MSH-2 and the sending application is MSH-3.
Which MSH field identifies the message type?
MSH-9. It contains the message code, the trigger event and (from v2.3.1) the message structure, for example ADT^A01^ADT_A01.
How does an ACK link back to the original message?
The receiver copies the original MSH-10 Message Control ID into MSA-2 of the acknowledgement.
What is the difference between MSH-15 and MSH-16?
MSH-15 asks for a transport-level accept acknowledgement. MSH-16 asks for an application-level acknowledgement. Each uses the values AL, NE, ER or SU.
---
*HL7® and FHIR® are registered trademarks of Health Level Seven International.*