OpenPrescribing Spending API

Retrieve total prescribing spending, quantity and items across the last five years of the English Prescribing Dataset — by BNF code (section, chemical or presentation) and by NHS organisation (practice, PCN, Sub-ICB Location, ICB, Regional Team), plus drug-tariff, price-per-unit, ghost-generic and bubble-chart data. Returns JSON or CSV.

Operations 4

GET /spending/ Total prescribing spending across all England #
GET /spending_by_org/ Prescribing spending by organisation #
GET /spending_by_sicbl/ Prescribing spending by Sub-ICB Location (CCG) #
GET /spending_by_practice/ Prescribing spending by GP practice #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • 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.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/openprescribing-spending-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

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 Specification

openprescribing-spending-api-openapi.yml Raw ↑
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.
  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:
  responses:
    NotFound:
      description: Date outside the available data window, or resource not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    BadRequest:
      description: Invalid request (bad/missing parameter, unrecognised org type, invalid code).
      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
  parameters:
    org:
      name: org
      in: query
      schema:
        type: string
      description: Comma-separated list of NHS organisation codes.
    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.
    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.
    code:
      name: code
      in: query
      schema:
        type: string
      description: Comma-separated list of BNF code prefixes (section, chemical or presentation).
  schemas:
    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
    Error:
      type: object
      description: Django REST Framework error envelope.
      properties:
        detail:
          type: string