# 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 for Locus Pro. Each call burns credits from your workspace balance.

## Access

**Base URL:** `https://api.paywithlocus.com/api/wrapped/credits/pharmdata/`
**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 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/credits/pharmdata/get-area-leaderboard \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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/credits/pharmdata/get-areas \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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/credits/pharmdata/get-lpc-ranking \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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/credits/pharmdata/get-mhra-alert-detail \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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/credits/pharmdata/get-national-stats \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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/credits/pharmdata/get-pharmacy-detail \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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/credits/pharmdata/list-mhra-alerts \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -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/credits/pharmdata/search \
  -H "Authorization: Bearer $LOCUS_CREDITS_SECRET_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"query":"<string>"}'
```

## Next steps

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