# Meal Plan

This is how the data structure of a Meal Plan object looks like:

```javascript
{
  "meal_plan_id": "5f27a59a9a8641078c7057eeec0a1b90",
  "start_date": 
    ...
  "end_date":
    ...
  "meals": [
    {
      "id": "894f285cd9d543d3b78b374f59b56311",
      "meal_type": "MEAL_TYPE_BREAKFAST",
      "date_time":
        ...
      "content": {
        "recipe": 
          ...
      },
      "generated": true,
      "day_slot": 3,
      "date":
        ...
    },
    {
      "id": "aab8f93131724117836f8cab365518c6",
      "meal_type": "MEAL_TYPE_LUNCH",
      "date_time":
        ...
      "content": {
        "recipe": 
          ...
      },
      "generated": true,
      "day_slot": 4,
      "date":
        ...
    },
    {
      "id": "4b50cf3d2bf24ebe9c4630d2816fea99",
      "meal_type": "MEAL_TYPE_DINNER",
      "date_time":
        ...
      "content": {
        "recipe": 
          ...
      },
      "generated": true,
      "day_slot": 5,
      "date":
        ...
    },
    ...
  ],
  "result_code": "GENERATION_RESULT_CODE_SUCCESS"
}
```

The following attributes store the core information of a meal plan:

| Attribute      | Type   | Description                                              | Example Value                                                                                                                                                                                                                                                                                                 |
| -------------- | ------ | -------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `meal_plan_id` | string | The meal plan identifier.                                | `aab8f93131724117836f8cab365518c6`                                                                                                                                                                                                                                                                            |
| `start_date`   | array  | The start date of the meal plan.                         | See [`start_date`](/api/meal-plans.md#start_date-end_date).                                                                                                                                                                                                                                                   |
| `end_date`     | array  | The end date of the meal plan.                           | See [`end_date`](/api/meal-plans.md#start_date-end_date).                                                                                                                                                                                                                                                     |
| `meals`        | array  | The information on different meals included in the plan. | See [`meals`](/api/meal-plans.md#meals).                                                                                                                                                                                                                                                                      |
| `result_code`  | string | The meal plan generation result code.                    | <ul><li><code>GENERATION\_RESULT\_CODE\_SUCCESS</code>: Appears when the meal plan is generated successfully. </li><li><code>GENERATION\_RESULT\_CODE\_NOT\_ENOUGH\_MEALS</code>: Appears when the meal plan fails to generate due to an insufficient number or variety of meals available for you.</li></ul> |

Each array further contains additional attributes as described below.

#### **`start_date`/`end_date`**

```javascript
  "start_date": {
    "year": 2020,
    "month": 10,
    "day": 1
  },
  "end_date": {
    "year": 2020,
    "month": 10,
    "day": 10
  },
```

| Attribute | Type    | Description           | Example Value |
| --------- | ------- | --------------------- | ------------- |
| `year`    | integer | The year.             | `2020`        |
| `month`   | integer | The month.            | `10`          |
| `day`     | integer | The day of the month. | `1`           |

#### **`meals`**

```javascript
"meals": [
    {
      "id": "894f285cd9d543d3b78b374f59b56311",
      "meal_type": "MEAL_TYPE_BREAKFAST",
      "date_time":
        ...
      "content": {
        "recipe": 
          ...
      },
      "generated": true,
      "day_slot": 3,
      "date":
        ...
    },
    ...
    ],
```

| Attribute   | Type    | Description                                                                                                                             | Example Value                                                                                                                                     |
| ----------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| `id`        | string  | The meal identifier.                                                                                                                    | `894f285cd9d543d3b78b374f59b56311`                                                                                                                |
| `meal_type` | string  | A label to identify the type of meal.                                                                                                   | <ul><li><code>MEAL\_TYPE\_BREAKFAST</code></li><li><code>MEAL\_TYPE\_LUNCH</code></li><li><code>MEAL\_TYPE\_DINNER</code></li></ul>               |
| `date_time` | array   | This attribute is deprecated and displays the same value as the `date` attribute.                                                       | -                                                                                                                                                 |
| `content`   | array   | Contains the recipe data for the meal.                                                                                                  | See [Recipe Data](/api/recipes.md#data-structure).                                                                                                |
| `generated` | boolean | Shows whether the meal is auto-generated or has been manually added by the user to the meal plan.                                       | <ul><li><code>true</code></li><li><code>false</code></li></ul>                                                                                    |
| `day_slot`  | number  | The day slot assigned to the meal. Each day consists of up to 7 slots, each containing a single meal along with its recipe information. | `3`                                                                                                                                               |
| `date`      | array   | The date assigned to the meal.                                                                                                          | <p><code>"date": {</code> <br>    <code>"year": 2020,</code><br>    <code>"month": 10,</code><br>    <code>"day": 1</code> <br><code>}</code></p> |

The Meal Plan API provides the following endpoints:

{% hint style="info" %}
**Note**: All Meal Plan API endpoints first check whether a meal plan is already assigned to the user. When not found, a meal plan gets created and assigned to the user automatically. This means there is no need to manually create a meal plan for the user.
{% endhint %}

{% content-ref url="/pages/-M4oWupPXR3ZXWQRZAfS" %}
[Generate a Meal Plan](/api/meal-plans/generate_mealplan.md)
{% endcontent-ref %}

{% content-ref url="/pages/-MN9-crs6JpDQJsHiazT" %}
[Get Meal Plan Settings](/api/meal-plans/get-meal-plan-settings/get-meal-plan-settings.md)
{% endcontent-ref %}

{% content-ref url="/pages/-MN9-\_xv7UKRnfxMvysX" %}
[Update Meal Plan Settings](/api/meal-plans/get-meal-plan-settings/update-meal-plan-settings.md)
{% endcontent-ref %}

{% content-ref url="/pages/-M4oWupQlg4JB0Ywgx3X" %}
[Get Meals](/api/meal-plans/meal/meal-plan-management.md)
{% endcontent-ref %}

{% content-ref url="/pages/-MIVJOIzfBJuWPtQz\_OL" %}
[Add a Meal](/api/meal-plans/meal/update-meal.md)
{% endcontent-ref %}

{% content-ref url="/pages/-M7rEY2LzRX6QrWvqKbN" %}
[Delete Meal](/api/meal-plans/meal/delete-meals.md)
{% endcontent-ref %}


---

# 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.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.
