1mg API1mg.com ↗
Access 1mg.com medicine search, product details, Ayurveda herbs, category tree, and offers data via a structured REST API with 5 endpoints.
What is the 1mg API?
The 1mg.com API exposes 5 endpoints covering medicine search, product detail pages, Ayurveda herb listings, and the full category hierarchy from India's largest online pharmacy. The search_medicines endpoint returns both generic drugs and branded products with pagination via scroll_id, while get_medicine_detail delivers widget sections and Q&A content keyed by a product slug.
curl -X GET 'https://api.parse.bot/scraper/f703cd2f-7d9c-47bc-8106-6d9631d9b223/search_medicines?page=0&limit=5&query=paracetamol' \ -H 'X-API-Key: $PARSE_API_KEY'
Typed, relational, agent-ready
A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.
- Fully typed · autocompletes
- Objects link to objects
- Typed errors & pagination
Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:
uv add parse-sdk uv run parse init uv run parse add --marketplace 1mg-com-api
uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.
"""Walkthrough: 1mg.com Pharmacy API — search medicines, browse herbs, explore categories."""
from parse_apis.onemg_pharmacy_api import OneMg, Alphabet, MedicineNotFound
client = OneMg()
# Search for medicines — limit caps total items fetched across all pages.
for result in client.searchresults.search(query="paracetamol", limit=3):
print(result.name, result.type, result.url)
# Drill into a specific medicine's detail page by slug.
detail = client.medicinedetails.get(slug_id="dolo-650-tablet-15-s-143883")
print(detail.sku_id, detail.url)
for widget in detail.widgets[:2]:
print(widget.header, widget.type)
# Browse Ayurveda herbs alphabetically using the Alphabet enum.
for herb in client.herbs.list(alphabet=Alphabet.A, limit=3):
print(herb.name, herb.slug)
# Fetch category tree to discover product categories.
category = client.categories.list(limit=1).first()
if category:
print(category.name, category.id, category.display_text)
# Typed error handling: catch when a medicine slug is invalid.
try:
client.medicinedetails.get(slug_id="nonexistent-medicine-000000")
except MedicineNotFound as exc:
print(f"Medicine not found: {exc.slug_id}")
# Check offers page availability.
offers = client.offersstatuses.check()
print(offers.url, offers.status_code)
print("exercised: searchresults.search / medicinedetails.get / herbs.list / categories.list / offersstatuses.check")
Full-text search over medicines and health products on 1mg.com. Returns generic drugs and branded products matching the query. Paginates via page number or scroll_id from a previous response. Each result carries type (generic or product), identity, URL, and type-specific fields (price/rating for products, description for generics).
| Param | Type | Description |
|---|---|---|
| page | integer | Page number (zero-based). |
| limit | integer | Number of results per page. |
| queryrequired | string | Medicine name or keyword to search for. |
| scroll_id | string | Scroll ID for deep pagination, returned from a previous search response. |
{
"type": "object",
"fields": {
"query": "string, the search query echoed back",
"results": "array of search result objects, each with type, id, name, url, and additional fields depending on type",
"scroll_id": "string, pagination token for fetching the next page",
"total_found": "boolean indicating if results were found"
},
"sample": {
"data": {
"query": "paracetamol",
"results": [
{
"id": "210459",
"url": "https://www.1mg.com/generics/paracetamol-210459",
"name": "Paracetamol",
"type": "generic",
"description": "Paracetamol is used for pain relief and fever."
},
{
"id": "143883",
"mrp": 33.76,
"url": "https://www.1mg.com/drugs/dolo-650-tablet-15-s-143883",
"name": "Dolo 650 Tablet",
"type": "product",
"brand": "Micro Labs Ltd",
"image": "https://onemg.gumlet.io/example.jpg",
"price": 30.38,
"rating": 4.6,
"discount": "10% off",
"pack_size": "strip of 15 tablets",
"availability": true,
"rating_count": 1200
}
],
"scroll_id": "HmIUzR6-j5-655J_cjOIiU4A_8u3CuIixjhNDHn9Rw8=",
"total_found": true
},
"status": "success"
}
}About the 1mg API
Medicine Search and Product Data
The search_medicines endpoint accepts a query string and returns an array of results, each typed as either generic or product, with fields including id, name, and url. Deep pagination is handled through a scroll_id token returned in each response — pass it back in the next request instead of incrementing page. The total_found field confirms whether the query produced results. The get_medicine_detail endpoint takes a slug_id (for example, dolo-650-tablet-15-s-143883) and returns widgets (related product sections), qna (questions and answers), the full page url, and the extracted sku_id.
Ayurveda Herbs and Category Tree
The get_ayurveda_herbs endpoint lets you browse herb listings alphabetically using the alphabet parameter (a–z) with standard page-based pagination. Each herb object in the ayurvedas array includes name, description, slug, and image_url. The meta object provides count and total_count for building paginated views. The get_category_tree endpoint takes no parameters and returns the complete product taxonomy as a udp_tree array — each node carries name, id, slug, url, children, image_url, and display_text, covering the full top-to-leaf hierarchy in one call.
Offers Page Status
The get_offers endpoint is scoped to confirming that the 1mg.com promotions page is reachable, returning the page url and its HTTP status_code. Because offers content is server-side rendered and dynamic, the endpoint does not return individual offer details or structured deal data.
The 1mg API is a managed, monitored endpoint for 1mg.com — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when 1mg.com changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.
This isn't an official 1mg.com API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.
Will this API break when the source site changes?+
Is this an official API from the source site?+
Can I fix or extend this API myself if I need a new endpoint or field?+
What happens if I call an endpoint that has an issue?+
- Build a medicine price-comparison tool using product names and URLs from
search_medicines - Populate a drug information card using
widgetsandqnadata fromget_medicine_detail - Create an Ayurveda herb encyclopedia by iterating
get_ayurveda_herbsacross all 26 alphabet letters - Generate a navigable pharmacy category directory from the
udp_treereturned byget_category_tree - Distinguish generic vs branded drug listings in search results using the
typefield insearch_medicines - Sync a health app's herb database using
name,description, andimage_urlfields from herb listings
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 100 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 100 req/min |
One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.
Does 1mg have an official public developer API?+
How does pagination work in `search_medicines`?+
page integer parameter starting from 0, or use the scroll_id token returned in each response to fetch the next page of deep results. scroll_id is preferable for iterating through large result sets because it maintains consistent result ordering across pages.What data does `get_medicine_detail` return, and what does it not include?+
widgets (related product sections), a qna object with community questions and answers, the full page url, and the sku_id. It does not currently return structured pricing, stock availability, or seller information as discrete fields. You can fork the API on Parse and revise it to add an endpoint targeting those fields.Does the API return actual promotional deals or discount details from the offers page?+
get_offers endpoint only returns the offers page url and its HTTP status_code — it does not return structured deal objects, coupon codes, or discount percentages. You can fork the API on Parse and revise it to add an endpoint that parses individual offer listings.