OpenPrescribing Spending API
Prescribing spending, quantity and item counts by BNF code and organisation.
Prescribing spending, quantity and item counts by BNF code and organisation.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/openprescribing-spending-api"
curl "https://apis.io/api/v1/apis?limit=25"
Discovery needs no key. Ratings and market analysis are Pro.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: OpenPrescribing Spending API
version: '1.0'
summary: Free, open, key-less REST API over English NHS primary-care prescribing data.
description: OpenPrescribing.net exposes NHS England primary-care (GP) prescribing data as a free, public, RESTful API. It is built and operated by the Bennett Institute for Applied Data Science at the University of Oxford on top of the English Prescribing Dataset published monthly by the NHS Business Services Authority. The API returns prescribing spending, quantity and item counts by BNF code and by NHS organisation (practice, PCN, Sub-ICB Location / CCG, ICB / STP, Regional Team), standardised prescribing-quality measures, drug-tariff and price-per-unit data, ghost-generic savings, and organisation reference and boundary lookups. Responses are JSON or CSV; organisation-location endpoints return GeoJSON. No registration, API key or OAuth is required. This specification was generated by API Evangelist by reading the public, MIT-licensed Django source (openprescribing/api/urls.py and the api/views_*.py modules); it is not a provider-published spec.
license:
name: MIT
url: https://github.com/bennettoxford/openprescribing/blob/main/LICENSE.txt
contact:
name: Bennett Institute for Applied Data Science
url: https://openprescribing.net/api/
servers:
- url: https://openprescribing.net/api/1.0
description: Production
tags:
- name: Spending
description: Prescribing spending, quantity and item counts by BNF code and organisation.
paths:
/spending/:
get:
operationId: getSpending
summary: Total prescribing spending across all England
description: Total prescribing spending, quantity and items across the last five years of the English Prescribing Dataset for one or more BNF codes, aggregated across England.
tags:
- Spending
parameters:
- $ref: '#/components/parameters/code'
- $ref: '#/components/parameters/format'
responses:
'200':
$ref: '#/components/responses/SpendingList'
'400':
$ref: '#/components/responses/BadRequest'
/spending_by_org/:
get:
operationId: getSpendingByOrg
summary: Prescribing spending by organisation
description: Prescribing spending, quantity and items by BNF code, broken down by NHS organisation of the requested org_type (practice, pcn, ccg / sicbl, stp / icb, regional_team).
tags:
- Spending
parameters:
- $ref: '#/components/parameters/code'
- $ref: '#/components/parameters/org'
- $ref: '#/components/parameters/orgType'
- $ref: '#/components/parameters/date'
- $ref: '#/components/parameters/format'
responses:
'200':
$ref: '#/components/responses/SpendingList'
'400':
$ref: '#/components/responses/BadRequest'
'404':
$ref: '#/components/responses/NotFound'
/spending_by_sicbl/:
get:
operationId: getSpendingBySicbl
summary: Prescribing spending by Sub-ICB Location (CCG)
description: Prescribing spending by BNF code broken down by Sub-ICB Location (formerly CCG).
tags:
- Spending
parameters:
- $ref: '#/components/parameters/code'
- $ref: '#/components/parameters/org'
- $ref: '#/components/parameters/date'
- $ref: '#/components/parameters/format'
responses:
'200':
$ref: '#/components/responses/SpendingList'
'400':
$ref: '#/components/responses/BadRequest'
/spending_by_practice/:
get:
operationId: getSpendingByPractice
summary: Prescribing spending by GP practice
description: Prescribing spending by BNF code broken down by GP practice.
tags:
- Spending
parameters:
- $ref: '#/components/parameters/code'
- $ref: '#/components/parameters/org'
- $ref: '#/components/parameters/date'
- $ref: '#/components/parameters/format'
responses:
'200':
$ref: '#/components/responses/SpendingList'
'400':
$ref: '#/components/responses/BadRequest'
components:
parameters:
org:
name: org
in: query
schema:
type: string
description: Comma-separated list of NHS organisation codes.
date:
name: date
in: query
schema:
type: string
format: date
description: Month (YYYY-MM-DD, first of month) within the available 5-year window.
format:
name: format
in: query
schema:
type: string
enum:
- json
- csv
default: json
description: Response format. May also be supplied as a URL suffix (.json / .csv) via DRF format_suffix_patterns.
orgType:
name: org_type
in: query
schema:
type: string
enum:
- practice
- pcn
- ccg
- sicbl
- stp
- icb
- regional_team
description: NHS organisation type to break results down by.
code:
name: code
in: query
schema:
type: string
description: Comma-separated list of BNF code prefixes (section, chemical or presentation).
schemas:
Error:
type: object
description: Django REST Framework error envelope.
properties:
detail:
type: string
Spending:
type: object
properties:
date:
type: string
format: date
actual_cost:
type: number
items:
type: integer
quantity:
type: number
row_id:
type: string
row_name:
type: string
responses:
NotFound:
description: Date outside the available data window, or resource not found.
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
SpendingList:
description: A list of monthly spending rows.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Spending'
text/csv:
schema:
type: string
BadRequest:
description: Invalid request (bad/missing parameter, unrecognised org type, invalid code).
content:
application/json:
schema:
$ref: '#/components/schemas/Error'