> 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/api/food-db/search.md).

# Search

### Description

[Swagger doc](https://api.whisk.com/spec/#/FoodAPI/FoodAPI_SearchFood)

Search API allows to look for a product and fetch the options along with the nutrition and other useful information. Search API works with the complete user input, often with the autocomplete results i.e. `apple` instead of `appl`.

### Parameters

<table><thead><tr><th>Name</th><th width="103">Optional</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>query</td><td>no</td><td>string</td><td>Max length is 255 chars </td></tr><tr><td>language</td><td>no</td><td>string</td><td>ISO 639-1 two letter language code</td></tr><tr><td>country</td><td>yes</td><td>string</td><td>ISO 3166-1 two letter country code</td></tr><tr><td>cursor.limit</td><td>yes</td><td>int</td><td>Number of results</td></tr><tr><td>cursor.cursors.after</td><td>yes</td><td>string</td><td>Next page after the value. Can not be used together with <code>cursor.cursors.before</code></td></tr><tr><td>cursor.cursors.before</td><td>yes</td><td>string</td><td>Page previous to the value. Cannon be used together with <code>cursor.cursors.after</code></td></tr></tbody></table>

#### Request example

```bash
curl -X POST "https://api.whisk.com/food/v2/search" -H  "accept: application/json" -H  "Authorization: Bearer %WHISK_TOKEN%" -H  "Content-Type: application/json" -d '
{  "query": "apple",  "language": "en",  "country": "gb",  "cursor": {    "limit": 20  }}'
```

### Response

Data returned in JSON. Empty strings, zero values, empty arrays and null values are not returned.

#### JSON response example

```json
{
  "food": [
    {
      "food_hit": "CiMyMDI2OTdjYjQ5MGU5YmM0MTMzYTg5OWYzOWJhZTI3NmEyZQ==",
      "title": "apple"
    } 
...
  ],
  "paging": {
    "cursors": {
      "after": "d5:after1284:eyJpZCI6IiIsImluZGV4IjoxOSwidGltZXN0YW1wIjoxNjczOTcyNTA0LCJwaXRJZCI6Ino5X3FBd1liY0d4aGRHWnZjbTFmY0hKdlpIVmpkQzB5TURJeUxURXlMVEl3RmpOTFdVSk9kMDV6VVcxcFkwMHRU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CUkxWUk9kd0FCRmpOTFdVSk9kMDV6VVcxcFkwMHRUV016TWtFMmJHY0FBQT09In0=e"
    },
    "total": "1106"
  }
}
```

#### Core attributes

<table><thead><tr><th width="142">Name</th><th width="101">Optional</th><th width="93">Type</th><th>Description</th></tr></thead><tbody><tr><td>food_hit</td><td>no</td><td>string</td><td>Food identifier to be used with Get Food method</td></tr><tr><td>title</td><td>no</td><td>string</td><td>Localized food name</td></tr><tr><td>paging.total</td><td>yes</td><td>int</td><td>The total number of available results</td></tr><tr><td>paging.cursors.after</td><td>yes</td><td>string</td><td>Reference to the next page</td></tr><tr><td>paging.cursors.before</td><td>yes</td><td>string</td><td>References to the previous page</td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.whisk.com/api/food-db/search.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
