Confirm the prescription has not yet been dispensed: check RxFill status or contact the pharmacy; once a prescription has been dispensed, cancellation via SCRIPT is not appropriate—a refill restriction or clinical intervention is needed instead
Construct a CancelRx transaction per NCPDP SCRIPT 2017071: populate Header with PrescriberOrderNumber matching the original NewRx, routing To/From SPI addresses, and MessageID; include Patient and Drug segments to identify the specific prescription
Transmit the CancelRx over Surescripts to the dispensing pharmacy; await a CancelRxResponse: Approved (prescription voided), Denied (prescription already dispensed or in process), or Error
If CancelRxResponse returns Denied with reason 'already dispensed', document the response and notify the prescriber; if clinical concern is urgent (e.g., wrong drug, patient allergy), contact the pharmacy directly by phone as a concurrent action
Update the EHR prescription record status to Cancelled upon confirmed CancelRxResponse Approved; ensure the cancelled order cannot be re-transmitted
For controlled substances, document the cancellation reason per DEA and state pharmacy board requirements; some states require specific documentation when a controlled substance prescription is voided
Known gotchas
There is a narrow time window for successful electronic cancellation; pharmacies often begin dispensing preparation shortly after receiving the NewRx, so a CancelRx sent minutes after the original NewRx may already return Denied
Surescripts CancelRx is a request, not a guaranteed command; the pharmacy makes the final determination of whether cancellation is possible based on their workflow state—the prescriber cannot unilaterally cancel a transmitted prescription
If the pharmacy does not respond to a CancelRx within the expected timeframe, the prescriber should not assume cancellation was successful; a phone call to the pharmacy is required to confirm the prescription will not be dispensed
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp