Skip to main content
Geospatial Services Data Hub

This is a new service – your feedback will help us to improve it: Feedback Form


Open REST API (PostgreSQL)

This API provides read‑only access to datasets via a RESTful interface powered by PostgREST.

Overview

Open REST API (PostgreSQL) exposes database views as HTTP endpoints and returns data in JSON format. It is intended for use by internal systems, analysts, and approved applications.

Base URL

https://healthgeospatial-datahub.scwcsu.nhs.uk/datahub/api

API documentation

Interactive API documentation is available via Swagger UI. This allows users to explore available endpoints, view request and response schemas, and issue test requests.

Open Swagger UI (opens in a new tab)

Available endpoints

Loading endpoints…

Example response

[
  {
    "practice_code": "M82018",
    "icb_code": "QOC",
    "dataset_date": "2025102717",
    "shape": {
      "type": "Polygon",
      "crs": {
        "type": "name",
        "properties": {
          "name": "EPSG:27700"
        }
      }
    }
  }
]

Field descriptions

GP Practice Catchment Boundaries fields
Field Description
practice_code GP practice code (ODS identifier)
icb_code Integrated Care Board code associated with the practice
dataset_date Dataset timestamp representing the version of the catchment data (format: YYYYMMDDHH)
shape Catchment area geometry returned as GeoJSON polygon

Geographic data

The shape field is returned as a GeoJSON Polygon.

The geometry represents GP practice catchment boundaries and may consist of complex polygon shapes depending on the underlying spatial aggregation.

Filtering and query operators

This API supports row‑level filtering using query parameters. Filters are applied by specifying a column name followed by an operator and value.

Filters can be combined by including multiple query parameters in the request.

Basic filtering

To filter by an exact value, use the eq (equals) operator.

/api/gp_boundaries_edec?icb_code=eq.QOC

This returns only GP practices associated with the specified Integrated Care Board.

Available comparison operators

Common filtering operators
Operator Meaning Example
eq Equals ?practice_code=eq.M82018
neq Not equal ?example_mainindicator=neq.Y
like Pattern match ?example_name=like.*Practice*
ilike Case‑insensitive pattern match ?example_name=ilike.*alney*
in One of a list of values ?icb_code=in.(QR1,QOX)
is Exact match for boolean or null values ?example_mainindicator=is.true

Combining filters

Multiple filters can be applied in a single request. All conditions must be met for a record to be returned.

/api/example_?icb_code=eq.QOC&mainindicator=eq.Y

This returns main GP practice locations within the specified ICB.

Selecting specific fields

To reduce payload size, you can select only the fields you need.

/api/gp_loc?select=practice_code,geom

Sorting results

Results can be ordered using the order parameter.

/api/example_?order=icb_code.asc

To sort in descending order:

/api/example_?order=organisati.desc

Limiting and paging results

Note: The API returns results in fixed-size pages to ensure performance and scalability.

Each API request returns a page of results. To ensure consistent performance and reliability, a maximum of 500 records can be returned in a single request.

Default behaviour

If no limit is specified, the API will return up to 500 records.

/api/gp_boundaries_edec

Paging large result sets

To retrieve more than 500 records, you must use the limit and offset parameters.

Examples

First page:

/api/gp_boundaries_edec?limit=500&offset=0

Second page:

/api/gp_boundaries_edec?limit=500&offset=500

Third page:

/api/gp_boundaries_edec?limit=500&offset=1000

How paging works

Each request returns a page of results. To retrieve the full dataset:

  1. Start with offset=0
  2. Increase the offset by the page size (for example, 500)
  3. Continue until fewer than 500 records are returned

Optional: total record count

You can request an estimated total number of records by including the following header:

Prefer: count=planned

The response will include a header such as:

Content-Range: 0-499/8000

Usage guidance

Usage notes

Authentication

This API currently supports anonymous read‑only access. Authenticated access may be introduced in future releases.

Support

For access queries or data clarification, contact: Geospatial Services