> For the complete documentation index, see [llms.txt](https://docs.suggestic.com/graphql/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.suggestic.com/graphql/query/mutations/meal-plan/swap-meals.md).

# Swap Meals

Replaces recipes on an existing meal plan

Use the `swapMealPlanRecipe` mutation to replace a recipe in an existing [Meal Plan](/graphql/query/queries/meal-plan/meal-plan-1.md). &#x20;

Replace a single recipe on a specific day and meal by using the `mealId` argument or replace all recipes for every day of the meal plan for a specific meal by using the `mealTag` argument.

### Available Arguments

| **Arguments** | **Type**     | **Is required?** | **Description**                                 |
| ------------- | ------------ | ---------------- | ----------------------------------------------- |
| `recipeId`    | ID           | Yes              | The new recipe ID                               |
| `mealId`      | ID           | No               | The meal ID (from the meal plan) to be replaced |
| `servings`    | Int          | No               | Number of servings to be changed.               |
| `mealTag`     | MealTimeType | No               | BREAKFAST, SNACK, LUNCH, DINNER                 |
|               |              |                  |                                                 |

{% hint style="info" %}
This mutation is commonly used in combination with the [SimilarMacrosRecipe](https://docs.suggestic.com/graphql/query/queries/similar-macros-recipes) query to replace existing recipes with equivalents.
{% endhint %}

### Example

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

```graphql
mutation {
  swapMealPlanRecipe(
    recipeId: "UmVjaXBlOjA3ZjUxZDM5LTgyMGYtNGU4NS1iNjQzLWUxYTEwNTdjMWI4MQ=="
    mealId: "TWVhbDoxNjMzMw=="
    serving: 2
  ) {
    success
  }
}
```

{% endtab %}

{% tab title="Response" %}

```javascript
{
  "data": {
    "swapMealPlanRecipe": {
      "success": true
    }
  }
}
```

{% endtab %}
{% endtabs %}
