Open Data NHS Scotland API

Free to Use Varies (check documentation)

Overview

Open Data NHS Scotland is a free public data platform maintained by Public Health Scotland, offering datasets on hospitals, patient activity, waiting times, and health statistics across Scotland. All datasets are available via a REST API with no authentication needed and can be exported as JSON or CSV. It is a great resource for researchers, journalists, and health tech developers.

💡

Beginner Tip

Browse the dataset catalog at opendata.nhs.scot first to find the resource ID for the dataset you want, then use that ID in the /api/3/action/datastore_search endpoint.

Available Data

case counts and statistics
vaccination data
geographic breakdown
historical trend data

Example Response

JSON Response
{
  "status": "success",
  "data": {
    "result": "Data from Open Data NHS Scotland",
    "description": "Medical reference data and statistics by Public Health Scotland",
    "timestamp": "2025-01-15T10:00:00Z"
  }
}

Field Reference

result Container object holding the query results and metadata.
records Array of data rows matching the query.
total Total number of records available in the dataset.
fields Schema information describing each column name and data type.
_id Auto-incremented row identifier within the datastore.

Implementation Example

const url = "https://www.opendata.nhs.scot/";
const response = await fetch(url);
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

404 Not Found The resource_id does not match any published dataset
Use the dataset catalog browser on opendata.nhs.scot to find the correct resource_id for your dataset.
Empty records array The filters applied return no matching rows
Remove filters and start with a simple query to verify the dataset has data, then add filters gradually.
Large response / timeout Default limit is high; some datasets have hundreds of thousands of rows
Always include a limit parameter (e.g., limit=100) and paginate using the offset parameter.

Matrix Score Breakdown

🌐 Reachability 15/30
⚡ Speed 5/20
🔒 Security 15/15
🛠 Developer XP 15/20
✓ Reliability 7/15
Response Time 1590ms

Fully tested on Apr 5, 2026

Technical Specifications

Auth No Auth
HTTPS REQUIRED
CORS UNKNOWN
Category Health
Difficulty Beginner
Verified: 2026-04-04

Similar APIs

View All →