---
title: Auto-Suggestions
slug: personalized-search/autosuggestions
description: How to make POST calls to the Monetate Personalized Search API for requests for autosuggested search term and product results
image:  https://archbee-image-uploads.s3.amazonaws.com/ceIfEvQHzQk1IVxoRWUh7/K9eTL4jKm7UQINb6zNziJ-20250912-181225.png
docTags: 
createdAt: 2025-01-03T15:19:56.341Z
---

An `AUTO_SUGGESTIONS` request returns suggested search terms as the customer types each character in their search term. Therefore, a Personalized Search API call is made each time the customer types a new character.

Personalized Search is both typo-tolerant and word order–tolerant, so it can return suggestions even when the customer misspells one or more words (for example, *headlites* instead of *headlights*) or puts the words of a search term in an unusual order (for example, *chairs outdoor* instead of *outdoor chairs*).

:::hint{type="info"}
The recommended interval to wait between auto-suggestions request calls is 250 ms on key presses and 30 ms on focus.
:::

:::ApiMethodV2
```json
{
  "name": "Auto-Suggestions Request",
  "method": "POST",
  "url": "https://engine.monetate.net/api/search/v1/site-search/{name}/{instance}/{domain}/search",
  "description": "",
  "tab": "examples",
  "examples": {
    "languages": [
      {
        "id": "5mN85RzvQDiOzku2cGR1K",
        "language": "json",
        "code": "{\n  \"searchToken\": \"monetate-156925593843210765\",\n  \"suggestions\": [\n    {\n      \"id\": \"mySuggestionsQuery1\",\n      \"typeOfRequest\": \"AUTO_SUGGESTIONS\",\n      \"query\": \"shirt\",\n      \"limit\": 2\n    },\n    {\n      \"id\": \"mySuggestionsQuery2\",\n      \"typeOfRequest\": \"AUTO_SUGGESTIONS\",\n      \"query\": \"short\",\n      \"limit\": 3,\n      \"hlStartElem\": \"<span style='color:red'>\",\n      \"hlEndElem\": \"</span>\"\n    }\n  ]\n}",
        "customLabel": "Example Auto-Suggestions Request"
      }
    ],
    "selectedLanguageId": "5mN85RzvQDiOzku2cGR1K"
  },
  "results": {
    "languages": [
      {
        "id": "DVGAJmba4nesxqQvtS7Iv",
        "language": "200",
        "customLabel": "",
        "code": "{\n  \"suggestionResults\": [\n    {\n      \"id\": \"mySuggestionsQuery1\",\n      \"suggestions\": [\n        {\n          \"suggest\": \"sweatshirt\"\n        },\n        {\n          \"suggest\": \"street sweatshirt\"\n        }\n      ]\n    },\n    {\n      \"id\": \"mySuggestionsQuery2\",\n      \"suggestions\": [\n        {\n          \"suggest\": \"<span style='color:red'>short</span>\"\n        },\n        {\n          \"suggest\": \"<span style='color:red'>short</span>s\"\n        },\n        {\n          \"suggest\": \"<span style='color:red'>short</span>-sleeve\"\n        }\n      ]\n    }\n  ]\n}"
      }
    ],
    "selectedLanguageId": "DVGAJmba4nesxqQvtS7Iv"
  },
  "request": {
    "pathParameters": [
      {
        "name": "name",
        "kind": "required",
        "type": "string",
        "description": "The client's account (for example, \"a-1db61f7a\") as it appears in the value of channel used in the Engine API request to obtain the search token.",
        "": "The client's account (for example, \"a-1db61f7a\") as it appears in the value of channel used in the Engine API request to obtain the search token."
      },
      {
        "name": "instance",
        "kind": "required",
        "type": "string",
        "description": "The client's account environment. The value must either be \"p\" for production or \"d\" for development.",
        "": "The client's account environment. The value must either be \"p\" for production or \"d\" for development."
      },
      {
        "name": "domain",
        "kind": "required",
        "type": "string",
        "description": "The client's domain (for example, \"product.monetate.me\") as it appears in the value of channel used in the Engine API request to obtain the search token.",
        "": "The client's domain (for example, \"product.monetate.me\") as it appears in the value of channel used in the Engine API request to obtain the search token."
      }
    ],
    "queryParameters": [],
    "headerParameters": [
      {
        "name": "Content-type",
        "kind": "required",
        "type": "string",
        "description": "The value must be \"application/json.\"",
        "": "The value must be \"application/json.\""
      }
    ],
    "bodyDataParameters": [
      {
        "name": "searchToken",
        "kind": "required",
        "type": "string",
        "description": "A token used to authenticate the search request obtained by sending a request to the Engine API. See \"Obtaining a Search Token\" in \"Calling the Personalized Search API\" for more information.",
        "": "required"
      },
      {
        "name": "suggestions",
        "kind": "required",
        "type": "Object",
        "description": "The set of parameters that define an auto-suggestions request.",
        "children": [
          {
            "name": "id",
            "kind": "required",
            "type": "string",
            "description": "A unique identifier associated with a suggestion request."
          },
          {
            "name": "typeOfRequest",
            "kind": "required",
            "type": "string",
            "description": "The type of query request. Use \"AUTO_SUGGESTIONS\" for the value."
          },
          {
            "name": "query",
            "kind": "required",
            "type": "string",
            "description": "The search term the customer input."
          },
          {
            "name": "limit",
            "kind": "required",
            "type": "Number",
            "description": "The maximum number of suggestions to return."
          },
          {
            "name": "hlStartElem",
            "kind": "optional",
            "type": "string",
            "description": "An HTML element applied at the start of the part of the auto-suggestion result that matches what the customer typed to highlight the match. If you don't specify this parameter, a value of <b> is automatically applied to make the match boldface."
          },
          {
            "name": "hlEndElem",
            "kind": "optional",
            "type": "string",
            "description": "An HTML element applied at the end of the part of the auto-suggestion result that matches what the customer typed. If you don't specify this parameter, a value of </b> is automatically applied."
          }
        ],
        "schema": [
          {
            "name": "id",
            "kind": "required",
            "type": "string",
            "description": "A unique identifier associated with a suggestion request."
          },
          {
            "name": "typeOfRequest",
            "kind": "required",
            "type": "string",
            "description": "The type of query request. Use \"AUTO_SUGGESTIONS\" for the value."
          },
          {
            "name": "query",
            "kind": "required",
            "type": "string",
            "description": "The search term the customer input."
          },
          {
            "name": "limit",
            "kind": "required",
            "type": "Number",
            "description": "The maximum number of suggestions to return."
          },
          {
            "name": "hlStartElem",
            "kind": "optional",
            "type": "string",
            "description": "An HTML element applied at the start of the part of the auto-suggestion result that matches what the customer typed to highlight the match. If you don't specify this parameter, a value of <b> is automatically applied to make the match boldface."
          },
          {
            "name": "hlEndElem",
            "kind": "optional",
            "type": "string",
            "description": "An HTML element applied at the end of the part of the auto-suggestion result that matches what the customer typed. If you don't specify this parameter, a value of </b> is automatically applied."
          }
        ]
      }
    ],
    "formDataParameters": []
  },
  "currentNewParameter": {
    "label": "Body Parameter",
    "value": "bodyDataParameters"
  },
  "hasTryItOut": false
}
```
:::

