# Recipe Search by Ingredients

Use `searchRecipesByIngredients`to find recipes that contain a list of ingredients.

### **Parameter**

| Argument          | Type       | Description                             |
| ----------------- | ---------- | --------------------------------------- |
| `mustIngredients` | \[String]! | List of ingredients recipe must contain |

## Example

### Get the list of recipes with specific ingredients

Get the list of recipes which includes broccoli, eggs, and avocado ingredients

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

```graphql
{
  searchRecipesByIngredients(
    mustIngredients: ["broccoli", "eggs", "avocado"]
  ) {
    edges {
      node {
        name
        ingredients {
          name
        }
       ingredientLines
      }
    }
  }
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
  "data": {
    "searchRecipesByIngredients": {
      "edges": [
        {
          "node": {
            "name": "Garlic Roasted Broccoli",
            "ingredients": [
              {
                "name": "Olive oil"
              },
              {
                "name": "Broccoli florets"
              },
              {
                "name": "Garlic"
              },
              {
                "name": "Salt"
              }
            ],
            "ingredientLines": [
              "12 oz broccoli leaves",
              "1 tbsp extra virgin olive oil",
              "2 cloves garlic, sliced",
              "Salt, to taste",
              "Freshly ground black pepper to taste"
            ]
        },
        {
          "node": {
            "name": "Avocado With Tomatoes",
            "ingredients": [
              {
                "name": "Avocado"
              },
              {
                "name": "Tomato"
              },
              {
                "name": "Cumin"
              },
              {
                "name": "Garlic powder"
              },
              {
                "name": "Oregano"
              },
              {
                "name": "Salt"
              },
              {
                "name": "Lemon juice"
              }
            ],
            "ingredientLines": [
              "* 1 avocado",
              "* 1/2 tomato",
              "* a dash of cumin powder",
              "* a dash of garlic powder",
              "* a dash of oregano",
              "* little salt to taste",
              "* few drop of lemon juice (optional)"
             ]
          }
        }
      ]
    }
  }
}
```

{% endtab %}
{% endtabs %}

**Note:** If no ingredients are added into the `mustIngredients` string, recipes with all ingredients will be retrieved.

### UI/UX example

In the same way, we have code examples, this is an implementation example in which see results of the API execution in the Suggestic App.&#x20;

Login to the App, go to the **Recipes** option, introduce **broccoli, eggs, avocado** on the search field, all the recipes related to those ingredients are displayed. Look at the first two recipes, those are the same as the ones returned with the API query. Select the **Garlic Roasted Broccoli**, the ingredients are the same as the result retrieved in the API query

![](https://920729701-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LwqSnBDpAb6mFZYLsuB%2Fuploads%2FBIpo1TYrTxiWNtJhpEHo%2FSearchRecipeIngredients.gif?alt=media\&token=95307d3c-63e9-4865-b01e-2e5709ea741d)
