---
title: "Default ONS query API"
method: GET
path: "/search"
tags: ["public"]
---

# Default ONS query API

`GET /search`

## Request

- Base URL: `/v1` (relative, and the document’s source URL is not known)
- URL: `/v1/search`
- Auth: none required

Default ONS query API which combines the content with type counts

## Query parameters

- `q` string, required
- `content_type` string[]
- `topics` string[]
- `population_types` string[]
- `dimensions` string[]
- `cdids` string[]
- `dataset_ids` string[]
- `highlight` boolean
- `sort` string
- `limit` integer
- `offset` integer
- `fromDate` string
- `toDate` string
- `nlp_weighting` boolean
- `uri_prefix` string

## Response `200`

OK

- GetSearchResponse
  - `count` number, required: Number of search results which match query
  - `took` number, required: Time taken to execute query in milliseconds
  - `distinct_items_count` integer, required: Count of distinct items that match the query
  - `dimensions` CountItem[]: List of dimensions included in results
    - `type` string, required
    - `count` integer, required
  - `content_types` CountItem[], required: List of content types included in results
    - `type` string, required
    - `count` integer, required
  - `population_type` CountItem[]: List of population types included in results
    - `type` string, required
    - `count` integer, required
  - `topics` CountItem[]: List of topics included in results
    - `type` string, required
    - `count` integer, required
  - `items` ContentItem[], required: List of matching content items for the current page
    - `cancelled` boolean
    - `canonical_topic` string
    - `dataset_id` string
    - `date_changes` object[]
      - `previous_date` string
      - `change_notice` string
    - `dimensions` Dimension[]: An array of dimensions within a dataset.
      - `label` string
      - `raw_label` string
      - `name` string
    - `edition` string
    - `finalised` boolean
    - `highlight` Highlight: Fields that contain at least 1 matching term from query 'q' parameter. The values contain the following embedded tags "...<em class="highlight">{matched term}</em>..."
      - `summary` string
      - `title` string
      - `keywords` string[]
    - `keywords` string[]
    - `language` string
    - `meta_description` string
    - `national_statistic` boolean
    - `population_type` string: A population type a dataset is associated with e.g. Usual-Residents. This is applicable to Census 2021 datasets only.
    - `provisional_date` string
    - `published` boolean
    - `release_date` string, date-time
    - `source` string
    - `summary` string
    - `survey` string
    - `title` string, required
    - `topics` string[]
    - `type` string, required
    - `uri` string, required
  - `suggestions` string[]: List of suggested alternative similar search queries
  - `additional_suggestions` string[]: List of suggested alternative search queries from current search query

## Other responses

- `400`: Query term not specified
- `500`: Internal server error

---

[API](https://skmtc.dev/office-of-national-statistics/apis/search-api.md) - [All operations](https://skmtc.dev/office-of-national-statistics/apis/search-api/llms.txt) - [OpenAPI document](https://skmtc.dev/office-of-national-statistics/apis/search-api/revisions/33e6751db807?raw)
