# Meal Plan Template Search

Use the `mealPlanTemplates` to find templates already created with the createMealPlanTemplate mutation.

{% hint style="info" %}
Use the `Authorization: Token <api-token>` to execute this query.&#x20;
{% endhint %}

### Available Arguments <a href="#available-fields" id="available-fields"></a>

| **Field Name** | **Type** |                                                              **Description**                                                              |
| -------------- | :------: | :---------------------------------------------------------------------------------------------------------------------------------------: |
| `search`       |  string  |                                         Introduce the word or the template name you want to find.                                         |
| `byCoach`      |    ID    |                           Unique Id of the Coach. Use this if the third party has access to the Coaching Portal                           |
| `excludeCoach` |    ID    | Unique Id of the Coach which information will be excluded from the search.  Use this if the third party has access to the Coaching Portal |
| `newerFirst`   |  boolean |                                    True if the results will show the newer meal plan templates created                                    |

### Available Fields

| **Field Name** | **Type** |                                     **Description**                                     |
| :------------: | :------: | :-------------------------------------------------------------------------------------: |
|      `id`      |    ID    |                                    Unique template ID                                   |
|  `description` |  String  |                               Description of the template                               |
|    `coachId`   |    ID    | Unique Coach Id template. Use this if the third party has access to the Coaching Portal |
|   `isPublic`   |  Boolean |          `T`**rue** if the template is Public. Otherwise it displays **False**          |
|    createdAt   | DateTime |                  Date and time when the meal plan template was created                  |

### Pagination

The `mealPlanTemplates` query supports the use of [pagination](https://docs.suggestic.com/graphql/start-here/tutorials-and-walkthroughs/pagination). The following fields can be used

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

```graphql
 pageInfo{
      hasNextPage
      hasPreviousPage
      startCursor
      endCursor
    }
```

{% endtab %}
{% endtabs %}

### Example

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

```graphql
query {
  mealPlanTemplates {
    edges {
      node {
        id
        description
        createdAt
        coachId
        isPublic
        days {
          day
          meals {
            recipe {
              name
            }
            calories
            numOfServings
          }
        }
      }
    }
  }
}


```

{% endtab %}

{% tab title="Result" %}

```graphql
{
  "data": {
    "mealPlanTemplates": {
      "edges": [
        {
          "node": {
            "id": "TWVhbFBsYW5UZW1wbGF0ZTphY2FkYWY4Yy1jMWY5LTQyN2MtOGZlOS0zNjgyZjIxYThhYjE=",
            "description": "The very first",
            "createdAt": "2022-01-14T15:13:01.255979+00:00",
            "coachId": null,
            "isPublic": false,
            "days": [
              {
                "day": 1,
                "meals": [
                  {
                    "recipe": {
                      "name": "Caprese-Style Salad With Chicken"
                    },
                    "calories": 414.554124274375,
                    "numOfServings": 2
                  }
                ]
              }
            ]
          }
        }
      ]
    }
  }
}
```

{% 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/search/meal-plan-template-search.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.
