Skip to main content

NHS website API migration guide

Contents

Introduction

The NHS website APIs are being migrated to give users tools they need that are not available on the current developer portal as well as offering improved documentation.

The new platform hosts many NHS APIs. It enables sandboxing environments and has an online developer community where API users can communicate with each other and get advice.

The main changes:

  1. Change of the URL link to access information about the APIs
    OLD: https://developer.api.nhs.uk/nhs-api
    NEW: https://digital.nhs.uk/developer/api-catalogue/nhs-website-content/v2
  2. To implement the API, you need to change the endpoints you are currently using to consume the NHS.uk APIs. You will need to change this from 'https://api.nhs.uk/' to 'https://api.service.nhs.uk/nhs-website-content/'
  3. A new dedicated community where you can get advice and support from other API users, the Developer Community page - https://developer.community.nhs.uk/

Please note that to use the NHS Website Content API you will not need:

  • An ODS code
  • To register with the NHS England National Service Desk and have an incident management process
  • To meet the functional requirements of the API
  • To supply a valid use case

You may have seen these referred to in other documentation. However, these are only required if you are requesting to use other APIs.

The existing APIs will not be switched off until all users have had a chance to migrate. The existing APIs will also continue to work for a time after the new APIs have become available.

From speaking to syndication service users, we have found that a month's notice before the migration is sufficient for users to get ready to migrate across. Also, to ensure business continuity, for a period of 3 months from the start of the migration, both platforms will run concurrently.

For more general information about the migration, see the API migration frequently asked questions.

NHS Website Content API v2

The new NHS Website Content API v2 is made up of the following NHS website APIs:

  • Health A to Z (conditions)
  • Medicines A to Z
  • Mental health
  • Live Well
  • Pregnancy
  • NHS Services (a textual description of services within the NHS, not data about individual services)
  • Contraception
  • Vaccinations
  • Women's health

You will only need to sign up to one API to consume content from any of these old APIs. All functionality is unchanged. You will also only need one key to access the API.

You can find the technical specification for the Content API v2 at NHS Website Content API v2 - NHS Digital. This contains information that will support you to implement the API.

Step one: registering with the NHS Digital developer hub

You will first need to register at the NHS Developer and Integration hub.

Note:

You only need one designated user account for your organisation. You should not set up separate user accounts for everyone in your team.

Later in the process, you will be able to add your colleagues to a team.

A screenshot of the NHS Developer and integration hub. The link 'Create account' is emphasised with a red border.

You will need to enter some details about yourself and your organisation.

A screenshot of the 'Create an account' page on the NHS Developer and Integration hub. The 'Create an account' form is emphasised with a red border.

Then you will need to agree to the general terms for the hub.

A screenshot of the 'Terms of use' page from the NHS Developer and integration hub. The button named 'Agree and continue' is emphasised with a red border

Finally, you need to get an activation email.

A screenshot of the 'Activate your account' page from the NHS Developer and Integration Hub

Step two: setting up your application in the integration test environment

You will then need to set up your application to start using the new API. There are two stages to getting set up, which you should follow in the order given in this guide.

Click the 'Environment access' link.

A screenshot of the 'My Developer Account' page, the 'Environment access' tab is emphasised with a red border

Click 'Add new application'.

A screenshot of the 'My applications and teams' page. The clickable box 'Add new application' is emphasised with a red border

You will need to set up a new application for each environment you want to use.

Note:

Set your application up in the integration test environment initially, so you can test the API before implementing it. Do not use the 'development' environment.

There are four environments in the list to choose from for your application. Select the integration test environment when you are starting to set up your application.

Environments

  • Sandbox - if you are registering to use our APIs, do not choose this environment. This is just for developers to test their own applications.
  • Development - this environment enables developers to create and innovate without breaking something in a real development. If you are registering to use our APIs, do not choose this environment.
  • Integration test - this is the option that must be chosen if you are registering to use any of our APIs. Use this environment to test your use of the API but do not use this environment in a live product.
  • Production - if you are registering to use our APIs, do not choose this environment until you have tested your use the API and are ready to publish content from the API to a live product. When you are using the API to publish content to a live product, you should only use the production environment.

