# Update Meal Plan Settings

Use the `updateMealPlanSettings` mutation to update or overwrite the user's meal plan settings. All the arguments to be sent are optional; however, it will update only the arguments sent in the mutation. The information is saved and it can be later requested by executing the [mealPlan](https://docs.suggestic.com/graphql/query/queries/meal-plan/meal-plan-1) query.&#x20;

### Required Arguments

|  **Name**  | **Type** |                                                                       **Description**                                                                       |
| :--------: | :------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------: |
|  `update`  |  Object  |                                    Update the values added to it. For example, `update: { calories: 1600, protein: 20 }`                                    |
| `ovewrite` |  Object  | Overwrite only the values added to it. The ones that were not added will be set as `null`. For example: `overwrite: { format: [BREAKFAST, LUNCH, DINNER] }` |

{% hint style="info" %}
If the `update` and `overwrite` arguments are defined at the same time, the `overwrite` argument will be the one applied.&#x20;
{% endhint %}

### Available Arguments

Use the following arguments within the update and overwrite objects:

<table data-header-hidden><thead><tr><th width="184.33333333333331">Arguments</th><th width="150">Type</th><th>Description</th></tr></thead><tbody><tr><td><strong>Arguments</strong></td><td><strong>Type</strong></td><td><strong>Description</strong></td></tr><tr><td><code>calories</code></td><td>Int</td><td>Total Calories per day. If using the overwrite and no calories value is defined, the default value is set to 1400.</td></tr><tr><td><code>carbs</code></td><td>Int</td><td>Percent of Carbs</td></tr><tr><td><p></p><p><code>fat</code></p></td><td>Int</td><td>Percent of Fat</td></tr><tr><td><code>format</code></td><td>MealTime!</td><td><p>Requested meals per day format. Available options: <code>BREAKFAST, SNACK, LUNCH, DINNER</code>.  </p><p>The list cannot have a null value, i.e, <code>[BREAKFAST, null]</code>. However, it is possible to send the list in the following formats:</p><ul><li><code>format: null</code> </li><li><code>format: []</code> </li><li>Not send a format</li></ul><p>If not format is sent, the following format is set as default: <code>[BREAKFAST, SNACK, LUNCH, DINNER]</code></p></td></tr><tr><td><code>omega3</code></td><td>Float</td><td>Percent of Omega 3.</td></tr><tr><td><code>protein</code></td><td>Int</td><td>Percent of Protein</td></tr></tbody></table>

### Example

The following example updates the protein and calories values:

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

```graphql
mutation updateMealPlanSettings {
  updateMealPlanSettings(
    update: { calories: 1600, protein: 20 }
  ) {
    success
    message
  }
}

```

{% endtab %}

{% tab title="Response" %}

```graphql
{
  "data": {
    "updateMealPlanSettings": {
      "success": true,
      "message": "Settings updated"
    }
  }
}
```

{% endtab %}
{% endtabs %}

The following example updates the meal format and sets automatically the rest of arguments not send as null:

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

```graphql
mutation updateMealPlanSettings {
  updateMealPlanSettings(
    overwrite: { format: [BREAKFAST, LUNCH, DINNER] }
  ) {
    success
    message
  }
}

```

{% endtab %}

{% tab title="Response" %}

```graphql
{
  "data": {
    "updateMealPlanSettings": {
      "success": true,
      "message": "Settings updated"
    }
  }
}
```

{% endtab %}
{% endtabs %}

The following example uses query variables and updates the calories and proteins values:

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

```graphql
mutation($update: UpdateMPSettingsInput, $overwrite: UpdateMPSettingsInput) {
  updateMealPlanSettings(update: $update, overwrite: $overwrite) {
    success
    message
  }
}
```

{% endtab %}

{% tab title="Response" %}

```graphql
{
  "data": {
    "updateMealPlanSettings": {
      "success": true,
      "message": "Settings updated"
    }
  }
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="QUERY VARIABLES" %}

```graphql
{
  "overwrite": {"calories": 1600, "protein": 20}
}

```

{% endtab %}
{% endtabs %}


---

# 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.suggestic.com/graphql/query/mutations/user-profile/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.
