Skip to main content
All providers
Office for National Statistics

Office for National Statistics

StatisticsGB

api.beta.ons.gov.uk

UK official statistics: the ONS dataset catalogue and the editions and versions behind each one.

Capabilities (17)

GET /v1/data/ons/area-types1 credit

Returns the geography levels a population type can be tabulated at, from England and Wales down to output areas, each with its id, label and how many areas it contains.

population_typelimit?offset?
GET /v1/data/ons/census-observations1 credit

Returns Census 2021 counts for a population type, cross-tabulated by the requested variables at the requested geography level, each row naming its dimension options and the count.

population_typearea_typedimensions
GET /v1/data/ons/code-list-editions1 credit

Returns the editions of one code list, each with its edition name and a link to the codes it contains.

idlimit?offset?
GET /v1/data/ons/code-lists1 credit

Returns every classification code list ONS publishes, each with its id and links to its editions and codes.

limit?offset?
GET /v1/data/ons/codes1 credit

Returns the codes of one code list edition, each with its code, human label and a link to the datasets that use it.

ideditionlimit?offset?
GET /v1/data/ons/dataset1 credit

Returns one dataset's record: title, description, keywords, national-statistic flag, release frequency, contact details, licence and links to its editions and latest version.

id
GET /v1/data/ons/datasets1 credit

Returns the catalogue of ONS published datasets, each with id, title, description, keywords, contacts, release frequency and a link to its latest version.

limit?offset?
GET /v1/data/ons/dimension-options1 credit

Returns the valid option codes and labels for one dimension of a dataset version, each linked to its entry in the underlying code list.

ideditionversiondimensionlimit?offset?
GET /v1/data/ons/dimensions1 credit

Returns the dimensions of one dataset version, each with its label, its options endpoint and the code list that defines its values.

ideditionversionlimit?offset?
GET /v1/data/ons/edition1 credit

Returns one edition of a dataset, with its internal id and an explicit pointer to the current latest version number.

idedition
GET /v1/data/ons/editions1 credit

Returns the editions of one dataset, each with its edition name and a link to the current latest version of that edition.

idlimit?offset?
GET /v1/data/ons/observations1 credit

Returns the actual observation values of a dataset version for one combination of dimension options, with the unit of measure and the total observation count.

ideditionversiontimegeographyaggregate
GET /v1/data/ons/population-type-dimensions1 credit

Returns the census variables that can be crossed for one population type, each with its id, label, category count and a long plain-English description.

population_typelimit?offset?q?
GET /v1/data/ons/population-types1 credit

Returns the census population bases available for Census 2021 tabulation, each with its short name, label, description and whether it is microdata or tabular.

limit?offset?
GET /v1/data/ons/search1 credit

Searches ONS published content and returns scored results with title, summary, release date, content type and URI, alongside topic and content-type facet counts.

qlimit?offset?sort?content_type?topics?
GET /v1/data/ons/version-metadata1 credit

Returns the statistical metadata of one dataset version: dimension list, unit of measure, release date and frequency, methodology and quality-statement links, licence, and the CSV/XLSX download URLs with their byte sizes.

ideditionversion
GET /v1/data/ons/versions1 credit

Returns every published version of one dataset edition, each with its version number, release date, any correction or alert notices, and download links.

ideditionlimit?offset?

Response example

The shape of data from ons/area-types (Census area types). A sample, not live data.

JSON
{
  "limit": 30,
  "offset": 0,
  "count": 20,
  "total_count": 20,
  "items": [
    {
      "id": "nat",
      "label": "England and Wales",
      "description": "Data for both England and Wales.",
      "total_count": 1,
      "hierarchy_order": 1400
    },
    {
      "id": "ctry",
      "label": "Countries",
      "description": "Data for either the whole of England or Wales.",
      "total_count": 2,
      "hierarchy_order": 1300
    },
    "… 18 more items"
  ]
}

Ask with this source

A prompt for your agent that names this source and how to call it through the crw MCP.

  • Census area types

    Use Office for National Statistics (ons) from fastCRW Pergamon, capability "Census area types" (area-types). You need the geography level id, such as nat, ctry or ltla, before requesting census observations. Example options: population_type=UR, limit=30, offset=0. Use the crw MCP tools: crw_find_data to confirm the source and its options, then crw_get_data with provider "ons" and capability "area-types". Tell me the credits used and cite the licence from the response. If the crw MCP tools are missing, install them with: npx -y crw-mcp install --api-key <your fastCRW API key>

  • Census 2021 observations

    Use Office for National Statistics (ons) from fastCRW Pergamon, capability "Census 2021 observations" (census-observations). You want actual Census 2021 numbers, for example population by sex or by economic activity for a geography level. Example options: population_type=UR, area_type=nat, dimensions=sex. Use the crw MCP tools: crw_find_data to confirm the source and its options, then crw_get_data with provider "ons" and capability "census-observations". Tell me the credits used and cite the licence from the response. If the crw MCP tools are missing, install them with: npx -y crw-mcp install --api-key <your fastCRW API key>

  • Code list editions

    Use Office for National Statistics (ons) from fastCRW Pergamon, capability "Code list editions" (code-list-editions). You have a code list id and need its edition name before you can list its codes. Example options: id=cpih1dim1aggid, limit=20, offset=0. Use the crw MCP tools: crw_find_data to confirm the source and its options, then crw_get_data with provider "ons" and capability "code-list-editions". Tell me the credits used and cite the licence from the response. If the crw MCP tools are missing, install them with: npx -y crw-mcp install --api-key <your fastCRW API key>

  • Code lists

    Use Office for National Statistics (ons) from fastCRW Pergamon, capability "Code lists" (code-lists). You want to browse the classifications ONS uses, such as administrative geography or industry breakdowns. Example options: limit=50, offset=0. Use the crw MCP tools: crw_find_data to confirm the source and its options, then crw_get_data with provider "ons" and capability "code-lists". Tell me the credits used and cite the licence from the response. If the crw MCP tools are missing, install them with: npx -y crw-mcp install --api-key <your fastCRW API key>

Attribution

Display this wherever you show the data. It arrives on every response as provenance.attribution_text.

Contains public sector information licensed under the Open Government Licence v3.0.

Cache: up to 3600s