Discontinued drugs and inactive NDCs: what to do
Keep two views of your catalog. New picks should come only from what is on the market today. Lookups by a saved id, a printed NDC or a claim still need an answer for products that have left, even when the answer is “this is gone, and here is what replaced it”. A catalog that holds only what is on sale today loses what your members still take. A table you loaded once never learns that anything left.
Products leave the market all the time. A brand is withdrawn when a generic takes over, a strength stops being made, or a product moves to a new labeler and is listed under new codes.
What “discontinued” breaks
Search goes first. A member types “Zofran”. The brand may be long gone, but people still call ondansetron that, and if the name has dropped out of your index the member finds nothing and decides your app is broken.
Saved lists go next. A member saved a medication last year, and it is still in their cabinet and still in their bottle. If the lookup for that id now returns a bare 404, your app shows a blank row, or drops it.
Barcodes and claims are the quiet case. An old package still has its NDC printed on it, and claims history holds codes that are no longer listed. A lookup for one of those should still lead somewhere, even if where it leads is “no longer listed”.
Two questions, two answers
Keep what can a member pick today apart from what did this code or id mean:
- New picks come from what is on the market. When a member types a brand that’s gone, take them to the medicine it was, and leave the old product out.
- Lookups of something saved should say clearly when it is no longer listed, and point to what answers for it now.
How Pillwise handles each
Search answers to old brand names. Type one that has left the market and you get the medicine: the hit shows the name typed, with the ingredient as its subtitle, and the pick is the medicine you can get today.
GET /v1/drugs/search?q=zofran
Trimmed to the first hit:
{
"hits": [
{ "id": "pw_d_c2f41ba38eac186e", "display_name": "Zofran", "subtitle": "ondansetron", "pick_level": "ingredient", "rxcui": "26225" }
]
}
Once the member picks, GET /v1/drugs/{id}/form-options leaves out strengths that are no longer sold (as long as some still are), so every choice is a product on the market. The medication autocomplete API page has the whole search contract.
A retired id says where it went. A drug id stays the same for as long as its drug is in the catalog. When the catalog retires one, GET /v1/drugs/{id} answers 404 with what answers for it now, best first, and when it was last listed:
{
"error": "not_found",
"message": "pw_d_… is no longer in the catalog; pw_d_… answers for it",
"superseded_by": ["pw_d_…"],
"last_version": "2026…T…Z",
"last_seen": "2026-…"
}
superseded_by is empty when nothing answers for it. Either way, ?graph_version= with the last_version shows the drug as it was, as long as that version is less than a year old.
NDCs work differently. An NDC lookup answers from today’s catalog, so a package that is no longer listed returns 404. That settles “is this on the market”. A claim or an audit needs to know what the code was on the day it was used, which the next section covers. Also keep the drug id and RxCUI you resolved when you first saw the NDC; NDC to RxCUI, and back covers what to store.
Keep the history
Every Pillwise answer carries as_of: the date it was true. Store that with whatever a member saved. When you need to know what a code meant on a past day, for an audit or a support ticket, ask for that day:
GET /v1/drugs/ndc/50580-488-10?as_of=YYYY-MM-DD
Pinned lookups go up to a year back. An older date answers 410 gone_graph with the oldest version available, so anything further back comes from what you stored.
A checklist
- Hide off-market products from new picks, but keep them findable by the names people still use.
- Never let a saved id or a printed NDC fail silently. Show “no longer listed since…” and offer the replacement.
- Store the source code, the id it resolved to and the date with every answer, so you can explain what was true when.
- Re-check saved items against current status, so a member hears about a recall or discontinuation of something they take.
GET /v1/recalls?drug_id=or?ndc=answers for one item.
Codes change as well as products. When RxCUIs change covers retired, remapped and merged concepts.
Keeping all that current is the part Pillwise does for you. Try medication search in your browser, or get a sandbox key and look up the oldest NDC in your data.