# 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 %}
