Oushodh logooushodh

How to keep your stock list current as medicine data changes

By Al Amin Ahamed · Published · Updated · 7 min read

Short answer

Once a day, ask GET /v1/meta whether the data changed, then list the medicines changed since your last run with updated_since. Flag the stock items your mapping table links to them, and let a person check each one. Never change a past sale: it keeps the medicine's uuid and the price you charged.

Key facts

  • updated_since lists only medicines changed at or after a time, oldest change first, up to 500 a pageList medicines, API reference, 30 Nov, 2026
  • Medicines are never deleted and an ID never points to another medicineIDs, API guide, 30 Nov, 2026
  • You may keep data that has become part of your own records, such as an order or an invoiceTerms of use, 30 Nov, 2026
  • A full copy of the data needs a separate written licence on a Custom planTerms of use, 30 Nov, 2026

Once your stock items point at Oushodh medicines, the data under them keeps moving. DGDA registers new medicines, a price changes, a maker’s name is corrected. Your software needs to notice the changes that touch the items you stock, without copying the data and without touching a sale you made last year. This guide shows a small scheduled job that does that.

What can change on a medicine you stock?

What changes Where you see it What your job does
A new medicine is added It is in the list of changes Search your unmatched items again
A price prices Flag the item for a person to check your price
A brand, maker or name spelling brand, product_name, manufacturer Flag the item if you print the name
A DGDA registration is linked dgda_listed turns true Nothing, unless you show the badge
The ID you stored is an old one Get a medicine answers with the current id Save the new id; the uuid stays

What does not change is as useful. Medicines are never deleted, and an ID never points to another medicine, so a uuid in your mapping table never goes stale. Oushodh also has no field that says a medicine is no longer made. Whether you keep selling one is your decision, from your own sales and suppliers.

How does the API say what changed?

GET /v1/medicines with updated_since answers only the medicines changed at or after that time, oldest change first. Each medicine’s last_updated says when any of its fields last changed, and a new medicine counts as a change. Pages hold up to 500 medicines, and you pass next back as cursor until it is null.

Before that, one call to GET /v1/meta tells you whether there is anything to read. Its last_import is the time of the last import. If it is the same as on your last run, nothing has changed, and the job can stop after one request.

Flowchart: 1, GET /v1/meta tells whether the data changed since your last run. 2, list the medicines changed since then with updated_since, to the last page. 3, keep only the uuids your mapping table holds. 4, flag those stock items for a person to check. Past sales never change.
One run of the job: check, list the changes, keep only yours, flag for a person.

What does the job look like?

It reads each change, keeps only the uuid and the time, and flags the stock items your mapping table links to that uuid:

import os
import requests

API = "https://api.oushodh.dev/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['OUSHODH_API_KEY']}"}


def changed_since(since):
    cursor = None
    while True:
        params = {"updated_since": since, "limit": 500}
        if cursor:
            params["cursor"] = cursor
        r = requests.get(f"{API}/medicines", headers=HEADERS, params=params, timeout=30)
        r.raise_for_status()
        page = r.json()
        for m in page["items"]:
            yield m["uuid"], m["last_updated"]
        cursor = page["next"]
        if cursor is None:
            return


since = load_since()                  # the newest last_updated from your last run
mine = set(load_mapped_uuids())       # medicine_uuid from your mapping table
newest = since
for uuid, updated in changed_since(since):
    newest = max(newest, updated)
    if uuid in mine:
        flag_for_review(uuid)         # marks your stock items; stores no API data
save_since(newest)

load_since, load_mapped_uuids, flag_for_review and save_since are yours, on your own tables. The first run needs a starting time: use the time you finished the first match, in UTC and written like 2026-11-08T09:30:00Z, or the API answers 400 bad_request. “At or after” means the medicine that set the time comes back once on the next run, so make flagging an item twice harmless.

When the list holds new medicines, search your items with status set to none or review again, as in connecting your inventory. A new medicine can be the one an item was waiting for.

What does a person check on a flagged item?

The reviewer’s screen gets the medicine with GET /v1/medicines/{ref} when it opens, and shows it beside your stock item. The person decides whether your own selling price, your shelf label or your item name needs changing, and changes it in your system. The job never writes those for them.

That split matters for prices. prices holds each MRP a source states, per unit, per strip or per pack, and names the source. Your item’s price is what you charge, which you set. MRP in Bangladesh explains each price the API gives.

Why must past sales never change?

Because a sale is a record of what happened. A sale line keeps the medicine’s uuid and id, the name printed on the invoice, the quantity and the price you charged. The terms let you keep data that has become part of your own records, such as an order or an invoice, so that line stays as it was, whatever the medicine’s price is today.

So never show an old sale by joining it to the current medicine for its price or name. Show what the sale line holds. Join on the uuid only to open the medicine as it is now.

How often should the job run?

Each run costs one request when nothing changed, and one more for each page of up to 500 changes when something did. Once a day is a sensible start. Running more often costs little, since a run with nothing new stops after the /v1/meta check.

The job never keeps a copy of the medicines, and that is deliberate. The terms of use do not allow storing API responses or building a database from them. If your software has to work from a full copy of the data, for example with no internet, that needs a separate written licence on a Custom plan. Talk to us about it. The integration overview sets out what every plan allows and what a Custom licence adds.

Share this post

FAQ

  • How do I find out which medicines changed?

    List medicines with updated_since set to the newest last_updated you saw, and pass next back as cursor until it is null. A new medicine counts as a change.

  • What happens to a medicine that is no longer made?

    It stays. Medicines are never deleted, and there is no field that marks one as no longer made. Whether you keep selling it is your decision.

  • Should the job update my prices by itself?

    No. Your price is what you charge. The job flags the item, and a person compares it with the MRP the API states and decides.

  • Can I keep a local copy of the medicines so my software works offline?

    Not on Developer, Team or Agency. The terms do not allow storing API responses. A full copy needs a separate written licence on a Custom plan.

Sources

Choosing a data source

Fetch records changed since your last sync