> 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/create-meal-plan-template/from-scratch.md).

# From Scratch

Send a complete meal plan and define the number of days of it. All the parameters such as **days**, **recipes**, etc., have to be introduced manually. All this information is later saved as a template.

### Available Arguments

Refer to [this document](https://docs.suggestic.com/graphql/query/mutations/meal-plan/create-meal-plan-template#available-arguments) to see the available arguments to use in this mutation.

## Examples

### Create a meal plan template from scratch

The following example creates a one day meal plan:

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

```graphql
mutation {
  createMealPlanTemplate(
    name: "New meal plan template"
    description: "The very first"
    fromScratch: {
      days: [
        {
          meals: [
            {
              recipeId: "UmVjaXBlOmFmMDkzMjQ0LWZkZTMtNGE3Yy1iMTA4LWUxODExNTBkNmNiZQ=="
              mealType: BREAKFAST
              servings: 2
            }
          ]
        }
      ]
    }
  ) {
    message
    success
  }
}
```

{% endtab %}

{% tab title="Result" %}

```graphql
{
  "data": {
    "createMealPlanTemplate": {
      "message": "Meal plan template created",
      "success": true
    }
  }
}
```

{% endtab %}
{% endtabs %}

### Create a 2-day meal plan&#x20;

The following example creates a two-day meal plan

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

```graphql
mutation {
  createMealPlanTemplate(
    name: "Vegetarian Meal Plan"
    description: "All meal types"
    fromScratch: {
    days: [
    {
        meals: [
        {
            recipeId: "UmVjaXBlOjE2OTBlMjU1LWFhZGUtNDA2Yy05MTJiLWZhYTI0MDVmYTk2Zg=="
            mealType: BREAKFAST
            servings: 2
        },
        {
            recipeId: "UmVjaXBlOjE1MDk0MDQxLTYyMWItNGM0Ni04OGViLTUzM2FlNmRlMTI4Zg=="
            mealType: SNACK
            servings: 3
        }
       ]
    },
    {
        meals: [
            {
            recipeId: "UmVjaXBlOjE2OTBlMjU1LWFhZGUtNDA2Yy05MTJiLWZhYTI0MDVmYTk2Zg=="
            mealType: BREAKFAST
            servings: 2
            }
        ]
    }
    ]
}
  ) {
    message
    success
  }
}
```

{% endtab %}

{% tab title="Response" %}

```graphql
{
  "data": {
    "createMealPlanTemplate": {
      "message": "Meal plan template created",
      "success": true
    }
  }
}
```

{% endtab %}
{% endtabs %}

The meal plan generated will have the following format:

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

```graphql
{
  "data": {
    "mealPlan": [
      {
        "day": 2,
        "date": "2022-01-15",
        "calories": 1261.637375,
        "meals": [
          {
            "id": "TWVhbDoyMzQwMDQ5",
            "calories": 1261.637375,
            "meal": "breakfast",
            "numOfServings": 2,
            "recipe": {
              "name": "Coconut Milk Yogurt With Fruit And Nuts",
              "numberOfServings": 1,
              "nutrientsPerServing": {
                "calories": 1261.64
              }
            }
          }
        ]
      },
      {
        "day": 1,
        "date": "2022-01-14",
        "calories": 1775.813475,
        "meals": [
          {
            "id": "TWVhbDoyMzQwMDQ3",
            "calories": 1261.637375,
            "meal": "breakfast",
            "numOfServings": 2,
            "recipe": {
              "name": "Coconut Milk Yogurt With Fruit And Nuts",
              "numberOfServings": 1,
              "nutrientsPerServing": {
                "calories": 1261.64
              }
            }
          },
          {
            "id": "TWVhbDoyMzQwMDQ4",
            "calories": 514.1761,
            "meal": "snack",
            "numOfServings": 3,
            "recipe": {
              "name": "Apple-Orange Smoothie With Yogurt",
              "numberOfServings": 1,
              "nutrientsPerServing": {
                "calories": 514.18
              }
            }
          }
        ]
      }
    ]
  }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.suggestic.com/graphql/query/mutations/meal-plan/create-meal-plan-template/from-scratch.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
