Reference·RXA Segment·RXA-21
HL7 v2 Reference

Understanding HL7 v2 RXA-21: Action Code in Practice

Jul 27, 2026 · 4 min read
← RXA-20

RXA-21 tells the receiving system what to do with the record, not just what happened clinically. Get delete handling wrong here and a corrected message can leave a duplicate dose sitting in someone's immunization history.

Quick answer

RXA-21 is the Action Code, indicating whether the receiving system should add, update, or delete the administration record described by the segment. It is most often seen in immunization registry feeds where a prior submission needs to be corrected or retracted.

Valid code values

A
Add — create a new administration record — the default for most first-time submissions
U
Update — modify an existing record, typically matched by the give sub-ID and patient/encounter identifiers
D
Delete — retract a previously submitted administration, e.g. after a documentation error

Example

Synthetic example Generated by Synthibase
RXA|0|1|20260726090000||08^Hep B, adult^CVX|0.5|mL^^UCUM|||||||||||CP|A

RXA-21 holds A, marking this synthetic administration as a new record to add.

Where this trips people up

Delete and update handling is the part of RXA-21 that almost never gets tested, because it requires simulating a prior message that the new one is supposed to reconcile against — most generators only ever produce standalone "A" segments. A receiving system that doesn't correctly match a "D" action back to the original record by its identifying fields will either silently ignore the delete or, worse, remove the wrong administration entirely, and neither failure shows up until a registry audit flags a mismatch.

HL7 v2 RXA Segment Guide: Fields, Format, and Testing Gotchas
Regression Testing for EHR Upgrades: A Complete Guide
Healthcare API Testing Guide: FHIR and X12
Test add, update, and delete reconciliation together
Synthibase can generate linked RXA message sequences — an initial add followed by a matching update or delete — so reconciliation logic gets tested against the exact scenario that catches most teams off guard.
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.