PharmData APIpharmdata.co.uk ↗
Access UK pharmacy dispensing stats, NHS service data, EPS nominations, MHRA drug safety alerts, and LPC rankings via the PharmData API.
What is the PharmData API?
The PharmData API provides 8 endpoints covering UK pharmacy profiles, NHS dispensing trends, and MHRA safety alerts sourced from PharmData.co.uk. The get_pharmacy_detail endpoint returns monthly items-dispensed trends, EPS nomination counts, prescription sources, and service reports (Flu, COVID, TSP) for any individual pharmacy identified by its ODS/NACS code. National chain performance, area leaderboards, and LPC rankings are also available.
curl -X GET 'https://api.parse.bot/scraper/ec6a96d0-fd3d-4100-bfc2-07a4720d908d/search?query=SW1A' \ -H 'X-API-Key: $PARSE_API_KEY'
Typed, relational, agent-ready
A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.
- Fully typed · autocompletes
- Objects link to objects
- Typed errors & pagination
Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:
uv add parse-sdk uv run parse init uv run parse add --marketplace pharmdata-co-uk-api
uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.
from parse_apis.pharmdata_api import PharmData, Pharmacy, Area, Alert, AlertDetail, LeaderboardEntry, Trend
client = PharmData()
# Search for pharmacies by postcode
for pharmacy in client.pharmacies.search(query="SW1A"):
print(pharmacy.name, pharmacy.nacs, pharmacy.address, pharmacy.relevance)
# Get detailed profile for a specific pharmacy
profile = client.pharmacy(nacs="FFF12").profile.get()
print(profile.nacs, profile.items_data, profile.flu_report)
# List all NHS areas and get the leaderboard for one
for area in client.areas.list():
print(area.name)
# Get leaderboard for a specific area
for entry in client.area(name="Community Pharmacy Essex").leaderboard.list():
print(entry.name, entry.nacs, entry.items_dispensed)
# Get national dispensing trends
trends = client.trends.get()
print(trends.multiples_performance, trends.global_trends)
# List MHRA alerts and get details for one
for alert in client.alerts.list():
print(alert.title, alert.date)
detail = alert.detail.get()
print(detail.content, detail.mhra_url)
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.
| Param | Type | Description |
|---|---|---|
| queryrequired | string | Search keyword — pharmacy name, UK postcode, or ODS code. |
{
"type": "object",
"fields": {
"results": "array of matching locations with type, name, nacs, address, and relevance score"
},
"sample": {
"data": {
"results": [
{
"nacs": "FFF12",
"name": "DR HARRIS & CO CHEMISTS",
"type": "mortar-pestle",
"address": "29 ST JAMES'S STREET, SW1A 1HB",
"relevance": 15.08
}
]
},
"status": "success"
}
}About the PharmData API
Pharmacy Search and Profiles
The search endpoint accepts a name, postcode, or ODS code as query and returns an array of matching pharmacies, GP surgeries, and dispensing doctors, each with a nacs code, address, type, and relevance score. That nacs code is the key input for get_pharmacy_detail, which returns a full profile including items_data (monthly dispensing volume trend), eps_nominations, nearest_pharmacies, prescription_sources, and flu_repo service report data. This makes it straightforward to build per-site performance dashboards or compare a pharmacy against its local competitors.
National Trends and Area Leaderboards
get_national_stats returns two top-level fields: global_trends (national NHS dispensing percentage arrays) and multiples_performance (chain-level arrays covering major pharmacy groups such as Boots, Lloyds, and Well). For regional analysis, get_areas lists all available NHS Area Teams and LPCs by name. Passing one of those names to get_area_leaderboard returns a ranked list of pharmacies in that area with each entry showing name, nacs, and items_dispensed. The get_lpc_ranking endpoint extends this with KPI-level ranking — for example, Pharmacy First consultation volumes — and accepts optional kpi and month (YYYY-MM-DD) parameters.
MHRA Drug Safety Alerts
list_mhra_alerts returns all current MHRA alerts and recalls as an array, each with title, alert_id, date, and response_deadline. Passing an alert_id to get_mhra_alert_detail retrieves the full alert including a content text summary and, where available, an mhra_url linking directly to the source article on the MHRA website. This makes it practical to pipe drug safety notices into internal compliance workflows or pharmacy management systems without manually monitoring the MHRA website.
The PharmData API is a managed, monitored endpoint for pharmdata.co.uk — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when pharmdata.co.uk changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.
This isn't an official pharmdata.co.uk API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.
Will this API break when the source site changes?+
Is this an official API from the source site?+
Can I fix or extend this API myself if I need a new endpoint or field?+
What happens if I call an endpoint that has an issue?+
- Track monthly items-dispensed trends for individual pharmacies using
items_datafromget_pharmacy_detail. - Build a regional pharmacy leaderboard by combining
get_areasandget_area_leaderboardto rank sites by dispensing volume. - Monitor MHRA drug recalls and response deadlines with
list_mhra_alertsand alert to relevant staff beforeresponse_deadlinepasses. - Compare EPS nomination counts across competing pharmacies in a local area to inform site acquisition decisions.
- Benchmark national pharmacy chain performance using
multiples_performancedata fromget_national_stats. - Power a Pharmacy First service dashboard by pulling LPC rankings via
get_lpc_rankingfiltered by KPI code and month. - Cross-reference a pharmacy's prescription sources with its flu and COVID service reports for contract compliance reporting.
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 100 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 100 req/min |
One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.
Does PharmData.co.uk have an official developer API?+
What does `get_pharmacy_detail` return beyond basic address information?+
nacs code. Fields include items_data (a monthly dispensing trend array), eps_nominations, nearest_pharmacies, prescription_sources, and flu_repo (Flu, COVID, and TSP service report data). It does not return raw prescription line-level data or patient identifiers.Does the API cover GP surgery dispensing data, not just pharmacies?+
search endpoint returns GP surgeries and dispensing doctors alongside pharmacies. However, the detailed profile endpoint (get_pharmacy_detail) is scoped to pharmacies, and dedicated GP-level dispensing breakdowns are not currently exposed. You can fork this API on Parse and revise it to add a GP-detail endpoint if that coverage is needed.Is historical dispensing data available for past years, or only recent months?+
items_data field in get_pharmacy_detail reflects the trend data PharmData publishes, which covers recent monthly periods. There is no parameter to request a specific historical date range. If you need deeper historical archives, you can fork this API on Parse and revise it to target the relevant historical data pages.What does `get_lpc_ranking` return, and how granular is the KPI filtering?+
month in YYYY-MM-DD format. The available KPI codes correspond to NHS service metrics published by PharmData. If a specific KPI code is not passed, the endpoint returns its default ranking set. The full enumeration of valid KPI codes is not documented inline — test against the get_areas output for valid area names, and consult PharmData's published service categories for KPI codes.