Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 68 additions & 69 deletions specification/nhs-website-content-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ info:
## Overview
This API provides content from the [NHS website](https://www.nhs.uk) as JSON, to be consumed programmatically and used by your application.

⚠️ Before April 2025, many pages covering symptoms, tests or treatments were inappropriately included in the Conditions A to Z.
Before April 2025, many pages covering symptoms, tests or treatments were inappropriately included in the Conditions A to Z.

The April 2025 update introduces two new endpoints for 'symptoms' and 'tests-and-treatments' that reflect the reallocation of these pages to new A to Z pages on the website.

You can reuse the content from the following sections of the NHS website:
* Conditions A to Z ([Website](https://www.nhs.uk/conditions/) | [API](https://digital.nhs.uk/developer/api-catalogue/nhs-website-content/v2#get-/conditions))
* Medicines A to Z ([Website](https://www.nhs.uk/medicines/) | [API](https://digital.nhs.uk/developer/api-catalogue/nhs-website-content/v2#get-/medicines))
* Symptoms A to Z ([Website](https://www.nhs.uk/symptoms/) | [API](https://digital.nhs.uk/developer/api-catalogue/nhs-website-content/v2#get-/symptoms))
* Tests and treatments A to Z ([Website](https://www.nhs.uk/tests-and-treatments/) | [API](https://digital.nhs.uk/developer/api-catalogue/nhs-website-content/v2#get-/tests-and-treatments))
* Medicines A to Z ([Website](https://www.nhs.uk/medicines/) | [API](https://digital.nhs.uk/developer/api-catalogue/nhs-website-content/v2#get-/medicines))
* Mental health ([Website](https://www.nhs.uk/mental-health/) | [API](https://digital.nhs.uk/developer/api-catalogue/nhs-website-content/v2#get-/mental-health))
* Live Well ([Website](https://www.nhs.uk/live-well/) | [API](https://digital.nhs.uk/developer/api-catalogue/nhs-website-content/v2#get-/live-well))
* Pregnancy ([Website](https://www.nhs.uk/pregnancy/) | [API](https://digital.nhs.uk/developer/api-catalogue/nhs-website-content/v2#get-/pregnancy))
Expand Down Expand Up @@ -277,19 +277,6 @@ info:
<li><a href="https://sandbox.api.service.nhs.uk/nhs-website-content/conditions/cancer/" target="_blank">https://sandbox.api.service.nhs.uk/nhs-website-content/conditions/cancer/</a></li>
<li><a href="https://sandbox.api.service.nhs.uk/nhs-website-content/conditions/zika/" target="_blank">https://sandbox.api.service.nhs.uk/nhs-website-content/conditions/zika/</a></li>
</ul>
<h4>Medicines</h4>
<ul>
<li><a href="https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/" target="_blank">https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/</a></li>
<li><a href="https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/?category=a" target="_blank">https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/?category=a</a></li>
<li><a href="https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/?category=b" target="_blank">https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/?category=b</a></li>
<li><a href="https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/?category=z" target="_blank">https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/?category=z</a></li>
<li><a href="https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/?page=1" target="_blank">https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/?page=1</a></li>
<li><a href="https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/?page=11" target="_blank">https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/?page=11</a></li>
<li><a href="https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/aciclovir/" target="_blank">https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/aciclovir/</a></li>
<li><a href="https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/acrivastine/" target="_blank">https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/acrivastine/</a></li>
<li><a href="https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/acrivastine/?modules=true" target="_blank">https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/acrivastine/?modules=true</a></li>
<li><a href="https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/zopiclone/" target="_blank">https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/zopiclone/</a></li>
</ul>
<h4>Symptoms A-Z</h4>
<ul>
<li><a href="https://sandbox.api.service.nhs.uk/nhs-website-content/symptoms" target="_blank">https://sandbox.api.service.nhs.uk/nhs-website-content/symptoms/</a></li>
Expand All @@ -306,6 +293,19 @@ info:
<li><a href="https://sandbox.api.service.nhs.uk/nhs-website-content/tests-and-treatments/?page=1" target="_blank">https://sandbox.api.service.nhs.uk/nhs-website-content/tests-and-treatments/?page=1</a></li>
<li><a href="https://sandbox.api.service.nhs.uk/nhs-website-content/tests-and-treatments/?page=7" target="_blank">https://sandbox.api.service.nhs.uk/nhs-website-content/tests-and-treatments/?page=7</a></li>
</ul>
<h4>Medicines</h4>
<ul>
<li><a href="https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/" target="_blank">https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/</a></li>
<li><a href="https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/?category=a" target="_blank">https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/?category=a</a></li>
<li><a href="https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/?category=b" target="_blank">https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/?category=b</a></li>
<li><a href="https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/?category=z" target="_blank">https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/?category=z</a></li>
<li><a href="https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/?page=1" target="_blank">https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/?page=1</a></li>
<li><a href="https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/?page=11" target="_blank">https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/?page=11</a></li>
<li><a href="https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/aciclovir/" target="_blank">https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/aciclovir/</a></li>
<li><a href="https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/acrivastine/" target="_blank">https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/acrivastine/</a></li>
<li><a href="https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/acrivastine/?modules=true" target="_blank">https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/acrivastine/?modules=true</a></li>
<li><a href="https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/zopiclone/" target="_blank">https://sandbox.api.service.nhs.uk/nhs-website-content/medicines/zopiclone/</a></li>
</ul>
<h4>Mental health</h4>
<ul>
<li><a href="https://sandbox.api.service.nhs.uk/nhs-website-content/mental-health/" target="_blank">https://sandbox.api.service.nhs.uk/nhs-website-content/mental-health/</a></li>
Expand Down Expand Up @@ -467,7 +467,6 @@ paths:
| 403 | ACCESS_DENIED | User cannot perform this action. |
| 404 | RESOURCE_NOT_FOUND | Page not found. |
| 429 | TOO_MANY_REQUESTS | You have exceeded your application's [rate limit](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#rate-limits). |

/conditions:
parameters:
- $ref: "#/components/parameters/page"
Expand Down Expand Up @@ -558,7 +557,7 @@ paths:
| 403 | ACCESS_DENIED | User cannot perform this action. |
| 404 | RESOURCE_NOT_FOUND | Page not found. |
| 429 | TOO_MANY_REQUESTS | You have exceeded your application's [rate limit](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#rate-limits). |
/medicines:
/symptoms:
parameters:
- $ref: "#/components/parameters/page"
- $ref: "#/components/parameters/category"
Expand All @@ -567,13 +566,13 @@ paths:
- $ref: "#/components/parameters/endDate"
- $ref: "#/components/parameters/order"
get:
summary: Get all pages in the Medicines A to Z
operationId: get-medicines
summary: Get all pages in the Symptoms A to Z
operationId: get-symptoms
description: |
## Overview
Use this endpoint to get details of pages in the [Medicines A to Z](https://www.nhs.uk/medicines).
Use this endpoint to get details of pages in the [Symptoms A to Z](https://www.nhs.uk/symptoms).

Passing in no parameters returns all pages under 'medicines'.
Passing in no parameters returns all pages under 'symptoms'.

The response is limited to 25 child pages and is paginated.

Expand All @@ -585,18 +584,18 @@ paths:

However, the `orderBy` parameter can be used with the `startDate` and `endDate` parameters to filter down to the desired date. `startDate` and `endDate` should be given in the YYYY-MM-DD format.

For example `https://api.service.nhs.uk/nhs-website-content/medicines?startDate=2022-01-01&orderBy=dateModified`
For example `https://api.service.nhs.uk/nhs-website-content/symptoms?startDate=2022-01-01&orderBy=dateModified`

responses:
"200":
description: |
A valid query for medicines.
A valid query for symptoms.
content:
application/json:
schema:
$ref: components/schemas/WebPage.json
example:
$ref: components/examples/MedicinesAToZ.json
$ref: components/examples/SymptomsAToZ.json
"4XX":
description: |
An error occurred as follows:
Expand All @@ -607,36 +606,45 @@ paths:
| 403 | ACCESS_DENIED | User cannot perform this action. |
| 404 | RESOURCE_NOT_FOUND | Page not found. |
| 429 | TOO_MANY_REQUESTS | You have exceeded your application's [rate limit](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#rate-limits). |
/medicines/*:
/tests-and-treatments:
parameters:
- $ref: "#/components/parameters/modules"
- $ref: "#/components/parameters/page"
- $ref: "#/components/parameters/category"
- $ref: "#/components/parameters/orderBy"
- $ref: "#/components/parameters/startDate"
- $ref: "#/components/parameters/endDate"
- $ref: "#/components/parameters/order"
get:
summary: Get specific medicine page
operationId: get-medicine-page
summary: Get all pages in the Tests and Treatments A to Z
operationId: get-tests-and-treatments
description: |
## Overview
There is an endpoint for each page under the Medicines A to Z, for example https://www.nhs.uk/medicines/acrivastine.
Use this endpoint to get details of pages in the [tests-and-treatments A to Z](https://www.nhs.uk/tests-and-treatments).

This can be used to get specific information about individual medicines.
Passing in no parameters returns all pages under 'tests-and-treatments'.

There is only one query parameter for these pages:
The response is limited to 25 child pages and is paginated.

| Query parameter | Description | Type |
| ----------------- | ---------------------------------------------------------------------- | ----------- |
| modules | If topic is modularised, only return these modules | boolean |
There are a number of query parameters that filter the results.

## Ordering by dates

The `orderBy` parameter can be `dateModified`, `lastReviewed` and `nextReview`. By default if any of the `orderBy` parameters are chosen the results are sorted by newest first.

However, the `orderBy` parameter can be used with the `startDate` and `endDate` parameters to filter down to the desired date. `startDate` and `endDate` should be given in the YYYY-MM-DD format.

For example `https://api.service.nhs.uk/nhs-website-content/tests-and-treatments?startDate=2022-01-01&orderBy=dateModified`

# Modularisation
We modularise some of our content, meaning that individual parts of the page can be reused. If a page is modularised, content appears in the `hasPart` field.
responses:
"200":
description: |
A valid query for medicines.
A valid query for tests-and-treatments.
content:
application/json:
schema:
$ref: components/schemas/WebPage.json
example:
$ref: components/examples/MedicinesContentPage.json
$ref: components/examples/TestsAndTreatmentsAToZ.json
"4XX":
description: |
An error occurred as follows:
Expand All @@ -647,7 +655,7 @@ paths:
| 403 | ACCESS_DENIED | User cannot perform this action. |
| 404 | RESOURCE_NOT_FOUND | Page not found. |
| 429 | TOO_MANY_REQUESTS | You have exceeded your application's [rate limit](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#rate-limits). |
/symptoms:
/medicines:
parameters:
- $ref: "#/components/parameters/page"
- $ref: "#/components/parameters/category"
Expand All @@ -656,13 +664,13 @@ paths:
- $ref: "#/components/parameters/endDate"
- $ref: "#/components/parameters/order"
get:
summary: Get all pages in the Symptoms A to Z
operationId: get-symptoms
summary: Get all pages in the Medicines A to Z
operationId: get-medicines
description: |
## Overview
Use this endpoint to get details of pages in the [Symptoms A to Z](https://www.nhs.uk/symptoms).
Use this endpoint to get details of pages in the [Medicines A to Z](https://www.nhs.uk/medicines).

Passing in no parameters returns all pages under 'symptoms'.
Passing in no parameters returns all pages under 'medicines'.

The response is limited to 25 child pages and is paginated.

Expand All @@ -674,18 +682,18 @@ paths:

However, the `orderBy` parameter can be used with the `startDate` and `endDate` parameters to filter down to the desired date. `startDate` and `endDate` should be given in the YYYY-MM-DD format.

For example `https://api.service.nhs.uk/nhs-website-content/symptoms?startDate=2022-01-01&orderBy=dateModified`
For example `https://api.service.nhs.uk/nhs-website-content/medicines?startDate=2022-01-01&orderBy=dateModified`

responses:
"200":
description: |
A valid query for symptoms.
A valid query for medicines.
content:
application/json:
schema:
$ref: components/schemas/WebPage.json
example:
$ref: components/examples/SymptomsAToZ.json
$ref: components/examples/MedicinesAToZ.json
"4XX":
description: |
An error occurred as follows:
Expand All @@ -696,45 +704,36 @@ paths:
| 403 | ACCESS_DENIED | User cannot perform this action. |
| 404 | RESOURCE_NOT_FOUND | Page not found. |
| 429 | TOO_MANY_REQUESTS | You have exceeded your application's [rate limit](https://digital.nhs.uk/developer/guides-and-documentation/reference-guide#rate-limits). |
/tests-and-treatments:
/medicines/*:
parameters:
- $ref: "#/components/parameters/page"
- $ref: "#/components/parameters/category"
- $ref: "#/components/parameters/orderBy"
- $ref: "#/components/parameters/startDate"
- $ref: "#/components/parameters/endDate"
- $ref: "#/components/parameters/order"
- $ref: "#/components/parameters/modules"
get:
summary: Get all pages in the Tests and Treatments A to Z
operationId: get-tests-and-treatments
summary: Get specific medicine page
operationId: get-medicine-page
description: |
## Overview
Use this endpoint to get details of pages in the [tests-and-treatments A to Z](https://www.nhs.uk/tests-and-treatments).

Passing in no parameters returns all pages under 'tests-and-treatments'.

The response is limited to 25 child pages and is paginated.

There are a number of query parameters that filter the results.

## Ordering by dates
There is an endpoint for each page under the Medicines A to Z, for example https://www.nhs.uk/medicines/acrivastine.

The `orderBy` parameter can be `dateModified`, `lastReviewed` and `nextReview`. By default if any of the `orderBy` parameters are chosen the results are sorted by newest first.
This can be used to get specific information about individual medicines.

However, the `orderBy` parameter can be used with the `startDate` and `endDate` parameters to filter down to the desired date. `startDate` and `endDate` should be given in the YYYY-MM-DD format.
There is only one query parameter for these pages:

For example `https://api.service.nhs.uk/nhs-website-content/tests-and-treatments?startDate=2022-01-01&orderBy=dateModified`
| Query parameter | Description | Type |
| ----------------- | ---------------------------------------------------------------------- | ----------- |
| modules | If topic is modularised, only return these modules | boolean |

# Modularisation
We modularise some of our content, meaning that individual parts of the page can be reused. If a page is modularised, content appears in the `hasPart` field.
responses:
"200":
description: |
A valid query for tests-and-treatments.
A valid query for medicines.
content:
application/json:
schema:
$ref: components/schemas/WebPage.json
example:
$ref: components/examples/TestsAndTreatmentsAToZ.json
$ref: components/examples/MedicinesContentPage.json
"4XX":
description: |
An error occurred as follows:
Expand Down
Loading