# 1mg — Wrapped API

> **You are on:** `https://api.beta.paywithlocus.com/api` | [llms.txt](https://beta.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 for Locus Pro. Each call burns credits from your workspace balance.

## Access

**Base URL:** `https://api.beta.paywithlocus.com/api/wrapped/credits/1mg/`
**Auth:** `Authorization: Bearer <LOCUS_CREDITS_SECRET_KEY>` (an `lcr_` secret key or a scoped `lcac_` agent credential)
**Required header:** `Idempotency-Key: <fresh UUID per call>`. A retry with the same key replays the stored result without a new charge.
**Response:** the provider response after any endpoint-specific normalization. `X-Locus-Credits-Charged` carries the charge and `X-Locus-Credits-Balance` the remaining balance. Insufficient credits return `402` before the provider is called.
**Pricing:** estimated costs below are USD. Locus debits the credit equivalent at your workspace rate.

Full call contract: https://docs.paywithlocus.com/api-reference/introduction

> Using a Pay With Locus wallet key (`claw_` prefix)? Wallet routes are documented separately: https://docs.paywithlocus.com/wrapped-apis/for-agents

## 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.beta.paywithlocus.com/api/wrapped/credits/1mg/get-ayurveda-herbs \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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.beta.paywithlocus.com/api/wrapped/credits/1mg/get-category-tree \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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.beta.paywithlocus.com/api/wrapped/credits/1mg/get-medicine-detail \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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.beta.paywithlocus.com/api/wrapped/credits/1mg/get-medicine-info \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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.beta.paywithlocus.com/api/wrapped/credits/1mg/get-offers \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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.beta.paywithlocus.com/api/wrapped/credits/1mg/search-medicines \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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.beta.paywithlocus.com/api/wrapped/credits/1mg/search-medicines-by-location \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"limit":"<integer>","location":"<string>","page":"<integer>","query":"<string>"}'
```

## Next steps

- [All wrapped API providers](https://beta.paywithlocus.com/wapi/index.md): pick another provider.
- [Find and call tools](https://beta.paywithlocus.com/agent/tools.md): price ceilings, async results, and errors.
- [Credits and billing](https://beta.paywithlocus.com/agent/billing.md): what a call costs and how to add credits.
- [Agent docs index](https://beta.paywithlocus.com/agent/index.md): every Locus agent page.