# Autocomplete

<mark style="color:blue;">`GET`</mark> `https://api.whisk.com/autocomplete/v2/suggest`

This endpoint allows you to get an autocomplete suggestion. It may be used only with User Token for we derive autocomplete language from the User Preferences

#### Query Parameters

| Name          | Type    | Description                                                |
| ------------- | ------- | ---------------------------------------------------------- |
| limit         | integer | The maximum number of results of each type in the response |
| q             | string  | User input string                                          |
| product\_type | string  | Type of products in the results you are interested in      |

{% tabs %}
{% tab title="200 " %}

```graphql
{
  "response": [
    {
      "name": "Apple",
      "product_id": "697cb490-e9bc-4133-a899-f39bae276a2e",
      "product_type": "PRODUCT_TYPE_ONTOLOGY_PRODUCT",
      "image": {
        "url": "https://image-cdn.whisk.com/image/upload/v1550764658/graph/fooddb/41b6df25c3d98c7fe64c9bf713664008.jpg"
      }
    }
}
```

{% endtab %}
{% endtabs %}

### `product_type`

This parameter determines the type of products in the result. All types of items will be returned if omitted.

#### Supported product types

| Type                             | Description                                                                                              |
| -------------------------------- | -------------------------------------------------------------------------------------------------------- |
| PRODUCT\_TYPE\_ONTOLOGY\_PRODUCT | Usual food items                                                                                         |
| PRODUCT\_TYPE\_BASE\_ITEM        | [Items available in the stores](https://api.whisk.com/spec/#/StoreItemAPI/StoreItemAPI_SearchStoreItems) |

Sample Request and Response

{% tabs %}
{% tab title="Curl Request" %}

```bash
curl -X GET "https://api.whisk.com/autocomplete/v2/suggest?q=app&product_type=PRODUCT_TYPE_ONTOLOGY_PRODUCT&limit=10" \
-H  "accept: application/json"  \
-H  "Authorization: Bearer TOKEN"
```

{% endtab %}

{% tab title="Response" %}

```graphql
{
  "response": [
    {
      "name": "Apple",
      "product_id": "697cb490-e9bc-4133-a899-f39bae276a2e",
      "product_type": "PRODUCT_TYPE_ONTOLOGY_PRODUCT",
      "image": {
        "url": "https://image-cdn.whisk.com/image/upload/v1550764658/graph/fooddb/41b6df25c3d98c7fe64c9bf713664008.jpg"
      }
    },
    {
      "name": "Apple butter",
      "product_id": "2979d7bd-cd82-4502-af28-ae065b8d90c9",
      "product_type": "PRODUCT_TYPE_ONTOLOGY_PRODUCT",
      "image": {
        "url": "https://image-cdn.whisk.com/image/upload/v1552312229/custom_upload/e180389df528431402cc86d402857087.jpg"
      }
    },
    {
      "name": "Apple cider",
      "product_id": "4ca9d34f-96eb-448b-a730-a959036e9182",
      "product_type": "PRODUCT_TYPE_ONTOLOGY_PRODUCT",
      "image": {
        "url": "https://image-cdn.whisk.com/image/upload/v1550764590/graph/fooddb/fac80453ad9864b1468e9ac6053f6e12.jpg"
      }
    },
    {
      "name": "Apple cider vinegar",
      "product_id": "aa993cf4-0c5b-4092-93a6-10a2c1ea2565",
      "product_type": "PRODUCT_TYPE_ONTOLOGY_PRODUCT",
      "image": {
        "url": "https://image-cdn.whisk.com/image/upload/v1544980834/custom_upload/725aed9a863d8e491be183b06b58408e.jpg"
      }
    },
    {
      "name": "Apple compote",
      "product_id": "f3a37646-67fd-4c67-9048-1ddcb1f785c1",
      "product_type": "PRODUCT_TYPE_ONTOLOGY_PRODUCT",
      "image": {
        "url": "https://image-cdn.whisk.com/image/upload/v1552312251/custom_upload/886eb6684d3aded64f551a499176a241.jpg"
      }
    },
    {
      "name": "Apple juice",
      "product_id": "89fa4bc8-9ae6-457c-912b-16bdcac1760a",
      "product_type": "PRODUCT_TYPE_ONTOLOGY_PRODUCT",
      "image": {
        "url": "https://image-cdn.whisk.com/image/upload/v1550764724/graph/fooddb/5aebbf56da4812d8cc1f8eda6ec22c93.jpg"
      }
    },
    {
      "name": "Apple puree",
      "product_id": "f985fcb2-d594-4d05-9565-49ccb8209fd1",
      "product_type": "PRODUCT_TYPE_ONTOLOGY_PRODUCT",
      "image": {
        "url": "https://image-cdn.whisk.com/image/upload/v1550764902/graph/fooddb/a7ce41f6a01c5e3b8ed1476f0e83d21b.jpg"
      }
    },
    {
      "name": "Apple sauce",
      "product_id": "d753e75d-e521-454e-ac3d-50cd6ee04ba1",
      "product_type": "PRODUCT_TYPE_ONTOLOGY_PRODUCT",
      "image": {
        "url": "https://image-cdn.whisk.com/image/upload/v1550764902/graph/fooddb/a7ce41f6a01c5e3b8ed1476f0e83d21b.jpg"
      }
    },
    {
      "name": "Apples",
      "product_id": "697cb490-e9bc-4133-a899-f39bae276a2e",
      "product_type": "PRODUCT_TYPE_ONTOLOGY_PRODUCT",
      "image": {
        "url": "https://image-cdn.whisk.com/image/upload/v1550764658/graph/fooddb/41b6df25c3d98c7fe64c9bf713664008.jpg"
      }
    },
    {
      "name": "Applesauce",
      "product_id": "d753e75d-e521-454e-ac3d-50cd6ee04ba1",
      "product_type": "PRODUCT_TYPE_ONTOLOGY_PRODUCT",
      "image": {
        "url": "https://image-cdn.whisk.com/image/upload/v1550764902/graph/fooddb/a7ce41f6a01c5e3b8ed1476f0e83d21b.jpg"
      }
    }
  ]
}
```

{% endtab %}
{% endtabs %}