## Displaying Both Search Terms and Products

Personalized Search can return products along with suggested search terms as the customer types their search query.

:::hint{type="info"}
Showing customers products alongside suggested search terms is available not only to Personalized Search clients that have [Personalized Site Search](https://docs.monetate.com/docs/personalized-search-overview#personalized-site-search) in their contract but also to clients that only have [Personalized Category Pages](https://docs.monetate.com/docs/personalized-search-overview#personalized-category-pages) in their contract.
:::

To display both suggested search terms and products before the customer finishes typing their full search query, the request must contain both the `suggestions` object and the `recordQueries` object, with the value of its `typeOfRequest` key defined as `"SEARCH"`.&#x20;

Here's an example of an request that includes both auto-suggestions and product search:

:::CodeblockTabs
Example Auto-Suggestions and Product Search Request

```json
{
  "searchToken": "monetate-156925593843210765",
  "suggestions": [
    {
      "id": "autosuggestion",
      "query": "guitars",
      "typeOfRequest": "AUTO_SUGGESTIONS",
      "limit": 5
    }
  ],
  "recordQueries": [
    {
      "id": "productSearch",
      "typeOfRequest": "SEARCH",
      "settings": {
        "query": {
          "term": "guitars"
        },
        "limit": 5,
        "typeOfRecords": [
          "MONETATE_PRODUCT"
        ]
      }
    }
  ]
}
```
:::

Refer to the `recordQueries` definition in [Personalized Site Search Query Request](docId\:gwGtoOIc_OlMKsSgMarow) for more information about its required and optional parameters.
