> ## Documentation Index
> Fetch the complete documentation index at: https://docs.webrouter.net/llms.txt
> Use this file to discover all available pages before exploring further.

# NHSBSA Open Data Portal

> NHS Business Services Authority open data on its CKAN portal, including Secondary Care Medicines Data (SCMD): hospital medicine usage by trust, month and product.

![](https://mintcdn.com/webrouter/JBFYvcRI1PVnd4YX/logo/data-apis/nhsbsa.webp?fit=max\&auto=format\&n=JBFYvcRI1PVnd4YX\&q=85\&s=fce5cb8ed1aa8588278b343d79e6537d)

[Web Catalog · Health](https://docs.webrouter.net/data-apis.md?category=health)

No key needed

Endpoints

4

Auth

None

[Vendor docs](https://opendata.nhsbsa.net/pages/api)

## Notes

* Keyless. Every answer is a JSON envelope \{success, result}; read result.
* Two-step flow: package\_show lists a dataset's resources (SCMD is one resource per month, named like SCMD\_PROVISIONAL\_202608); query a resource's rows with datastore\_search or datastore\_search\_sql using its id or name.
* SCMD datasets: secondary-care-medicines-data-indicative-price (provisional, with indicative cost) and others found with datasets.search.
* datastore\_search returns 100 rows by default and at most 32,000; page with offset.

## Endpoints

GET

Search datasets

Datasets matching a Solr query, with their resources.

[Open](#nhsbsa-datasets-search)

GET

Get a dataset and its resources

One dataset's description, licence and resources (monthly files), with ids and names.

[Open](#nhsbsa-datasets-get)

GET

Search a resource's rows

Rows of one data resource, filtered, full-text searched, sorted and paged, with field types.

[Open](#nhsbsa-rows-search)

GET

Query a resource with SQL

Rows from one SELECT statement over a data resource.

[Open](#nhsbsa-rows-sql)

### Search datasets

GET

`/api/3/action/package_search`

`nhsbsa.datasets.search`

Datasets matching a Solr query, with their resources.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`q`</td><td>string</td><td>query</td><td>Solr query; default \*:\*. Example `secondary care medicines`</td></tr>

    <tr>
      <td>
        `fq`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Filter query.
      </td>
    </tr>

    <tr>
      <td>
        `sort`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Comma-separated field and order; default 'score desc, metadata\_modified desc'.
      </td>
    </tr>

    <tr>
      <td>
        `rows`
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        Datasets to return; default 10, at most 1000.
      </td>
    </tr>

    <tr>
      <td>
        `start`
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        Offset into the results.
      </td>
    </tr>
  </tbody>
</table>

[Vendor docs](https://opendata.nhsbsa.net/api/3/action/help_show?name=package_search) · Same job: [ArcGIS Online](https://docs.webrouter.net/data-apis/arcgis.md#arcgis-groups-search), [Attio](https://docs.webrouter.net/data-apis/attio.md#attio-objects-list), [Bank of Canada](https://docs.webrouter.net/data-apis/bankofcanada.md#bankofcanada-lists), [US Bureau of Economic Analysis](https://docs.webrouter.net/data-apis/bea.md#bea-datasets-list), [Bright Data](https://docs.webrouter.net/data-apis/brightdata.md#brightdata-datasets-list), [Clay](https://docs.webrouter.net/data-apis/clay.md#clay-tables-query)

```python Python theme={null}
router.call_data_api("nhsbsa.datasets.search", {'q': 'secondary care medicines'})
```

```text MCP theme={null}
call_data_api(endpoint="nhsbsa.datasets.search", params={"q": "secondary care medicines"})
```

### Get a dataset and its resources

GET

`/api/3/action/package_show`

`nhsbsa.datasets.get`

One dataset's description, licence and resources (monthly files), with ids and names.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`id` required</td><td>string</td><td>query</td><td>Dataset id or name. Example `secondary-care-medicines-data-indicative-price`</td></tr>
  </tbody>
</table>

[Vendor docs](https://opendata.nhsbsa.net/pages/api) · Same job: [Affinity](https://docs.webrouter.net/data-apis/affinity.md#affinity-companies-fields), [ArcGIS Online](https://docs.webrouter.net/data-apis/arcgis.md#arcgis-items-get), [Attio](https://docs.webrouter.net/data-apis/attio.md#attio-attributes-list), [Bank of Canada](https://docs.webrouter.net/data-apis/bankofcanada.md#bankofcanada-series-get), [US Bureau of Economic Analysis](https://docs.webrouter.net/data-apis/bea.md#bea-parameters-list), [Bright Data](https://docs.webrouter.net/data-apis/brightdata.md#brightdata-datasets-metadata)

```python Python theme={null}
router.call_data_api("nhsbsa.datasets.get", {'id': 'secondary-care-medicines-data-indicative-price'})
```

```text MCP theme={null}
call_data_api(endpoint="nhsbsa.datasets.get", params={"id": "secondary-care-medicines-data-indicative-price"})
```

### Search a resource's rows

GET

`/api/3/action/datastore_search`

`nhsbsa.rows.search`

Rows of one data resource, filtered, full-text searched, sorted and paged, with field types.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`resource_id` required</td><td>string</td><td>query</td><td>Resource id or name. Example `SCMD_PROVISIONAL_202608`</td></tr>

    <tr>
      <td>
        `filters`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        JSON object of exact field matches, e.g. \{"ODS\_CODE": "RRV"}.
      </td>
    </tr>

    <tr>
      <td>
        `q`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Full-text query over all fields.
      </td>
    </tr>

    <tr>
      <td>
        `fields`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Comma-separated fields to return.
      </td>
    </tr>

    <tr>
      <td>
        `sort`
      </td>

      <td>
        string
      </td>

      <td>
        query
      </td>

      <td>
        Comma-separated field names with order, e.g. 'YEAR\_MONTH desc'.
      </td>
    </tr>

    <tr>
      <td>
        `limit`
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        Rows to return; default 100, at most 32000.
      </td>
    </tr>

    <tr>
      <td>
        `offset`
      </td>

      <td>
        integer
      </td>

      <td>
        query
      </td>

      <td>
        Rows to skip.
      </td>
    </tr>

    <tr>
      <td>
        `include_total`
      </td>

      <td>
        boolean
      </td>

      <td>
        query
      </td>

      <td>
        Return the total match count; default true.
      </td>
    </tr>
  </tbody>
</table>

[Vendor docs](https://opendata.nhsbsa.net/api/3/action/help_show?name=datastore_search) · Same job: [CMS Open Payments](https://docs.webrouter.net/data-apis/cms-open-payments.md#cms-open-payments-datastore-query), [CMS Data (data.cms.gov)](https://docs.webrouter.net/data-apis/data-cms.md#data-cms-dataset-rows), [data.gov.au](https://docs.webrouter.net/data-apis/data-gov-au.md#data-gov-au-rows-search), [Latvian Open Data Portal (data.gov.lv)](https://docs.webrouter.net/data-apis/data-gov-lv.md#data-gov-lv-rows-search), [data.gov.ua](https://docs.webrouter.net/data-apis/data-gov-ua.md#data-gov-ua-rows-search), [Dune](https://docs.webrouter.net/data-apis/dune.md#dune-query-latest-result)

```python Python theme={null}
router.call_data_api("nhsbsa.rows.search", {'resource_id': 'SCMD_PROVISIONAL_202608'})
```

```text MCP theme={null}
call_data_api(endpoint="nhsbsa.rows.search", params={"resource_id": "SCMD_PROVISIONAL_202608"})
```

### Query a resource with SQL

GET

`/api/3/action/datastore_search_sql`

`nhsbsa.rows.sql`

Rows from one SELECT statement over a data resource.

Input

<table>
  <thead>
    <tr>
      <th>
        Name
      </th>

      <th>
        Type
      </th>

      <th>
        In
      </th>

      <th>
        Notes
      </th>
    </tr>
  </thead>

  <tbody>
    <tr><td>`resource_id` required</td><td>string</td><td>query</td><td>Resource id or name the SQL reads. Example `SCMD_PROVISIONAL_202608`</td></tr>
    <tr><td>`sql` required</td><td>string</td><td>query</td><td>One SELECT statement; the table name goes in backticks. Example ``SELECT * FROM `SCMD_PROVISIONAL_202608` LIMIT 10``</td></tr>
  </tbody>
</table>

[Vendor docs](https://opendata.nhsbsa.net/api/3/action/help_show?name=datastore_search_sql) · Same job: [CMS Open Payments](https://docs.webrouter.net/data-apis/cms-open-payments.md#cms-open-payments-datastore-query), [CMS Data (data.cms.gov)](https://docs.webrouter.net/data-apis/data-cms.md#data-cms-dataset-rows), [data.gov.au](https://docs.webrouter.net/data-apis/data-gov-au.md#data-gov-au-rows-search), [Latvian Open Data Portal (data.gov.lv)](https://docs.webrouter.net/data-apis/data-gov-lv.md#data-gov-lv-rows-search), [data.gov.ua](https://docs.webrouter.net/data-apis/data-gov-ua.md#data-gov-ua-rows-search), [Dune](https://docs.webrouter.net/data-apis/dune.md#dune-query-latest-result)

```python Python theme={null}
router.call_data_api("nhsbsa.rows.sql", {'resource_id': 'SCMD_PROVISIONAL_202608', 'sql': 'SELECT * FROM `SCMD_PROVISIONAL_202608` LIMIT 10'})
```

```text MCP theme={null}
call_data_api(endpoint="nhsbsa.rows.sql", params={"resource_id": "SCMD_PROVISIONAL_202608", "sql": "SELECT * FROM `SCMD_PROVISIONAL_202608` LIMIT 10"})
```

> [!NOTE]
>
> * This portal refuses a table name that is not backtick-quoted, and refuses the call without resource\_id.
> * Results stop at 32,000 rows; records\_truncated is true when they did.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.