Reference·HL7 v2·MSA
HL7 v2 Reference

HL7 v2 MSA Segment Guide: Fields, Format, and Testing Gotchas

Jul 28, 2026 · 6 min read

MSA is the entire payload of a bare-bones ACK message, and it is the segment interface engines check first to decide whether a message actually made it through — get the mapping wrong here and a sending system can sit there believing a message landed when it never did.

Quick answer

MSA is the Message Acknowledgment segment in HL7 v2. It appears in ACK messages and tells the sending system what happened to the message it just transmitted: whether it was accepted (AA), errored (AE), or rejected (AR), and it echoes back the original message's control ID so the sender can match the acknowledgment to the right outbound message. An optional text field can carry human-readable detail about what went wrong.

The fields that actually matter in practice

MSA-1 →
Acknowledgment Code — the accept/error/reject verdict for the message being acknowledged — the single value most interface engines branch on
MSA-2 →
Message Control ID — echoes MSH-10 from the original inbound message so the sender can correlate this ACK with the message it responds to
MSA-3 →
Text Message — optional free-text explanation, most useful — and most often populated — when MSA-1 is AE or AR

Example

Synthetic example Generated by Synthibase
MSA|AE|SYNTHIB00045821|Patient identifier not found in master index

A synthetic MSA segment acknowledging a message with an application error — the control ID and error text are both fabricated for this example.

Where this trips people up

A lot of test suites only ever generate happy-path ACKs with AA and an empty MSA-3, because that is the response a healthy integration returns most of the time. That leaves the retry, alerting, and error-logging logic that fires on AE and AR completely unexercised until a real outage happens. The other frequent miss is treating MSA-2 as decorative: if a test generator doesn't actually thread the original MSH-10 value into the ACK's MSA-2, correlation logic that matches acknowledgments back to sent messages never gets a real test, and a sender can end up waiting indefinitely on a response that already arrived under the wrong control ID.

EDI 999 vs 997: What's the Difference and Why It Matters
How to Write EDI Test Cases That Actually Catch Go-Live Failures
Generate ACK messages that cover the full acceptance spectrum
Synthibase produces synthetic ACK messages with correctly correlated control IDs across accept, error, and reject codes, so your retry and error-handling logic gets tested against every outcome, not just the happy path.
Start free trial →
This page is written independently by Synthibase for testing and informational purposes. It is not an official publication of HL7 International or X12/Washington Publishing Company, and is not a substitute for reviewing the official standard or your trading partner's companion guide. See our Terms of Service for full legal terms.