Office for National Statistics
StatisticsGBapi.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 creditReturns 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.
GET /v1/data/ons/census-observations1 creditReturns 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.
GET /v1/data/ons/code-list-editions1 creditReturns the editions of one code list, each with its edition name and a link to the codes it contains.
GET /v1/data/ons/code-lists1 creditReturns every classification code list ONS publishes, each with its id and links to its editions and codes.
GET /v1/data/ons/codes1 creditReturns the codes of one code list edition, each with its code, human label and a link to the datasets that use it.
GET /v1/data/ons/dataset1 creditReturns one dataset's record: title, description, keywords, national-statistic flag, release frequency, contact details, licence and links to its editions and latest version.
GET /v1/data/ons/datasets1 creditReturns the catalogue of ONS published datasets, each with id, title, description, keywords, contacts, release frequency and a link to its latest version.
GET /v1/data/ons/dimension-options1 creditReturns the valid option codes and labels for one dimension of a dataset version, each linked to its entry in the underlying code list.
GET /v1/data/ons/dimensions1 creditReturns the dimensions of one dataset version, each with its label, its options endpoint and the code list that defines its values.
GET /v1/data/ons/edition1 creditReturns one edition of a dataset, with its internal id and an explicit pointer to the current latest version number.
GET /v1/data/ons/editions1 creditReturns the editions of one dataset, each with its edition name and a link to the current latest version of that edition.
GET /v1/data/ons/observations1 creditReturns the actual observation values of a dataset version for one combination of dimension options, with the unit of measure and the total observation count.
GET /v1/data/ons/population-type-dimensions1 creditReturns the census variables that can be crossed for one population type, each with its id, label, category count and a long plain-English description.
GET /v1/data/ons/population-types1 creditReturns the census population bases available for Census 2021 tabulation, each with its short name, label, description and whether it is microdata or tabular.
GET /v1/data/ons/search1 creditSearches ONS published content and returns scored results with title, summary, release date, content type and URI, alongside topic and content-type facet counts.
GET /v1/data/ons/version-metadata1 creditReturns 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.
GET /v1/data/ons/versions1 creditReturns every published version of one dataset edition, each with its version number, release date, any correction or alert notices, and download links.
Response example
The shape of data from ons/area-types (Census area types). A sample, not live data.
{
"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>
Licence
Open Government Licence v3.0
https://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/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
