# Update Meal Plan Settings

At your convenience, you can make adjustments to the meal plan settings to accordingly change or adjust your meal plan.

{% hint style="info" %}
**Note**: To use the Whisk Meal Plan API, you must acquire a User Token. For more information, see [User Access Tokens](/api-overview/auth/user-access-token.md).
{% endhint %}

The Meal Plan API provides you two endpoints that allow you to update the meal plan settings. The only difference between the two is that one of them requires a `{meal_plan_id}` and the other doesn't. This arrangement has been made for a future planned feature of supporting multiple meal plans for every user.

While at the moment, since Whisk only supports a single meal plan per user, the  `{meal_plan_id}` has been kept optional for both endpoints. You can leave it blank and it would be directly derived from the user token being used for API authentication.

## Update Settings

<mark style="color:orange;">`PUT`</mark> `https://api.whisk.com/mealplan/v2/settings`

Use this endpoint to update your meal plan settings using the `body` parameter as described below.

#### Request Body

| Name | Type   | Description                                                                                                                                   |
| ---- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------- |
| body | object | This parameter allows you to specify the new settings,  for the meal plan. For more information, see the *Request Body Object Example* below. |

{% tabs %}
{% tab title="200 This how a successful update meal plan settings response looks like." %}

```
{}
```

{% endtab %}

{% tab title="400 This failed response appears when specific error codes are found in the endpoint description." %}

```
{
  "error_code": "REAL_CODES_ARE_IN_ENDPOINT_DESCRIPTION",
  "message": "Additional details about error are not static and can be changed"
}
```

{% endtab %}

{% tab title="401 This failed response appears when API authentication gets failed. The possible error codes that may appear are: auth.tokenNotFound auth.tokenExpired auth.tokenInvalid auth.tokenRequired" %}

```
{
  "code": "auth.tokenNotFound"
}
```

{% endtab %}

{% tab title="500 This failed response appears when something is not right at Whisk's end." %}

```
This is unexpected response, something is wrong on our side, please contact: help@whisk.com
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Note**: Whisk provides its APIs on the Swagger interface for you to try it out. You can call this endpoint [here](https://api.whisk.com/spec/#/MealPlanAPI/MealPlanAPI_UpdateMealPlanSettings2).
{% endhint %}

## Update Settings

<mark style="color:orange;">`PUT`</mark> `https://api.whisk.com/mealplan/v2/{meal_plan_id}/settings`

Use this endpoint to update your meal plan settings using the `meal_plan_id` and the `body` parameters as described below.

#### Path Parameters

| Name           | Type   | Description               |
| -------------- | ------ | ------------------------- |
| meal\_plan\_id | string | The meal-plan identifier. |

#### Request Body

| Name | Type   | Description                                                                                                                                   |
| ---- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------- |
| body | object | This parameter allows you to specify the new settings,  for the meal plan. For more information, see the *Request Body Object Example* below. |

{% tabs %}
{% tab title="200 This how a successful update meal plan settings response looks like." %}

```
{}
```

{% endtab %}

{% tab title="400 This failed response appears when specific error codes are found in the endpoint description." %}

```
{
  "error_code": "REAL_CODES_ARE_IN_ENDPOINT_DESCRIPTION",
  "message": "Additional details about error are not static and can be changed"
}
```

{% endtab %}

{% tab title="401 This failed response appears when API authentication gets failed. The possible error codes that may appear are: auth.tokenNotFound auth.tokenExpired auth.tokenInvalid auth.tokenRequired" %}

```
{
  "code": "auth.tokenNotFound"
}
```

{% endtab %}

{% tab title="500 This failed response appears when something is not right at Whisk's end." %}

