HL7v2 segment reference
A scannable reference to the HL7 version 2 segments you meet most often, what each one carries, and the messages that use them.
An HL7v2 message is a set of segments, one per line, each starting with a three-character identifier. Fields within a segment are separated by the pipe character. This sheet covers the segments you see across ADT, ORU, ORM, SIU, VXU and MDM messages.
Segment field positions vary by HL7 version and by local implementation, so always confirm against your interface specification. The descriptions here follow the standard segment definitions.
Header and event segments
| Segment | Name | What it carries |
|---|---|---|
| MSH | Message Header | Sending/receiving application and facility, message type, control id, timestamp, and HL7 version. Defines the field and encoding delimiters. |
| EVN | Event Type | The trigger event code and the date/time the event occurred. Used by ADT and MDM messages. |
| MSA | Message Acknowledgment | Acknowledgment code (AA, AE, AR) and the control id being acknowledged. Appears in ACK messages. |
| ERR | Error | Error details in an acknowledgment: location, code, and severity. |
Patient and visit segments
| Segment | Name | What it carries |
|---|---|---|
| PID | Patient Identification | Patient identifiers (MRN), name, date of birth, sex, address, and phone. The core demographics segment. |
| PD1 | Patient Additional Demographics | Additional demographics such as primary care provider and living arrangements. |
| PV1 | Patient Visit | Patient class, assigned location, attending/referring providers, admit and discharge details for the visit. |
| PV2 | Patient Visit Additional | Additional visit information such as admit reason and expected discharge. |
| NK1 | Next of Kin / Associated Parties | Next of kin, emergency contacts, and associated parties with their relationship and contact details. |
| GT1 | Guarantor | The party financially responsible for the account. |
Order and observation segments
| Segment | Name | What it carries |
|---|---|---|
| ORC | Common Order | Order control code (NW new, CA cancel, DC discontinue, etc.), placer and filler order numbers, and ordering provider. |
| OBR | Observation Request | The ordered service or panel (universal service id), specimen, and result date/time. Heads a group of OBX results. |
| OBX | Observation / Result | A single result value: observation code, value, units, reference range, and abnormal flag. One value per segment. |
| SPM | Specimen | Specimen type, collection details, and identifiers for laboratory results. |
| NTE | Notes and Comments | Free-text notes attached to the preceding segment. |
Clinical and financial segments
| Segment | Name | What it carries |
|---|---|---|
| AL1 | Patient Allergy Information | Allergy type, the allergen, reaction, and severity. |
| DG1 | Diagnosis | Diagnosis code, description, type, and date for the encounter. |
| PR1 | Procedures | Procedure code, description, and date. |
| IN1 | Insurance | Insurance plan, company, group, and policy details. |
| RXA | Pharmacy/Treatment Administration | Administered substance (e.g. a CVX vaccine code), dose amount and units, and administration date. Used by VXU. |
| RXE | Pharmacy/Treatment Encoded Order | Encoded medication order: give code (often RxNorm), give amount and units, dosage form, and timing. Used by RDE. |
| RXR | Pharmacy/Treatment Route | Route and site of administration. |
Scheduling and document segments
| Segment | Name | What it carries |
|---|---|---|
| SCH | Scheduling Activity | Appointment identifier, type/reason, duration, and the timing quantity (start and end). Used by SIU. |
| RGS | Resource Group | Groups the resource segments (AIS/AIL/AIP) that follow in a scheduling message. |
| AIL | Appointment Information, Location | The location or department resource for an appointment. |
| TXA | Transcription Document Header | Document type, content type, activity and edit dates, author, unique document id, and availability status. Used by MDM. |
Notes
- Field numbering: in HL7 docs PID-5 means the fifth field of PID. Field positions differ between HL7 versions, so confirm against your spec.
- Custom Z-segments (identifiers starting with Z, such as ZPD) are site-specific and are not part of the standard.
- Components within a field are separated by the caret, repetitions by the tilde, and sub-components by the ampersand, as declared in MSH.
Frequently asked questions
What is the MSH segment in HL7?
MSH is the message header. It is the first segment of every HL7v2 message and carries the sending and receiving applications and facilities, the message type, a control id, the timestamp, and the HL7 version. It also defines the delimiter characters used in the message.
What is the difference between OBR and OBX?
OBR is the observation request (the order or panel), while OBX is an individual result value within that order. One OBR is typically followed by many OBX segments, one per result.
What carries patient demographics in HL7v2?
The PID (Patient Identification) segment. It holds identifiers such as the MRN, the patient name, date of birth, sex, address, and phone.
What are Z-segments?
Z-segments are custom, site-specific segments whose identifiers begin with Z. They are not part of the HL7 standard, so their meaning depends entirely on the local interface specification.