Tata 1mg Product Substitutes
tata-1mg.product.substitutes
Read a product's public substitute list with each alternative's per-unit price and cheaper or costlier relation.
At a glance
- Endpoint ID
tata-1mg.product.substitutes- Price
- 1 credit per call; failed calls are free
- Runs for up to
- 45 seconds
Request
Send the endpoint ID as capability and its fields as input. Set UPSCRAPE_API_KEY to your key first.
curl --request POST \ --url https://data.upscrape.com/execute \ --header "Authorization: Bearer $UPSCRAPE_API_KEY" \ --header "Content-Type: application/json" \ --header "Prefer: wait=30" \ --data '{ "capability": "tata-1mg.product.substitutes", "input": { "limit": 10, "max_pages": 1, "page": 1, "url": "https://www.1mg.com/drugs/dolo-650-tablet-74467" }}'
import jsonimport osimport requestspayload = json.loads(r'''{ "capability": "tata-1mg.product.substitutes", "input": { "limit": 10, "max_pages": 1, "page": 1, "url": "https://www.1mg.com/drugs/dolo-650-tablet-74467" }}''')response = requests.post( "https://data.upscrape.com/execute", headers={ "Authorization": f"Bearer {os.environ['UPSCRAPE_API_KEY']}", "Content-Type": "application/json", "Prefer": "wait=30", }, json=payload,)response.raise_for_status()print(json.dumps(response.json(), indent=2))
const response = await fetch("https://data.upscrape.com/execute", { method: "POST", headers: { "Authorization": `Bearer ${process.env.UPSCRAPE_API_KEY}`, "Content-Type": "application/json", "Prefer": "wait=30", }, body: JSON.stringify({ "capability": "tata-1mg.product.substitutes", "input": { "limit": 10, "max_pages": 1, "page": 1, "url": "https://www.1mg.com/drugs/dolo-650-tablet-74467" }}),});if (!response.ok) { throw new Error(`Upscrape request failed: ${response.status}`);}console.log(JSON.stringify(await response.json(), null, 2));
Input
| Field | Type | Required | What it does | Example |
|---|---|---|---|---|
url |
string | yes | Public URL of the page to fetch. | https://www.1mg.com/drugs/dolo-650-tablet-74467 |
limit |
integer | no | Maximum number of results to return. From 1 to 100. Default: 12. |
10 |
max_pages |
integer | no | Maximum number of result pages to fetch. From 1 to 10. Default: 1. |
1 |
page |
integer | no | One-based result page to fetch. From 1 to 100. Default: 1. |
1 |
Response
A finished call answers with HTTP 200; the data is in results[0].data, and billing.credits_charged is what it cost. A call still running after the wait answers 202: see jobs and results.
This is results[0].data from a real run:
{ "product_id": "74467", "product_url": "https://www.1mg.com/drugs/dolo-650-tablet-74467", "total": 4, "substitutes": [ { "name": "Leemol 650mg Tablet", "price": 1.57, "currency": "INR", "price_unit": "tablet", "product_id": "542355", "relation": "24% cheaper", "url": "https://www.1mg.com/drugs/leemol-650mg-tablet-542355" }, { "name": "Sumo L 650 Fast Tablet", "price": 2.14, "currency": "INR", "price_unit": "tablet", "product_id": "1138272", "relation": "3% costlier", "url": "https://www.1mg.com/otc/sumo-l-650-fast-tablet-otc1138272" } ]}
Fields
| Field | Type | Example |
|---|---|---|
substitutes[].name |
string | Leemol 650mg Tablet |
substitutes[].price |
number | 1.57 |
substitutes[].currency |
string | INR |
substitutes[].price_unit |
string | tablet |
substitutes[].product_id |
string | 542355 |
substitutes[].relation |
string | 24% cheaper |
substitutes[].url |
string | https://www.1mg.com/drugs/leemol-650mg-tablet-542355 |
product_id |
string | 74467 |
product_url |
string | https://www.1mg.com/drugs/dolo-650-tablet-74467 |
substitutes |
array | 3 records |
total |
integer | 4 |
If a call fails
A failed call costs nothing. The response carries an error.code you can branch on; Errors and retries lists every code and which ones to retry.
Other Tata 1mg endpoints
Something missing or unclear? Ask the team that builds the Tata 1mg endpoints.