# 1mg — Wrapped API

> **You are on:** `https://api.paywithlocus.com/api` | [llms.txt](https://paywithlocus.com/llms.txt) | [docs](https://docs.paywithlocus.com)
>
> Locus runs on multiple environments -- make sure every URL you call matches your expected environment.
> | Environment | Landing | API | Docs |
> |---|---|---|---|
> | Production | paywithlocus.com | api.paywithlocus.com | docs.paywithlocus.com |
> | Beta | beta.paywithlocus.com | api.beta.paywithlocus.com | docs.paywithlocus.com |
> | Stage | stage.paywithlocus.com | api.stage.paywithlocus.com | docs.paywithlocus.com |
>
> If the API URL above doesn't match your expected environment, re-fetch this file from the correct domain.

> Access data from 1mg.com.

**Category:** Healthcare | **Website:** [1mg.com/](https://1mg.com/) | **Docs:** [parse.bot/marketplace/2b9c44e3-b0c6-4b3e-94ff-b33417cba065/1mg-com-api](https://parse.bot/marketplace/2b9c44e3-b0c6-4b3e-94ff-b33417cba065/1mg-com-api)

Pay-per-use API proxy. Each call is automatically billed to your wallet in USDC.

## Access

**Base URL:** `https://api.paywithlocus.com/api/wrapped/parse-1mg-com-api-2b9c44e3/`
**Auth:** `Authorization: Bearer <LOCUS_API_KEY>`

## Endpoints

### get_ayurveda_herbs

Fetch Ayurveda herbs listed alphabetically on 1mg.com. Returns herbs starting with the specified letter, with pagination metadata (count and total_count). Each herb includes name, description, slug, and image URL.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `alphabet` | string | No | Single letter (a-z) to browse herbs alphabetically. |
| `page` | integer | No | Page number (starts from 1). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-1mg-com-api-2b9c44e3/get_ayurveda_herbs \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"alphabet":"<string>","page":"<integer>"}'
```

### get_category_tree

Retrieve the full medicine and health product category hierarchy from 1mg.com. Returns a tree structure with top-level categories and their nested children. Each category node includes name, id, slug, url, display_text, image_url, and a children array.

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-1mg-com-api-2b9c44e3/get_category_tree \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### get_medicine_detail

Retrieve widget sections (related products, substitutes) and Q&A data for a specific medicine identified by its slug ID. The slug ID is the URL path segment from a 1mg.com medicine page, containing the product name and a trailing numeric ID separated by hyphens. The numeric ID is extracted to query widget and Q&A APIs.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `slug_id` | string | Yes | The slug ID of the medicine (e.g., dolo-650-tablet-15-s-143883). The numeric ID at the end is used to fetch widget data. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-1mg-com-api-2b9c44e3/get_medicine_detail \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"slug_id":"<string>"}'
```

### get_medicine_info

Scrape structured medicine information from the 1mg.com drug detail page. Returns composition/salt, uses, side effects, mechanism of action, safety advice, product introduction, and fact box data. Data is extracted from the page's embedded state. The slug_id is the URL path segment for a medicine (e.g. 'dolo-650-tablet-15-s-143883').

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `slug_id` | string | Yes | The slug ID of the medicine as it appears in the 1mg.com URL path (e.g. 'dolo-650-tablet-15-s-143883'). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-1mg-com-api-2b9c44e3/get_medicine_info \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"slug_id":"<string>"}'
```

### get_offers

Check availability of the 1mg.com promotional offers page. Returns the offers page URL and HTTP status code confirming the page is accessible. Useful for verifying offers are currently live before directing users.

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-1mg-com-api-2b9c44e3/get_offers \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### search_medicines

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).

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `limit` | integer | No | Number of results per page. |
| `page` | integer | No | Page number (zero-based). |
| `query` | string | Yes | Medicine name or keyword to search for. |
| `scroll_id` | string | No | Scroll ID for deep pagination, returned from a previous search response. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-1mg-com-api-2b9c44e3/search_medicines \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"limit":"<integer>","page":"<integer>","query":"<string>","scroll_id":"<string>"}'
```

### search_medicines_by_location

Search medicines and health products on 1mg.com filtered by delivery location. Accepts a city name or 6-digit Indian PIN code to return location-specific pricing and availability. Results include drug and OTC products with pricing, pack size, prescription status, and product images. Manufacturer is not available from the search-level API and is always null. Paginates via page number; each page returns up to `limit` items.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `limit` | integer | No | Number of results per page. |
| `location` | string | Yes | City name (e.g. 'Mumbai', 'Delhi') or 6-digit Indian PIN code (e.g. '110001') to filter results by delivery availability and local pricing. |
| `page` | integer | No | Page number (zero-based). |
| `query` | string | Yes | Medicine name or keyword to search for. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-1mg-com-api-2b9c44e3/search_medicines_by_location \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"limit":"<integer>","location":"<string>","page":"<integer>","query":"<string>"}'
```