Select the 'Integration test' environment.

A screenshot of the 'Select your environment' page, the radio button 'Integration test' is emphasised with a red border

As an application owner, select 'Add a new team' and enter a team name.

You will be able to add members from your organisation to your team.

Screenshot of the 'Select application owner' page, the radio button 'Me' is emphasised with a red border

Give your application a name. Include the name of the environment so you can see which one is which. For example: 'organisation name - application name - environment'. You can change this name later if you need to. Click 'Continue'.

A screenshot of the 'What is your application name?' page. The text says 'The application name must be unique. This means you cannot have applications with the same name and owner.' Underneath is a text box to enter your application name.

Check your answers are correct before clicking 'Create application'.

A screenshot of the 'Check your answers before creating your application' page. A table shows the environment, owner and application name that your have selected, then a link to change details.

A screenshot of the 'Application created successfully' page, the link 'View your new application' is emphasised with a red border

When you have set up your application, click 'View your new application', and click on the application name to see details about it and find out your API key.

To see the API key, click on 'Edit' next to 'Active API keys'. From here you can copy your key and store it somewhere safe.

A screenshot of the 'View your new application' page. The page has the name of your application as the title.  It lists the basic details about your application, and security details. In the security details section, the 'Edit' link next to 'Active API keys' is emphasised with a red border

To add the NHS Website Content API to your product, click 'Add APIs'.

A screenshot of the 'Add APIs' page. There is a list of APIs that can be selected

You will see a list of APIs that are available on the NHS England Developer and integration hub. Select 'NHS Website Content API' from the list.

Note that when you are in the integration test environment your use of the API will be limited to 120 requests per minute - you should not use the integration instance of the API in a public-facing application.

You can use our migration assistant to help you to implement the new API.

Step three: onboarding your product

When you have set up an application in the production environment, you will need to go through the onboarding process. You can navigate back to the developer hub using the page links at the top of the screen underneath the blue banner. Click 'Home'

You will see this screen:

A screenshot of the 'My developer account' page. It has links to 'Environment access', 'Product onboarding' and 'Developer community'. The 'Product onboarding' link is emphasised with a red border.

A screenshot of the 'Digital Onboarding Service' page, with text reading 'Select your product from the list below to access the onboarding process for that product' and a table with two tabs - one with your organisation name and one titled 'Users'. The tab with your organisation name is selected and the Product name you have entered is emphasised with a red border

Click on the product name in the Digital Onboarding Service page. You will be taken to the digital onboarding steps that you need to complete.

These involve submitting some information about your organisation and the product that will use the API, and confirming you accept the terms of use of the API.

A screenshot of the Digital Onboarding page. There are three headings: '1. Setup and eligibility', '2. Non-functional requirements', and '3. Technical conformance requirements'. Under each heading is a clickable link to a page to enter further information

The 'Provide details about your product' page asks for information about your digital product that will be using the API.

You will be asked for the version number for your product (question 1), but you don't need to provide this if you don't have one - just select 'No'.

You need to indicate whether the product is already onboarded to or using any other NHS services (questions 2 and 3). 'NHS services' means 'NHS APIs'. Only select 'Yes' if you are already using one of the other APIs provided on the NHS England Developer and Integration hub. If you later start to use another API provided on the NHS England Developer and Integration hub, you don't need to come back and change your answer.

For question 7, if your product won't be used in a clinical care setting (e.g., it is public-facing) select 'Other' and provide details.

A screenshot of the 'Provide details about your product' page

In the 'Provide details about your organisation' section you need to fill in information about your organisation - this is the 'supplier organisation' - including its ODS code if it has one. An ODS code is an administrative code used to identify NHS locations. You do not need to have an ODS code to use the NHS Website Content API.

The organisation commissioning the product is the organisation you are developing the product for if there is one.

Enter your name as the contact person responsible for submitting onboarding details on behalf of the organisation.

