openapi: 3.2.0 info: title: OpenPrescribing Reference 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: Reference description: BNF code, organisation code and organisation-location reference lookups. paths: /org_details/: get: operationId: getOrgDetails summary: Organisation statistics (list size, ASTRO-PU, STAR-PU) description: Practice-level statistics such as total list size, ASTRO-PU and STAR-PU values for one or more organisations, optionally restricted to a set of keys. tags: - Reference parameters: - name: org_type in: query schema: type: string description: Organisation type. - name: keys in: query schema: type: string description: Comma-separated list of statistic keys to return. - name: org in: query schema: type: string description: Comma-separated list of organisation codes. - $ref: '#/components/parameters/format' responses: '200': $ref: '#/components/responses/GenericList' '400': $ref: '#/components/responses/BadRequest' /bnf_code/: get: operationId: getBnfCodes summary: Search BNF sections, chemicals and presentations description: Search the BNF hierarchy (chapters, sections, paragraphs, chemicals, products and presentations) by name or code. tags: - Reference parameters: - name: q in: query schema: type: string description: Search term(s); comma-separated for multiple codes/names. - name: exact in: query schema: type: string enum: - 'true' - 'false' description: When "true", match codes/names exactly instead of prefix/substring. - $ref: '#/components/parameters/format' responses: '200': $ref: '#/components/responses/BnfCodeList' /org_code/: get: operationId: getOrgCodes summary: Look up NHS organisations by code or name description: Look up NHS organisations (practice, PCN, Sub-ICB Location, ICB, Regional Team) by code or name. tags: - Reference parameters: - name: q in: query schema: type: string description: Organisation code or name to search for. - name: org_type in: query schema: type: string enum: - practice - pcn - ccg - stp - regional_team description: Restrict the search to a single organisation type. - $ref: '#/components/parameters/format' responses: '200': $ref: '#/components/responses/GenericList' /org_location/: get: operationId: getOrgLocation summary: Organisation boundaries and locations (GeoJSON) description: Sub-ICB Location / ICB / PCN / Regional Team boundaries, or approximate practice point locations, returned as a GeoJSON FeatureCollection. tags: - Reference parameters: - name: org_type in: query schema: type: string enum: - practice - ccg - pcn - stp - regional_team default: practice description: Organisation type. - name: q in: query schema: type: string description: Comma-separated organisation codes. - name: centroids in: query schema: type: string description: When set, return boundary centroids instead of full polygons. responses: '200': description: GeoJSON FeatureCollection. content: application/json: schema: type: object components: responses: GenericList: description: A list of result objects. content: application/json: schema: type: array items: type: object 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' BnfCodeList: description: A list of matching BNF hierarchy entries. content: application/json: schema: type: array items: $ref: '#/components/schemas/BnfCode' parameters: 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. schemas: Error: type: object description: Django REST Framework error envelope. properties: detail: type: string BnfCode: type: object properties: type: type: string description: One of BNF chapter/section/paragraph/subparagraph, chemical, product, product format. id: type: string name: type: string is_generic: type: boolean section: type: string