# Assign a Meal Plan Template to a User

Use the `setMealPlanToTemplate` mutation to assign a meal plan template created to a user.&#x20;

The meal plan template assigned to a user does not affect the goals and the restrictions configured for that specific user.

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

### Required Arguments

|                   |          |                                                                                                                                                                  |
| :---------------: | :------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------: |
| **Argument Name** | **Type** |                                                                          **Description**                                                                         |
|    `profileID`    |    ID    |                                                  Unique user profile ID to which the template will be assigned.                                                  |
|    `templateId`   |    ID    | Unique template ID. Get this information by executing the [`mealPlanTemplates`](https://docs.suggestic.com/graphql/query/search/meal-plan-template-search) query |

### Available Fields

The following field will be part of the response.

| **Field name** | **Type** | **Description**                                                                       |
| -------------- | -------- | ------------------------------------------------------------------------------------- |
| `success`      | Boolean  | **True** if the meal plan template has been created. Otherwise, it displays **False** |
| `message`      | String   | Description of the result                                                             |

## Example

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

```graphql
mutation {
  setMealPlanToTemplate(
    templateId: "TWVhbFBsYW5UZW1wbGF0ZTo3NzA0MmNkOS1kNjJjLTRhNjYtOWM2ZS00YTkyYmZiMDUzZjA="
    profileId: "UHJvZmlsZTo3MzliNmExOC1lMjJjLTRiNTktYWZhZC00NTE1NTYxZGM4NDA="
  ) {
    success
    message
  }
}

```

{% endtab %}

{% tab title="Response" %}

```graphql
{
  "data": {
    "setMealPlanToTemplate": {
      "success": true,
      "message": "Meal plan was updated"
    }
  }
}
```

{% 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/meal-plan/assign-a-meal-plan-template-to-a-user.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.