A screenshot of the 'Provide details about your organisation' page

The 'Register for service and incident management' section asks questions about your arrangements to manage incidents. Please note that you are not required to register with the NHS England National Service Desk or have an incident management process in place in order to use the NHS Website Content API.

A screenshot of the 'Register for service incident management' page

In the next section you will need to provide information about the users of your service, and indicate that you have read and agreed to our connection agreement (terms and conditions).

A screenshot of the 'Legal agreement' page

When you have submitted your answers for all sections, these will be forwarded to the NHS website Syndication team who will check them and approve your request to use the API. They will aim to do this within two working days of you submitting your request.

You will receive emails to tell you that your request has been approved, and you can then start using the API in the production environment.

You have now successfully onboarded with the NHS Website Content API.

To implement the API, you need to change the endpoints you are currently using to consume the NHS.uk APIs. You will need to change this from 'https://api.nhs.uk/' to 'https://api.service.nhs.uk/nhs-website-content/'

You need to add your new API Key (this used to be 'subscription-key') to the request header. The code to use is as follows:

headers: {
    'Content-Type': 'application/json',
    'apikey': 'YOUR_NEW_API_KEY_GOES_HERE'
}

You can use our migration assistant to help you implement the new API

Don’t forget that you will need to display our attribution graphic alongside all instances of our syndicated content. See NHS Website Content API v2 for more information.

Step four: setting up your application in the production environment

Once you have completed the onboarding steps, you will then need to set up an application in the production environment to start using the new API in production.

Click the 'Environment access' link

A screenshot of the 'My Developer Account' page, the 'Environment access' tab is emphasised with a red border

Click 'Add new application'.

A screenshot of the 'My applications and teams' page. The clickable box 'Add new application' is emphasised with a red border

You will need to set up a new application in the production environment, even if you have already set one up in the integration test environment.

Select the 'Production' environment when you are starting the set up of your application.

A screenshot of the 'Select your environment' page, the radio button 'Production' is emphasised with a red border

Give your application a name, including 'production' so you know which environment each application is using. Click 'Continue'.

A screenshot of the 'What is your application name?' page. The text says 'The application name must be unique. This means you cannot have applications with the same name and owner.' Underneath is a text box to enter your application name.

Check your answers are correct before clicking 'Create application'.

A screenshot of the 'Check your answers before creating your application' page. A table shows the environment, owner and application name that your have selected, then a link to change details.

A screenshot of the 'Application created successfully' page

When you've set up your application in production, send us an email to sally.boyes@nhs.net with the subject 'Production application' so we can get your application up and running.

A screenshot of the 'View your new application page'. The page has the name of your application as the title.  It lists the basic details about your application, and security details. In the security details section, the 'Edit' link next to 'Active API keys' is emphasised with a red border

When you have set up your application, click 'View your new application', and click on the application name to see details about it and find out your API key.

To see the API key, click on 'Edit' next to 'Active API keys'. From here you can copy your key and store it somewhere safe.

To add the NHS Website Content API to your product, click 'Add APIs'.

A screenshot of the 'Add APIs' page. There is a list of APIs that can be selected

You will see a list of APIs that are available on the NHS England Developer and integration hub. Select 'NHS Website Content API' from the list.

You will be required to use multifactor authentication to access the API key in the production environment.

When you are using the API to publish content to a live product, you should only use the production environment.

When you are using the API in production, the use of the API will be limited to 1,200 requests per minute.

You can use our migration assistant to help you to implement the new API.

Get support from our team and other API users

A screenshot of the 'My developer account' page. There are three links on the page, 'Environment access', 'Product onboarding', and 'Developer community'. The 'Developer community' link is emphasised with a red border

You can join the APIM developer community to ask questions and get support from the team and other users. The community will be monitored and any queries will be picked up from here.

You should receive a response within 48 hours. To ensure your query gets a quick response, be sure to select the 'NHS Website Content API' category so that the team can see it.

You can also still use the NHS website service desk contact page to raise queries.

A screenshot of the developer community, showing a list of categories and some posts added by API users.