Coronavirus API
Our coronavirus API allows you to integrate the coronavirus (COVID-19) information from the NHS website into your website, product or service. You can add your own styles to make the content fit with your other content.
Manually refresh the content regularly to make sure you always have the latest version.
Using the API requires some technical expertise. If you do not feel you have this, you could use our coronavirus widget instead.
How to use the coronavirus API
-
Step 1 Choose the type of content you want to syndicate
The standard website content available through our syndication service is based on the full coronavirus pages on the NHS website.
With our modularised content, you can instead choose to use shorter, more specific sections of content – for example, sections on symptoms or prevention. All sections are checked by our clinical team to make sure they remain accurate and safe to use in isolation.
Refresh rates
How often you need to refresh our coronavirus content depends on the type of content you're using.
- Website content: at least every 3 hours.
- Modularised content: at least every 7 days (we recommend every 24 hours).
Step 2 Tell us where the API will be used
So we can check how the API is being used, we need to know where you intend to use it.
https://Step 3 Generate API endpoint and code examples
Please complete step 2 to generate the correct endpoint and examples.
Endpoint
GETCode examples
curl -v -X GET "https://api.nhs.uk/conditions/coronavirus-covid-19"
<?php $pageUrl = 'https://api.nhs.uk/conditions/coronavirus-covid-19'; $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => $pageUrl, CURLOPT_CUSTOMREQUEST => "GET", CURLOPT_HTTPHEADER => array( // Request headers 'Accept: "application/json"', ) )); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo "cURL Error #:" . $err; } else { $obj = json_decode($response); echo "<pre>"; print_r($obj); echo "</pre>"; } ?>
# This script is using Python3 import urllib.request import urllib.parse pageURL = "https://api.nhs.uk/conditions/coronavirus-covid-19" request_headers = { "Accept": "application/json", "User-Agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0" } request = urllib.request.Request(pageURL, headers=request_headers) contents = urllib.request.urlopen(request).read() print(contents)
// You will need to include the NuGet package RestSharp. using System; using RestSharp; public class Program { public static void Main() { var pageURL = "https://api.nhs.uk/conditions/coronavirus-covid-19"; var client = new RestClient(pageURL); var request = new RestRequest(); request.Method = Method.GET; request.AddHeader("Accept", "application/json"); IRestResponse response = client.Execute(request); var content = response.Content; Console.WriteLine(content); } }
// You will need to have jQuery running on your webpage to run this script. $(function() { var pageUrl = "https://api.nhs.uk/conditions/coronavirus-covid-19"; $.ajax({ type: 'GET', url: pageUrl, headers: { 'Content-Type':'application/json' }, dataType: 'json', success: function (data) { console.log(data) } }); });
Step 3 Style and consume components
Within the mainEntityOfPage property, our content is chunked up into various components. Here is a list of all components which could be used on the coronavirus page.
The NHS Digital service manual includes a front-end library and styles for each component.
Text
Text
Check if it's a cold sore
A cold sore usually starts with a tingling, itching or burning feeling.
JSON-LD Schema:
{
"position": 0,
"identifier": "1",
"@type": "WebPageElement",
"name": "markdown",
"text": "<h2>Check if it's a cold sore</h2>\n\n<p>A cold sore usually starts with a tingling, itching or burning feeling.</p>\n"
}Find a service
Action link
JSON-LD Schema:
{
"position": 2,
"identifier": "2",
"text": "<p><a href=\"/Service-Search/Pharmacy/LocationSearch/10\">Find a pharmacy</a></p>\n",
"@type": "WebPageElement",
"name": "Find a service"
}Information
Information
If you regularly get cold sores, use antiviral creams as soon as you recognise the early tingling feeling. They don't always work after blisters appear.
JSON-LD Schema:
{ "position": 1,
"identifier": "3",
"text": "<p>If you regularly get cold sores, use antiviral creams as soon as you recognise the early tingling feeling. They don't always work after blisters appear.</p>\n",
"@type": "WebPageElement",
"name": "Information"
}Warning callout
Warning callout
School, nursery or work
Stay away from school, nursery or work until all the spots have crusted over. This is usually 5 days after the spots first appeared.
JSON-LD Schema:
{
"@type": "WebPageElement",
"position": 0,
"identifier": "4",
"name": "Callout",
"text": "<h3>School, nursery or work</h3><p>Stay away from school, nursery or work until all the spots have crusted over. This is usually 5 days after the spots first appeared.</p>\n"
}Non-urgent care card
Non-urgent care card
Speak to a GP if:
- you're not sure it's chickenpox
- the skin around the blisters is red, hot or painful (signs of infection)
- your child is dehydrated
- you're concerned about your child or they get worse
Tell the receptionist you think it's chickenpox before going in. They may recommend a special appointment time if other patients are at risk.
JSON-LD Schema:
{
"@type": "WebPageElement",
"name": "Primary care",
"identifier": "5",
"position": 0,
"text": "<h3>See a GP if:</h3>\n\n<ul>\n<li>the cold sore hasn't started to heal within 10 days</li>\n<li>you're worried about a cold sore or think it's something else</li>\n<li>the cold sore is very large or painful</li>\n<li>you or your child also have swollen, painful gums and sores in the mouth (gingivostomatitis)</li>\n<li>you're pregnant – there's an increased risk of <a href=\"/conditions/neonatal-herpes/\">neonatal herpes</a></li>\n<li>you have a weakened immune system – for example, because of chemotherapy or diabetes</li>\n</ul>\n"
}Urgent care card
Urgent care card
Ask for an urgent GP appointment if:
- you're an adult and have chickenpox
- you're pregnant and haven't had chickenpox before and you've been near someone with it
- you have a weakened immune system and you've been near someone with chickenpox
- you think your newborn baby has chickenpox
In these situations, your GP can prescribe medicine to prevent complications. You need to take it within 24 hours of the spots coming out.
JSON-LD Schema:
{
"@type": "WebPageElement",
"position": 0,
"identifier": "6",
"name": "Urgent",
"text": "<h3>Ask for an urgent GP appointment if:</h3>\n\n<ul>\n<li>you're an adult and have chickenpox</li>\n<li>you're pregnant and haven't had chickenpox before and you've been near someone with it</li>\n<li>you have a weakened immune system and you've been near someone with chickenpox<li>you think your newborn baby has chickenpox</li>\n</ul>\n<p>In these situations, your GP can prescribe medicine to prevent complications. You need to take it within 24 hours of the spots coming out.</p>"
}Emergency care card
Emergency care card
Call 999 if you have sudden chest pain that:
- spreads to your arms, back, neck or jaw
- makes your chest feel tight or heavy
- also started with shortness of breath, sweating and feeling or being sick
You could be having a heart attack. Call 999 immediately as you need immediate treatment in hospital.
JSON-LD Schema:
{ "@type": "WebPageElement",
"position": 0,
"identifier": "7",
"name": "Emergency",
"text": "<h3>Call 999 if you have sudden chest pain that:</h3>\n\n<ul>\n<li>spreads to your arms, back, neck or jaw</li>\n<li>makes your chest feel tight or heavy</li>\n<li>also started with shortness of breath, sweating and feeling or being sick</li>\n</ul>\n<p>You could be having a heart attack. Call 999 immediately as you need immediate treatment in hospital.</p>"
}Treatment card
Treatment card
Surgery to straighten the fingers
FasciectomyA cut is made along your palm and finger so the surgeon can straighten it.
- general anaesthetic (you're asleep) or local anaesthetic (your hand is numbed)
- you can leave hospital the same day
- recovery time: 4 to 12 weeks
- lowest risk of contracture coming back
- risks include bleeding, numbness and infection
Example: https://www.nhs.uk/conditions/dupuytrens-contracture/
JSON-LD Schema:
{
"name": "Treatment card",
"text": "<p>A cut is made along your palm and finger so the surgeon can straighten it.</p>\n\n<ul>\n<li>general anaesthetic (you're asleep) or local anaesthetic (your hand is numbed)</li>\n<li>you can leave hospital the same day</li>\n<li>recovery time: 4 to 12 weeks</li>\n<li>lowest risk of contracture coming back</li>\n<li>risks include bleeding, numbness and infection</li>\n</ul>\n",
"position": 0,
"subjectOf": "<h3>Surgery to straighten the fingers</h3><h4>Fasciectomy</h4>",
"identifier": "8",
"@type": "WebPageElement"
}Do and Don't lists
Do and Don't lists
Do
- Cover blisters that are likely to burst with a soft plaster or dressing
- Wash your hands before touching a burst blister
- Allow the fluid in a burst blister to drain before covering it with a plaster or dressing
Don't
- Don't burst a blister yourself
- Don't peel the skin off a burst blister
- Don't pick at the edges of the remaining skin
- Don't wear the shoes or use the equipment that caused your blister until it heals
JSON-LD Schema:
{
"@type": "WebPageElement"
"position": 0,
"identifier": "9",
"name": "Do/Don't",
"text": "\n<div>\n<h3>Do</h3>\n<ul>\n<li>Cover blisters that are likely to burst with a soft plaster or dressing</li>\n<li>Wash your hands before touching a burst blister</li>\n<li>Allow the fluid in a burst blister to drain before covering it with a plaster or dressing</li>\n</ul>\n\n</div>\n<div>\n<h3>Don't</h3>\n<ul>\n<li>Don't burst a blister yourself</li>\n<li>Don't peel the skin off a burst blister</li>\n<li>Don't pick at the edges of the remaining skin</li>\n<li>Don't wear the shoes or use the equipment that caused your blister until it heals</li>\n</ul>\n\n</div>\n"
}Reveal
Reveal
When it's not a cold sore
Symptoms Possible cause Painful red spot on the face filled with pus spot or boil Blister on the lip or inside the mouth mouth ulcer Red sores or blisters on the face that become crusty, golden-brown patches impetigo JSON-LD Schema:
{
"name": "Reveal",
"position": 3,
"subjectOf": "When it's not a cold sore",
"identifier": "11",
"mainEntity": [{
"position": 0,
"identifier": "1",
"@type": "WebPageElement",
"name": "markdown",
"text": "<table>\n<thead>\n<tr>\n <th>Symptoms</th>\n <th>Possible cause</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n <td>Painful red spot on the face filled with pus</td>\n <td>spot or <a href=\"/conditions/boils/\">boil</a></td>\n</tr>\n<tr>\n <td>Blister on the lip or inside the mouth</td>\n <td><a href=\"/conditions/mouth-ulcers/\">mouth ulcer</a></td>\n</tr>\n<tr>\n <td>Red sores or blisters on the face that become crusty, golden-brown patches</td>\n <td><a href=\"/conditions/impetigo/\">impetigo</a></td>\n</tr>\n</tbody>\n</table>\n"
}],
"@type": "WebPageElement"
}Common question
Common question
How does amlodipine work?
Amlodipine is a type of medicine called a calcium channel blocker.
Like other calcium channel blockers, amlodipine works in high blood pressure by relaxing and widening blood vessels. This lowers your blood pressure and makes it easier for your heart to pump blood around your body.
In angina, amlodipine works by improving the blood supply to your heart. Angina is chest pain that comes on when not enough blood gets to the muscles of the heart. It usually happens because the arteries to the heart become hardened and narrowed.
Amlodipine widens the arteries so more oxygen gets to the heart and chest pain is prevented.
JSON-LD Schema:
{ "text": "How does amlodipine work?",
"@type": "Question",
"acceptedAnswer": {
"mainEntity": [{
"text": "<p>Amlodipine is a type of medicine called a calcium channel blocker.</p>\n\n<p>Like other calcium channel blockers, amlodipine works in high blood pressure by relaxing and widening blood vessels. This lowers your blood pressure and makes it easier for your heart to pump blood around your body.</p>\n\n<p>In angina, amlodipine works by improving the blood supply to your heart. Angina is chest pain that comes on when not enough blood gets to the muscles of the heart. It usually happens because the arteries to the heart become hardened and narrowed.</p>\n\n<p>Amlodipine widens the arteries so more oxygen gets to the heart and chest pain is prevented.</p>\n",
"identifier": "1",
"name": "markdown",
"position": 0,
"@type": "WebPageElement"
}],
"@type": "Answer"
},
"identifier": "12",
"name": "chq",
"position": 0 }Image object
Image object
JSON-LD Schema:
{
"keywords": [
"european adder",
"snake bites",
"adder"
],
"name": "Picture of an adder – the only wild venomous snakes in the UK",
"license": "COLIN VARNDELL/SCIENCE PHOTO LIBRARY",
"provider": "Science Photo Library",
"url": "https://assets.nhs.uk/prod/images/S_1017_european-adder_C0067276.width-610.jpg",
"position": 1,
"identifier": "13",
"@type": "ImageObject",
"datePublished": "2017-10-18T15:43:13.172Z"
}Video object
Video object
JSON-LD Schema:
{
"text": "<video data-video-id='5712808577001' data-account='79855382001' data-player='EkC1XU82e' data-embed='default' data-application-id class='video-js' controls style='position: absolute; top: 0px; right: 0px; bottom: 0px; left: 0px; width: 100%; height: 100%;'></video><script src='//players.brightcove.net/79855382001/EkC1XU82e_default/index.min.js'></script>",
"thumbnailUrl": null,
"name": "How to prevent dehydration",
"@type": "VideoObject",
"description": null,
"identifier": "14",
"uploadDate": "2018-08-06T00:00:00+00:00",
"position": 0,
"lastReviewed": [
"2017-07-18",
"2020-07-18"
],
"alternateName": "5712808577001",
"embedUrl": "//players.brightcove.net/79855382001/EkC1XU82e_default/index.html?videoId=5712808577001"
}Image gallery
Image gallery
Credit:SCIENCE SOURCE/SCIENCE PHOTO LIBRARY
Small fluid-filled blisters appear Credit:PAN XUNBIN/SCIENCE PHOTO LIBRARY
The blisters can appear anywhere on the face Credit:DR P. MARAZZI/SCIENCE PHOTO LIBRARY
The blisters burst and crust over into a scab JSON-LD Schema:
{
"position": 1,
"identifier": "15",
"@type": "ImageGallery",
"associatedMedia": [{
"contentUrl": "https://assets.nhs.uk/prod/images/M1700345-Herpes_Cold_Sore-SPL.width-610.jpg",
"caption": "Small fluid-filled blisters appear",
"name": "Cold sore on lower lip",
"license": "SCIENCE SOURCE/SCIENCE PHOTO LIBRARY",
"provider": "Science Photo Library",
"keywords": [
"Cold sores",
"herpes",
"cold sore",
"herpes mouth"
],
"@type": "ImageObject",
"datePublished": "2017-06-15T08:28:15Z"
},{
"contentUrl": "https://assets.nhs.uk/prod/images/C0144603-Cold_sore-SPL.width-610.jpg",
"caption": "The blisters can appear anywhere on the face",
"name": "Cold sore on face just below the nose",
"license": "PAN XUNBIN/SCIENCE PHOTO LIBRARY",
"provider": "Science Photo Library",
"keywords": [
"cold sore",
"Herpes simplex virus"
],
"@type": "ImageObject",
"datePublished": "2017-06-15T08:28:15Z"
},{
"contentUrl": "https://assets.nhs.uk/prod/images/C0263434-Cold_sores-SPL.width-610.jpg",
"caption": "The blisters burst and crust over into a scab",
"name": "Burst cold sore on lower lip that has become a scab",
"license": "DR P. MARAZZI/SCIENCE PHOTO LIBRARY",
"provider": "Science Photo Library",
"keywords": [
"cold sore"
],
"@type": "ImageObject",
"datePublished": "2017-06-15T08:28:15Z"
}]
}Step 4 Agree to our terms and conditions
We have temporarily changed our syndication process, solely for these COVID-19 widgets and APIs, in order to make accessing them simpler and easier. We reserve the right to stop this temporary change at any time and to suspend your access. We will not ask you to create an account, but do need to know where they are going to be displayed. We may check this.
By accessing these COVID-19 widgets or APIs you agree to comply with our syndication terms.
As you are not required to have an account, we cannot contact you - but you should therefore regularly check back to this page for any updates.
Step 5 Show us what you’ve done (optional)
Send us a link with the API on your site to syndication.service@nhs.net.