```
This is unexpected response, something is wrong on our side, please contact: help@whisk.com
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Note**: Whisk provides its APIs on the Swagger interface for you to try it out. You can call this endpoint [here](https://api.whisk.com/spec/#/MealPlanAPI/MealPlanAPI_UpdateMealPlanSettings).
{% endhint %}

{% tabs %}
{% tab title="Request Body Object Example" %}

```javascript
{
  "meal_plan_id": "string",
  "settings": {
    "servings": 0,
    "calorie_per_day": 0,
    "included_days": [
      "DAY_OF_WEEK_INVALID"
    ],
    "included_meal_types": [
      "MEAL_TYPE_INVALID"
    ],
    "enabled_auto_generation": true,
    "week_template": [
      ...
    ],
    "replace_only_generated": true,
    "week_start": "DAY_OF_WEEK_INVALID",
    "generation_algorithm": "GENERATION_ALGORITHM_INVALID",
    "food_settings": {
      ...
    },
    "custom_labels": {
      ...
    }
  }
}
```

The body object contains the following attributes and arrays that allows you to update the meal plan settings:

| Attribute      | Type   | Description                                                                                                     | Example Value                                                        |
| -------------- | ------ | --------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
| `meal_plan_id` | string | The meal-plan identifier. You can leave it blank when using an Access Token for API authentication.             | `5f27a59a9a8641078c7057eeec0a1b90`                                   |
| `settings`     | array  | This includes all the core settings that you would want to change or adjust before regenerating your meal plan. | See [Meal Plan Settings](/api/meal-plans/get-meal-plan-settings.md). |
| {% endtab %}   |        |                                                                                                                 |                                                                      |

{% tab title="Curl Call Example" %}

```bash
curl -X PUT "https://api.whisk.com/mealplan/v2/settings" 
     -H "accept: application/json" 
     -H "Authorization: Bearer <Access-Token>" 
     -H "Content-Type: application/json" 
     -d "{ \"settings\": { \"servings\": 4, \"calorie_per_day\": 8000, \"included_days\": [ \"DAY_OF_WEEK_TUESDAY\", \"DAY_OF_WEEK_SATURDAY\", \"DAY_OF_WEEK_MONDAY\", \"DAY_OF_WEEK_FRIDAY\", \"DAY_OF_WEEK_WEDNESDAY\", \"DAY_OF_WEEK_SUNDAY\", \"DAY_OF_WEEK_THURSDAY\" ], \"included_meal_types\": [ \"MEAL_TYPE_BREAKFAST\", \"MEAL_TYPE_LUNCH\", \"MEAL_TYPE_DINNER\" ], \"week_template\": [ { \"day\": \"DAY_OF_WEEK_SUNDAY\", \"meal_templates\": [ { \"meal_type\": \"MEAL_TYPE_BREAKFAST\", \"day_slot\": 3 }, { \"meal_type\": \"MEAL_TYPE_LUNCH\", \"day_slot\": 4 }, { \"meal_type\": \"MEAL_TYPE_DINNER\", \"day_slot\": 5 } ] }, { \"day\": \"DAY_OF_WEEK_MONDAY\", \"meal_templates\": [ { \"meal_type\": \"MEAL_TYPE_BREAKFAST\", \"day_slot\": 3 }, { \"meal_type\": \"MEAL_TYPE_LUNCH\", \"day_slot\": 4 }, { \"meal_type\": \"MEAL_TYPE_DINNER\", \"day_slot\": 5 } ] }, { \"day\": \"DAY_OF_WEEK_TUESDAY\", \"meal_templates\": [ { \"meal_type\": \"MEAL_TYPE_BREAKFAST\", \"day_slot\": 3 }, { \"meal_type\": \"MEAL_TYPE_LUNCH\", \"day_slot\": 4 }, { \"meal_type\": \"MEAL_TYPE_DINNER\", \"day_slot\": 5 } ] }, { \"day\": \"DAY_OF_WEEK_WEDNESDAY\", \"meal_templates\": [ { \"meal_type\": \"MEAL_TYPE_BREAKFAST\", \"day_slot\": 3 }, { \"meal_type\": \"MEAL_TYPE_LUNCH\", \"day_slot\": 4 }, { \"meal_type\": \"MEAL_TYPE_DINNER\", \"day_slot\": 5 } ] }, { \"day\": \"DAY_OF_WEEK_THURSDAY\", \"meal_templates\": [ { \"meal_type\": \"MEAL_TYPE_BREAKFAST\", \"day_slot\": 3 }, { \"meal_type\": \"MEAL_TYPE_LUNCH\", \"day_slot\": 4 }, { \"meal_type\": \"MEAL_TYPE_DINNER\", \"day_slot\": 5 } ] }, { \"day\": \"DAY_OF_WEEK_FRIDAY\", \"meal_templates\": [ { \"meal_type\": \"MEAL_TYPE_BREAKFAST\", \"day_slot\": 3 }, { \"meal_type\": \"MEAL_TYPE_LUNCH\", \"day_slot\": 4 }, { \"meal_type\": \"MEAL_TYPE_DINNER\", \"day_slot\": 5 } ] }, { \"day\": \"DAY_OF_WEEK_SATURDAY\", \"meal_templates\": [ { \"meal_type\": \"MEAL_TYPE_BREAKFAST\", \"day_slot\": 3 }, { \"meal_type\": \"MEAL_TYPE_LUNCH\", \"day_slot\": 4 }, { \"meal_type\": \"MEAL_TYPE_DINNER\", \"day_slot\": 5 } ] } ], \"week_start\": \"DAY_OF_WEEK_MONDAY\", \"generation_algorithm\": \"GENERATION_ALGORITHM_3_MEAL\",\"food_settings\": { \"labels\": [ { \"label\": { \"diet\": \"DIET_VEGETARIAN\", \"category\":\"CATEGORY_HEALTHY_RECIPES\", \"avoidance\": \"AVOIDANCE_ALCOHOL\", \"cuisine\": \"CUISINE_WORLD_CUISINE\", \"meal_type\": \"MEAL_TYPE_BRUNCH\", \"nutrition\": \"NUTRITION_HEALTHY\", \"feature\": \"video\", \"holiday\": \"HOLIDAY_INVALID\", \"seasonality\": \"SEASONALITY_INVALID\" }, \"boost\": true } ], \"include_ingredients\": { \"raw_ingredients\": [ { \"name\": \"Tomato\" } ], \"min_ingredients_should_match\": 1 }, \"health_score\": { \"from\": 4 }}}}"
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Hint**: After you update your meal plan settings, you can always crosscheck it using the [Get Meal Plan Settings](/api/meal-plans/get-meal-plan-settings/get-meal-plan-settings.md) endpoint.
{% endhint %}


---

# Agent Instructions: 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:

```
GET https://docs.whisk.com/api/meal-plans/get-meal-plan-settings/update-meal-plan-settings.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
