Introduction: Why Acknowledgments Are the Backbone of HL7 Reliability
In any healthcare information system that exchanges HL7 v2.x messages, the acknowledgment — universally called the ACK — is the mechanism that makes the entire communication model reliable. When a hospital admission system sends an ADT^A01 message to the EHR, or a laboratory information system sends an ORU^R01 result to the ordering provider's system, neither system can be certain the transaction completed successfully unless it receives an acknowledgment in return.
Without ACKs, a sending system has three bad options: assume the message was received (risky), keep retransmitting indefinitely (flooding), or build a bespoke confirmation mechanism outside the HL7 standard (expensive). The HL7 v2.x acknowledgment protocol eliminates all three problems by defining a standardized, lightweight response message that every HL7 application is expected to produce and process.
This article covers the complete HL7 ACK message structure: the three acknowledgment codes (AA, AE, and AR), the MSH mirroring rules that route the ACK back to the sender, the MSA segment that carries the acknowledgment status, and the practical implications of each code for healthcare integration workflows.
Note: This article is intended for educational and technical reference purposes. It does not constitute medical or legal advice.
The HL7 v2.x Acknowledgment Model
The HL7 v2.x acknowledgment protocol is defined in Chapter 2 of the specification under "Message Control." Its foundation is simple: for every message sent, the receiving application sends back an ACK message confirming what happened. The ACK tells the sender one of three things: the message was accepted and processed, the message was processed but with errors, or the message was rejected outright.
This protocol applies to application-level acknowledgments — responses from the application that actually processed the data, not just the transport layer that received the bytes. The distinction matters because a message can be successfully delivered over the network (TCP connection established, bytes received) but still fail at the application level (the EHR couldn't find the patient record, the lab code wasn't recognized, the message version isn't supported).
Original Mode vs. Enhanced Mode
HL7 v2.x defines two acknowledgment modes negotiated through MSH-15 (Accept Acknowledgment Type) and MSH-16 (Application Acknowledgment Type):
- Original Mode: A single ACK message serves as both the transport confirmation and the application confirmation. This is the mode used by the overwhelming majority of production HL7 interfaces. When MSH-15 and MSH-16 are empty or set to AL (Always), Original Mode applies.
- Enhanced Mode: Two separate acknowledgments are required. The transport layer first sends a commit-level ACK (using codes CA, CE, or CR) to confirm the message was received and safely stored. Then the application sends a separate application-level ACK (AA, AE, or AR) after processing. Enhanced Mode is rarely used in practice but is sometimes seen in environments with store-and-forward message queuing.
This article focuses on Original Mode application ACKs — the type generated by this tool and used in the vast majority of HL7 v2.x interfaces.
The Three Application Acknowledgment Codes
The acknowledgment code in MSA-1 is the most important field in any ACK message. It tells the sending system exactly what happened to its transaction and determines what the sender should do next.
AA — Application Accept
An AA (Application Accept) acknowledgment means the receiving application successfully received, parsed, and processed the message. The data has been stored — the patient was admitted, the order was placed, the result was saved. From the sender's perspective, an AA ACK is the green light: the transaction is complete, no retransmission is required, and the message can be marked as successfully delivered in the sender's outbound queue.
AA is the expected response for the happy path. In a well-functioning HL7 interface, the vast majority of messages should receive AA ACKs. A high rate of AE or AR responses indicates configuration problems, data quality issues, or mismatched interface specifications between systems.
AE — Application Error
An AE (Application Error) acknowledgment means the receiving application encountered an error during processing. The message was understood (parsed successfully), but something prevented clean processing. Common causes include:
- A required field is missing (e.g., PID.3 patient identifier is empty)
- A coded value in a CE or CWE field is not found in the receiver's lookup table (e.g., an unknown LOINC code in OBX.3)
- A business rule violation (e.g., the patient already exists with conflicting demographic data)
- A database constraint violation (e.g., duplicate order number)
The key characteristic of AE is ambiguity about whether the message was partially processed. The specification does not require receiving systems to roll back partial processing before sending AE — some systems may have processed parts of the message before the error occurred. This ambiguity is one reason AE responses require careful handling: the sending system cannot simply retransmit without first understanding what, if anything, was processed.
AE responses typically include a human-readable description in MSA-3 and may include an ERR segment with structured error codes, field-level error location (segment name, sequence, field position), and severity indicators.
AR — Application Reject
An AR (Application Reject) acknowledgment means the receiving application rejected the message entirely without attempting to process it. Unlike AE, AR signals no partial processing — the message was examined at the structural or routing level and found to be unsuitable for processing before any data operations were attempted. Common causes include:
- Unsupported message type (MSH-9 contains a message code the receiver doesn't handle)
- Unsupported HL7 version (MSH-12 contains a version the receiver hasn't been configured for)
- Authorization failure (the sending application or facility in MSH-3/MSH-4 is not authorized to send messages to this receiver)
- Structural malformation so severe the parser cannot determine the message type
AR is the clearest signal for the sending system: something is fundamentally wrong with how the interface is configured or the message is structured. Retransmitting the same message will produce the same AR. The sender must investigate and correct the root cause — updating the message type, negotiating version alignment with the receiving system, or resolving authorization configuration — before retransmitting.
MSH Field Mirroring: Routing the ACK Back
The ACK message is itself a complete HL7 message, beginning with its own MSH segment. The routing information in this MSH must be set correctly so the ACK reaches the original sender, not an unrelated system. The HL7 v2.x specification defines a precise set of rules for how the ACK's MSH fields are derived from the original message's MSH fields:
The Four Core Mirroring Rules
- ACK MSH-3 = Original MSH-5 (Sending Application ← Receiving Application): The entity that receives the original message becomes the sender of the ACK. So the ACK's "Sending Application" is the original message's "Receiving Application."
- ACK MSH-4 = Original MSH-6 (Sending Facility ← Receiving Facility): The same swap for facility identifiers. The facility that received the message now sends the ACK.
- ACK MSH-5 = Original MSH-3 (Receiving Application ← Sending Application): The ACK must be delivered to the original sender's application.
- ACK MSH-6 = Original MSH-4 (Receiving Facility ← Sending Facility): The ACK must be delivered to the original sender's facility.
In summary: the sending and receiving identifiers in the ACK's MSH are the reverse of the original message's MSH. This is the mirroring rule that routes the ACK back to its origin.
New Control ID (MSH-10)
The ACK's MSH-10 is assigned a new, unique control ID — never the control ID from the original message. The original control ID is carried in MSA-2 (see below) as the cross-reference. The ACK's own MSH-10 is needed because the ACK is itself a message that may need to be tracked, logged, and deduplicated by interface infrastructure. If an interface receives duplicate ACKs for the same transaction, MSH-10 uniqueness allows the duplicates to be identified and discarded.
The MSA Segment in Detail
The MSA (Message Acknowledgment) segment is the second — and typically the last required — segment in an ACK message. Its three most important fields are:
MSA-1: Acknowledgment Code
The machine-readable status: AA, AE, or AR. Interface engines and application receivers parse this field first to determine the transaction outcome. The value is checked against the sending system's outbound message queue to determine whether to mark the message complete, queue it for retry, or escalate it for manual review.
MSA-2: Message Control ID
The value from MSH-10 of the original message — not the ACK's own MSH-10. This is the critical cross-reference field. When a sending system receives an ACK, it looks up MSA-2 in its outbound message queue to find the original transaction. Without a correct MSA-2, the sending system cannot identify which message the ACK refers to and treats it as an orphan ACK — which typically means the original message remains in a "pending acknowledgment" state and eventually triggers retransmission.
MSA-2 mismatches — caused by a receiving system that incorrectly copies the control ID, truncates it, or generates a different value — are one of the most common causes of HL7 retransmission storms in production environments.
MSA-3: Text Message
An optional free-text field providing a human-readable description of the acknowledgment status. For AA responses, it is typically empty or contains a generic success message. For AE and AR responses, it should contain enough detail for an analyst to understand the error without needing to inspect the full ERR segment. MSA-3 is not intended to be machine-parsed — it exists as a human-readable supplement to the structured error data in ERR.
The ACK Message Structure
A minimal conformant HL7 ACK contains exactly two segments — MSH and MSA. Here is an example of a valid application-accept ACK responding to an ADT^A01 admission message:
MSH|^~\&|EHR_APP|GENERAL_HOSPITAL|ADT_SYSTEM|CITY_CLINIC|20260410143022||ACK^A01|ACK202604101430223847|P|2.5
MSA|AA|MSG-20260410-00423|
In this example:
- MSH-3 (EHR_APP) and MSH-4 (GENERAL_HOSPITAL) are the original message's MSH-5 and MSH-6 — swapped back to route the ACK to the EHR.
- MSH-5 (ADT_SYSTEM) and MSH-6 (CITY_CLINIC) are the original message's MSH-3 and MSH-4 — the ACK is addressed to the ADT system.
- MSH-9 is ACK^A01 — the ACK message type referencing the original trigger event A01.
- MSH-10 (ACK202604101430223847) is a new unique control ID for the ACK itself.
- MSA-1 (AA) indicates successful processing.
- MSA-2 (MSG-20260410-00423) is the control ID from the original ADT^A01 message's MSH-10.
Practical Implications for Integration Teams
Understanding ACK codes and MSH mirroring has direct practical value for anyone building, testing, or maintaining HL7 interfaces.
Testing New Interfaces
When commissioning a new HL7 interface without a live receiving system, teams often need to generate synthetic ACK responses to validate that the sending system handles them correctly. A generated AA ACK confirms the sending system correctly marks messages as processed. A generated AR ACK verifies the sending system escalates unrecognized message types appropriately. These tests can be performed before the receiving system is available using manually crafted or tool-generated ACKs.
Diagnosing Retransmission Issues
When an interface is retransmitting messages despite an apparent ACK exchange, the most common cause is a MSA-2 mismatch or an incorrect MSH routing in the ACK. Comparing a captured ACK against the original message's MSH fields — field by field — quickly reveals whether the receiving system is generating conformant ACKs. The mirror panel in the HL7 ACK Generator provides exactly this comparison in a structured, visual format.
Writing Interface Specifications
Including sample ACK messages in interface specifications — one for each of AA, AE, and AR scenarios — helps both the sending and receiving teams agree on expected behavior before implementation begins. A specification that only documents the trigger message but omits the acknowledgment leaves ambiguity about how errors should be communicated and how retransmission should be triggered.