> For the complete documentation index, see [llms.txt](https://docs.whisk.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.whisk.com/master/api/tools/autocomplete.md).

# Autocomplete

The Autocomplete endpoint provides a list of the most popular ingredients and products in several languages and can be used to add autocomplete functionality to your application.

## Autocomplete

<mark style="color:blue;">`GET`</mark> `https://cdn.whisk.com/autocomplete/v1/{language-tag}/{file-type}.json`

#### Path Parameters

| Name         | Type   | Description                                                |
| ------------ | ------ | ---------------------------------------------------------- |
| language-tag | string | Language                                                   |
| file-type    | string | The amount of data you will be getting in the product list |

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

```javascript
{
  "products": [
    {
      "name": "ANCHOVY",
      "displayName": "Acciuga",
      "imageUrl": "https://whisk-res.cloudinary.com/image/upload/v1550764890/graph/fooddb/cdd6c37ccd140664a46573d10e2fde25.jpg",
      "metadata": {
        "category": "MEATS AND SEAFOOD",
        "storing": {
          "pantry": {
            "metric": "Years",
            "min": 1,
            "max": 1
          },
          "defaultLocation": "Pantry"
        }
      },
      "nounForm": "singular"
    }
  ]
}
```

{% endtab %}
{% endtabs %}

#### Sample Request

```bash
curl "https://cdn.whisk.com/autocomplete/v1/it/all.json" \
    -H "Accept-Encoding: deflate, gzip" \
    -H "If-Modified-Since: Wed, 04 Mar 2020 10:30:58"
```

### language-tag

The language and locale of the autocomplete list. E.g `en-us`.

| LANGUAGE CODE | LOCALE CODE | DEFAULT LOCALE |
| ------------- | ----------- | -------------- |
| `en`          | `gb, us`    | `gb`           |
| `es`          | `es, mx`    | `es`           |
| `fr`          | `fr`        |                |
| `sv`          | `se`        |                |
| `de`          | `de`        |                |
| `zh`          | `cn`        |                |
| `ko`          |             |                |
| `it`          |             |                |
| `no`          |             |                |

For English language tag could be:

* `en-us` – US product names in English;
* `en-gb` – GB product names in English;
* `en` - same as en-gb.

### file-type

This parameter allows you to control the amount of data you will be getting in the product list. Available options:

* `all` – full data, all items with full content;
* `all-slim` - all items are returned and the items do not include metadata information;
* `food` - only food items, including metadata (check the response section for more information);
* `food-slim` - only food items not including metadata.

## Working with images

Our CDN provides utilities to manage image size and format. You can find more information in our: [Image Load Optimization documentation](/master/resources/optimizing-image-load.md).

### Optimization

To reduce the amount of traffic for your application we recommend using these headers:

1. `Accept-Encoding: deflate, gzip` - this will reduce the size of the response, consequently speeding up the request time.
2. `If-Modified-Since` - this will download content only if it has been modified. More about it here: <https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Modified-Since>.

## Response

| ATTRIBUTE   | TYPE                                                                                    | DESCRIPTION                                                    |
| ----------- | --------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
| name        | string                                                                                  | The canonical name of the product, identical for all languages |
| displayName | string                                                                                  | The name of the product in the selected language               |
| imageUrl    | string                                                                                  | The link to the product’s image                                |
| nounForm    | string                                                                                  | Indicates if the product name is singular, plural or invariant |
| metadata    | [Metadata](https://developers.whisk.com/docs/recipes/autocomplete#/definitons/Metadata) |                                                                |

### Metadata

| ATTRIBUTE | TYPE   | DESCRIPTION                          |
| --------- | ------ | ------------------------------------ |
| category  | string | The product’s category               |
| sorting   | string | The product’s storing recommendation |
