You can use our RESTful API to download spending data and other useful information. Currently no registration is required, but please be aware this may change.
You can retrieve data as CSV (compatible with Excel) by appending &format=csv
to the URL, or as JSON by appending &format=json
.
You can find information about our data sources here
You are welcome to use data or graphs from this site in your academic output with attribution. Please cite OpenPrescribing.net, Bennett Institute for Applied Data Science, University of Oxford, 2024 as the source for academic attribution.
Methods to calculate prescribing spending.
Retrieve total spending and items by Sub-ICB Location or practice on a particular chemical, presentation or BNF section. (Spending is calculated using the actual_cost field in the NHS Business Service Authority's data, items using the total_items field.)
Queries the last five years of data and returns total spending and items by month.
Total prescribing spending by month: /api/1.0/spending
Total by BNF code by month: /api/1.0/spending/?code=0212
, /api/1.0/spending/?code=0212000AA
, /api/1.0/spending/?code=0212000AAAAABAB
Queries the last five years of data and returns spending and items by Sub-ICB Location by month.
Spending by Sub-ICB Location on a chemical: /api/1.0/spending_by_org/?org_type=sicbl&code=0212000AA
You can request individual Sub-ICB Locations by code: /api/1.0/spending_by_org/?org_type=sicbl&code=0212000AA&org=15N
Queries the last five years of data and returns total spending and items by practice by month.
You must specify either an organisation, or a date.
Spending by all practices on a BNF section: /api/1.0/spending_by_org/?org_type=practice&code=0212&date=2023-09-01
Spending by all practices on a chemical: /api/1.0/spending_by_org/?org_type=practice&code=0212000AA&date=2023-09-01
Spending by all practices on a presentation: /api/1.0/spending_by_org/?org_type=practice&code=0212000AAAAAAAA&date=2023-09-01
You can request individual practices by code: /api/1.0/spending_by_org/?org_type=practice&code=0212000AA&org=H81068
You can also request a Sub-ICB Location code to see spending by all practices in that Sub-ICB Location: /api/1.0/spending_by_org/?org_type=practice&code=0212000AA&org=15N
You can use the above queries with all the other organisation types supported
by OpenPrescribing by changing the org_type
parameter:
?org_type=pcn
for PCNs?org_type=icb
for ICBs?org_type=regional_team
for Regional TeamsMethods to retrieve information about Sub-ICB Locations, practices, and BNF codes.
Search for the official name and code of BNF sections, chemicals and presentations.
All BNF sections, chemicals and presentations matching a name (case-insensitive): /api/1.0/bnf_code/?q=lipid
All chemicals and presentations matching a code: /api/1.0/bnf_code/?q=0212000AA
All BNF sections matching a code: /api/1.0/bnf_code/?q=2.4
All BNF sections, chemicals and presentations exactly matching a name or code: /api/1.0/bnf_code/?q=0212000AA&exact=true
Search for details about a Sub-ICB Location or practice by code or name.
All organisations matching a code or name: /api/1.0/org_code/?q=Beaumont
All Sub-ICB Locations matching a code or name: /api/1.0/org_code/?q=Gloucester&org_type=CCG
All practices matching a code or name: /api/1.0/org_code?q=Gloucester&org_type=practice
All organisations exactly matching a code or name: /api/1.0/org_code/?exact=true&q=99H
Search for details about a Sub-ICB Location or practice by code or name. Returns values for all months available.
Total list size for all Sub-ICB Locations: /api/1.0/org_details/?org_type=ccg&keys=total_list_size
Total list size for all practices by practice code, or Sub-ICB Location code: /api/1.0/org_details/?org_type=practice&org=15N&keys=total_list_size
ASTRO-PU cost and items for practices by practice code, or Sub-ICB Location code: /api/1.0/org_details/?org_type=practice&org=15N&keys=astro_pu_items,astro_pu_cost
Search for the boundaries of a Sub-ICB Location, or location of a practice, by code. Returns GeoJSON.
Boundaries of all Sub-ICB Locations: /api/1.0/org_location/?org_type=ccg
Boundaries of an individual Sub-ICB Location: /api/1.0/org_location/?org_type=ccg&q=15N
Location (approximate) of a practice, or practices in a Sub-ICB Location, by code: /api/1.0/org_location/?q=99H,P87003