# Pharmdata — 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.

> Search UK pharmacies, access NHS service statistics, and retrieve pharmacy dispensing data to compare performance across regions. Monitor MHRA drug safety alerts and view LPC rankings to make informed decisions about pharmacy services and medications.

**Category:** Healthcare | **Website:** [pharmdata.co.uk/](https://pharmdata.co.uk/) | **Docs:** [parse.bot/marketplace/c47db6fb-3d75-4416-983f-4eafc15b15fd/pharmdata-co-uk-api](https://parse.bot/marketplace/c47db6fb-3d75-4416-983f-4eafc15b15fd/pharmdata-co-uk-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-pharmdata-co-uk-api-c47db6fb/`
**Auth:** `Authorization: Bearer <LOCUS_API_KEY>`

## Endpoints

### get_area_leaderboard

Get the pharmacy dispensing leaderboard for a specific NHS area or LPC. Returns pharmacies ranked by items dispensed within that area. Area names must match values returned by get_areas.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `area` | string | Yes | Name of the NHS area or LPC (from get_areas endpoint). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-pharmdata-co-uk-api-c47db6fb/get_area_leaderboard \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"area":"<string>"}'
```

### get_areas

List all available NHS Area Teams and Local Pharmaceutical Committees (LPCs). The returned area names are used as input to get_area_leaderboard to retrieve dispensing rankings within that area.

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-pharmdata-co-uk-api-c47db6fb/get_areas \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### get_lpc_ranking

Get rankings for LPCs based on specific service KPIs (e.g., Pharmacy First consultations).

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `kpi` | string | No | The KPI code to rank by |
| `month` | string | No | The month to report on (YYYY-MM-DD) |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-pharmdata-co-uk-api-c47db6fb/get_lpc_ranking \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"kpi":"<string>","month":"<string>"}'
```

### get_mhra_alert_detail

Fetch the full content of a specific MHRA alert by its unique hash ID. Returns the alert title, text summary/content, and a link to the full MHRA article when available. The alert_id is obtained from list_mhra_alerts.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `alert_id` | string | Yes | The unique hash ID of the alert (from list_mhra_alerts). |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-pharmdata-co-uk-api-c47db6fb/get_mhra_alert_detail \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"alert_id":"<string>"}'
```

### get_national_stats

Retrieve national NHS dispensing trends and pharmacy multiples (chains) performance data. Returns global_trends (national dispensing percentage arrays over time) and multiples_performance (chain-level item counts over time for major pharmacy groups like Boots, Lloyds, Well). No parameters required.

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-pharmdata-co-uk-api-c47db6fb/get_national_stats \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### get_pharmacy_detail

Fetch the full profile for a pharmacy by its ODS/NACS code. Aggregates monthly items-dispensed trends, EPS nomination data, prescription sources, nearest pharmacies, and service reports (Flu, COVID, Transitional Safeguarding Payments). Requires a valid NACS code typically obtained from the search endpoint.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `nacs` | string | Yes | Pharmacy ODS/NACS code (e.g. FFF12). Obtainable from search results. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-pharmdata-co-uk-api-c47db6fb/get_pharmacy_detail \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"nacs":"<string>"}'
```

### list_mhra_alerts

List all current MHRA (Medicines and Healthcare products Regulatory Agency) drug alerts and recalls. Returns title, alert_id, date, and response_deadline for each alert. Use alert_id with get_mhra_alert_detail for full content.

**Estimated cost:** Metered

_No parameters required._

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-pharmdata-co-uk-api-c47db6fb/list_mhra_alerts \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### search

Full-text search for pharmacies, GP surgeries, and dispensing doctors by name, postcode, or ODS code. Returns results ordered by relevance score. Each result includes a type indicator, name, NACS code, address, and relevance score. Use the NACS code from results to fetch detailed pharmacy profiles via get_pharmacy_detail.

**Estimated cost:** Metered

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `query` | string | Yes | Search keyword — pharmacy name, UK postcode, or ODS code. |

```bash
curl -X POST https://api.paywithlocus.com/api/wrapped/parse-pharmdata-co-uk-api-c47db6fb/search \
  -H "Authorization: Bearer YOUR_LOCUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"<string>"}'
```
