Public API · v1
HospitalWaits API
Free public read-only JSON API for NHS England waiting-time data. CORS-open. No auth. No rate limit. Licensed under the Open Government Licence v3.0.
Data through May 2026. Machine-readable spec at /api/openapi.json.
What this is
Nine JSON endpoints under /api/v1/*, three CSV snapshots, and an MCP server expose the same NHS RTT + DM01 + A&E data that powers the public hospitalwaits.co.uk pages. Everything is read-only and licensed for reuse under the Open Government Licence v3.0.
Underlying sources: NHS England's monthly Referral to Treatment (RTT) extract, the DM01 diagnostic waiting times, and the monthly A&E attendances and emergency admissions.
A&E data is monthly statistics, not live queue times.Never present it as tonight's wait, and never use it to advise on an emergency — 999/111 first.
Authentication & rate limits
None. The Vercel edge cache (1h fresh, 24h stale-while- revalidate) absorbs repeated queries. If you are a high-volume consumer, please email mustafa@doctor-data.co.uk so we can coordinate.
Response envelope
Every successful response carries this shape:
{
"data": ...,
"meta": { "resultCount": <n>, ... },
"source": "NHS England Referral to Treatment (RTT) waiting times",
"sourceUrl": "https://www.england.nhs.uk/statistics/...",
"lastUpdated": "2026-01-31",
"license": "Open Government Licence v3.0",
"licenseUrl": "https://www.nationalarchives.gov.uk/...",
"publisher": "HospitalWaits (Doctor Data Ltd)",
"publisherUrl": "https://hospitalwaits.co.uk",
"apiVersion": "v1",
"terms": "https://hospitalwaits.co.uk/terms",
"docs": "https://hospitalwaits.co.uk/api/docs"
}On a soft-fail (e.g. transient DB error or a known data gap), the response is still HTTP 200 with { "data": [], "error": { "code": "...", "message": "..." } } so callers never need to parse a 5xx.
License & attribution
You may reuse the data freely under Open Government Licence v3.0. Required: attribute the original NHS England source AND link back to HospitalWaits.
Suggested attribution line:
Source: NHS England RTT via HospitalWaits (https://hospitalwaits.co.uk) — Open Government Licence v3.0.
GET/api/v1/specialties
List the 18 user-facing specialties HospitalWaits tracks.
Example
curl https://hospitalwaits.co.uk/api/v1/specialties
Sample response
{
"data": [
{
"code": "C_110",
"slug": "trauma-orthopaedics",
"name": "Trauma & Orthopaedics",
"url": "https://hospitalwaits.co.uk/national/trauma-orthopaedics",
"apiUrl": "https://hospitalwaits.co.uk/api/v1/national/trauma-orthopaedics"
}
// ... 17 more
],
"meta": { "resultCount": 18 },
"source": "NHS England Referral to Treatment (RTT) waiting times",
...
}GET/api/v1/trusts
Paginated directory of all 538 NHS trusts.
Query parameters
| Name | Type | Default | Notes |
|---|---|---|---|
limit | int | 100 | 1..100 |
offset | int | 0 | 0-indexed |
Example
curl 'https://hospitalwaits.co.uk/api/v1/trusts?limit=100&offset=0'
Sample response
{
"data": [
{
"odsCode": "RAS",
"slug": "the-hillingdon-hospitals-nhs-foundation-trust",
"name": "The Hillingdon Hospitals NHS Foundation Trust",
"city": "Uxbridge",
"postcode": "UB8 3NN",
"cqcRating": "Good",
"isIndependent": false,
"url": "https://hospitalwaits.co.uk/trust/the-hillingdon-...",
"apiUrl": "https://hospitalwaits.co.uk/api/v1/wait?trust=the-hillingdon-...&specialty=<specialty-slug>"
}
// ... up to 100 per page
],
"meta": {
"resultCount": 100, "limit": 100, "offset": 0, "total": 538,
"nextUrl": "https://hospitalwaits.co.uk/api/v1/trusts?limit=100&offset=100"
},
...
}GET/api/v1/wait
Single trust × specialty RTT wait (JSON analog of /trust/<slug>/<specialty>).
Query parameters
| Name | Type | Default | Notes |
|---|---|---|---|
trust | string | (required) | Trust slug |
specialty | string | (required) | Specialty slug |
Example
curl 'https://hospitalwaits.co.uk/api/v1/wait?trust=the-hillingdon-hospitals-nhs-foundation-trust&specialty=trauma-orthopaedics'
Sample response
{
"data": {
"trust": { "odsCode": "RAS", "slug": "...", "name": "...", ... },
"specialty": { "code": "C_110", "slug": "trauma-orthopaedics", "name": "..." },
"wait": {
"medianWeeks": 14.2,
"totalWaiting": 4231,
"pctWithin18Weeks": 67.3,
"pathwayType": "incomplete",
"period": "RTT-January-2026",
"periodDate": "2026-01-31"
},
"links": { "html": "https://hospitalwaits.co.uk/trust/.../trauma-orthopaedics", ... }
},
...
}GET/api/v1/national/{specialty}
Ranked list of all trusts for a specialty (editorial floor: median > 0, list size >= 10).
Query parameters
| Name | Type | Default | Notes |
|---|---|---|---|
specialty | path | (required) | e.g. trauma-orthopaedics |
limit | int | 50 | 1..100 |
offset | int | 0 | 0-indexed |
sort | string | wait | wait | list_size | pct_within_18_weeks |
Example
curl 'https://hospitalwaits.co.uk/api/v1/national/trauma-orthopaedics?limit=10&sort=wait'
Sample response
{
"data": {
"specialty": { "code": "C_110", "slug": "trauma-orthopaedics", ... },
"stats": {
"trustCount": 198, "totalWaiting": 753912,
"medianWaitWeeks": 13.8, "pctWithin18Weeks": 64.2
},
"ranking": [
{
"rank": 1,
"odsCode": "RWH",
"slug": "east-and-north-hertfordshire-...",
"name": "East and North Hertfordshire NHS Trust",
"city": "Stevenage",
"cqcRating": "Good",
"isIndependent": false,
"trustType": "acute",
"medianWeeks": 6.4,
"totalWaiting": 1247,
"pctWithin18Weeks": 89.1,
"url": "https://hospitalwaits.co.uk/trust/.../trauma-orthopaedics",
"apiUrl": "https://hospitalwaits.co.uk/api/v1/wait?trust=...&specialty=trauma-orthopaedics"
}
// ...
]
},
"meta": {
"resultCount": 10, "limit": 10, "offset": 0, "total": 198,
"sort": "wait", "nextUrl": "...?limit=10&offset=10&sort=wait",
"methodologyNote": "Ranking excludes trusts with median = 0 weeks or total_waiting < 10 ..."
},
...
}GET/api/v1/diagnostic
DM01 single-trust diagnostic wait. Headline metric: % within 6 weeks.
Query parameters
| Name | Type | Default | Notes |
|---|---|---|---|
trust | string | (required) | Trust slug |
procedure | string | (required) | DM01_01 .. DM01_15 |
Example
curl 'https://hospitalwaits.co.uk/api/v1/diagnostic?trust=the-hillingdon-hospitals-nhs-foundation-trust&procedure=DM01_01'
Sample response
{
"data": {
"trust": { ... },
"procedure": { "code": "DM01_01", "name": "Magnetic Resonance Imaging" },
"wait": {
"medianWeeks": 5.1, "totalWaiting": 4231,
"within6Weeks": 3897, "over6Weeks": 334, "over13Weeks": 41,
"pctWithin6Weeks": 92.1,
"period": "DM01-March-2026", "periodDate": "2026-03-31"
},
"standard": {
"name": "DM01 6-week diagnostic standard",
"headlineMetric": "pctWithin6Weeks",
"target": ">=99% within 6 weeks"
},
"links": { "trustHtml": "https://hospitalwaits.co.uk/trust/..." }
},
...
}GET/api/v1/ae
Latest month's A&E performance for every English trust with a major (Type 1) emergency department. Monthly statistics — NOT live queue times.
Example
curl https://hospitalwaits.co.uk/api/v1/ae
Sample response
{
"data": [
{
"ods_code": "RXK",
"trust_slug": "sandwell-and-west-birmingham-hospitals-nhs-trust",
"trust_name": "Sandwell and West Birmingham Hospitals NHS Trust",
"city": "Birmingham",
"attendances_total": 18234,
"attendances_type1": 15102,
"pct_within_4hrs_type1": 58.4,
"waits_12hr_dta": 412,
"page": "https://hospitalwaits.co.uk/a-e/sandwell-and-west-birmingham-..."
}
// ... one row per ED trust (~121)
],
"meta": { "resultCount": 121, "methodologyNote": "Monthly published statistics, not live queue times. ..." },
"source": "NHS England A&E Attendances and Emergency Admissions (monthly)",
...
}GET/api/v1/ae/{trust_slug}
One trust's A&E record: latest month + monthly history + national rank (1 = most pressured). 404 when the trust has no major ED.
Query parameters
| Name | Type | Default | Notes |
|---|---|---|---|
trust_slug | path | (required) | Trust slug — see /api/v1/trusts or /api/v1/ae |
Example
curl https://hospitalwaits.co.uk/api/v1/ae/university-hospitals-birmingham-nhs-foundation-trust
Sample response
{
"data": {
"trust": { "ods_code": "RRK", "name": "...", "city": "Birmingham", "slug": "..." },
"latest": {
"period": "2026-06-01",
"attendances_total": 41230, "attendances_type1": 32104,
"pct_within_4hrs_type1": 61.2, "waits_12hr_dta": 1834,
"emergency_admissions": 9450
},
"rank_by_4hr": 12, "total_ranked": 121,
"history": [ { "month": "2023-04", "pct_within_4hrs_type1": 68.1, "waits_12hr_dta": 903 }, ... ],
"page": "https://hospitalwaits.co.uk/a-e/university-hospitals-birmingham-..."
},
...
}CSV snapshots
For spreadsheets and newsroom workflows: the latest month of each dataset as a single CSV. Attribution travels inside the file as #-prefixed comment lines above the header row.
curl -O https://hospitalwaits.co.uk/api/v1/csv/rtt-latest.csv # every trust × specialty curl -O https://hospitalwaits.co.uk/api/v1/csv/ae-latest.csv # every trust with a major ED curl -O https://hospitalwaits.co.uk/api/v1/csv/tt-latest.csv # every Talking Therapies provider
MCP server (for AI assistants)
HospitalWaits is also a Model Context Protocol server, so Claude, ChatGPT and other MCP-capable assistants can query NHS waiting times directly. Streamable HTTP transport, no auth:
https://hospitalwaits.co.uk/api/mcp
Add it to Claude Code with:
claude mcp add --transport http hospitalwaits https://hospitalwaits.co.uk/api/mcp
Eight tools: search_trusts, list_specialties, get_national_specialty, get_trust_waits, get_ae_performance, list_ae_trusts, find_talking_therapies, get_talking_therapies. Every tool result carries its NHS source and OGL v3.0 attribution — keep it when quoting.
DM01 procedure codes
The procedure param accepts these 15 stable codes:
| Code | Procedure |
|---|---|
| DM01_01 | Magnetic Resonance Imaging |
| DM01_02 | Computed Tomography |
| DM01_03 | Non-obstetric Ultrasound |
| DM01_04 | Barium Enema |
| DM01_05 | DEXA Scan |
| DM01_06 | Audiology Assessments |
| DM01_07 | Cardiology — Echocardiography |
| DM01_08 | Cardiology — Electrophysiology |
| DM01_09 | Peripheral Neurophysiology |
| DM01_10 | Respiratory — Sleep Studies |
| DM01_11 | Urodynamics |
| DM01_12 | Colonoscopy |
| DM01_13 | Flexi Sigmoidoscopy |
| DM01_14 | Cystoscopy |
| DM01_15 | Gastroscopy |
Error codes
| Code | Meaning |
|---|---|
missing_parameter | A required query param is absent. |
unknown_specialty | Specialty slug is not in /api/v1/specialties. |
unknown_trust | Trust slug is not in /api/v1/trusts. |
unknown_procedure | Procedure code is not DM01_01..DM01_15. |
invalid_sort | Sort param outside the allowed set. |
no_data | Resolved but the trust × specialty/procedure has no published wait this period. |
internal | Transient backend issue. Retry after a few seconds. |
Prefer a ready-made widget?
If you just want a live waiting-time card on your site or in an article — no code beyond an iframe — use the embeddable widgets. They render our data with the NHS source line built in and update monthly.
Built something cool? Tell us.
If you build something on top of the HospitalWaits API — a widget, a research piece, a Slack bot, a Perplexity space — we'd love to see it. Email mustafa@doctor-data.co.uk.