---
title: "Suggest API"
method: GET
path: "/api/suggest/query"
tags: [""]
---

# Suggest API

`GET /api/suggest/query`

If applicable, will return a suggestion and alternate suggestions to be displayed to the shopper as alternate search queries to pass to the [Autocomplete API](https://docs.searchspring.com/reference/get-autocomplete) to source results.

## Query parameters

- `siteId` string, required
- `q` string
- `language` string
- `suggestionCount` integer
- `productCount` integer

## Response `200`

OK

- SuggestResponseModel
  - `query` string — Will represent the query the shopper typed in the search bar and was passed as the ***q*** parameter.
  - `suggested` object — Will return the top query value that the the Suggest API thinks the original query should be corrected to.
    - `text` string — The value returned within the ***text*** key should be displayed to the shopper.
    - `type` string — Will be returned in the API response if the ***text*** key matches other data like a popular query, product name, or a product SKU. type will be one of the following three values to let you know what the ***text*** key matched: * **completed**: Autocomplete has "completed the sentence" for the user by inferring how to complete the last word of the query. * **exact**: The query exactly matches a popular query, product name, or product SKU. * **fallback**: We found some matching data in a product name, and filled in some of the blanks. This doesn't necessarily maintain word order.
    - `completed` unknown[] — If the ***type*** key has a value of ***completed***, then data will be returned within the ***completed*** key as an array of objects to give more insight on how the Suggest API curated the suggested query value.
      - unknown
    - `source` string — Will tell the user what data source the suggested query matched on. The following values are the possible values that can be returned here: * popular-query * name * sku
  - `alternatives` unknown[] — Will return data as an array of objects that house data for additional suggestions returned by the Suggest API.
    - unknown
  - `corrected-query` string — If a spell correction was made to the passed ***q*** parameter, the data returned here will be the updated query.

## Other responses

- `400` — Bad Request
- `404` — 404 Not Found

---

[API](https://skmtc.dev/searchspring/apis/autocomplete-module.md) · [All operations](https://skmtc.dev/searchspring/apis/autocomplete-module/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/searchspring/autocomplete-module/revisions/04129662b4e5/schema)
