---
description: Update a user's food restrictions (food preferences).
---

# User's Restrictions

Use the `profileRestrictionsUpdate` mutation to update a user's food restrictions.

A list of all the available food restrictions can be retrieved using the [Restrictions](https://docs.suggestic.com/graphql/query/queries/restrictions) query.&#x20;

### Required Argument

| Arguments      | Type  | Description                |
| -------------- | ----- | -------------------------- |
| `restrictions` | \[ID] | Array of restrictions ID's |

### Available Argument

| Argument  | Type    | Description                                                                                                                                                                                                                             |
| --------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `replace` | Boolean | If **true**, the profile restrictions are set to only the IDs sent in the mutation. If **false**, the restrictions received are added to the current ones.  If this argument is not sent, by default its value will be set to **True.** |

{% hint style="info" %}
Vegan and vegetarian are very common use cases, for those, please set the following restrictions:

* For **vegetarian**, activate the _**R Animal Origin (non-vegetarian)**_ restriction. Id: UmVzdHJpY3Rpb246ZDY3NTA1MTktZTE4Zi00NWRkLTgxZWYtODAyNzk0MzYyZWRl
* For **vegan**, activate the _**R Animal Origin (all)**_ restriction, Id: UmVzdHJpY3Rpb246YzhmODQwMmMtYzEyNi00OWM3LWEyMzEtNWNmNjI0ZDlmNTlj
{% endhint %}

### Examples

The following example adds two restrictions to the current user's profile:

{% tabs %}
{% tab title="Mutation" %}
```graphql
mutation {
  profileRestrictionsUpdate(
    restrictions: [
      "UmVzdHJpY3Rpb246M2ZmZDQ1OGUtMjczZi00MTZmLWE5NjYtNmFkYzliYjQ3OWE1",
      "UmVzdHJpY3Rpb246ODU1ZjkzZjYtODQzOC00MTIzLTk3YzktM2U2YzU2MzllZjli"
    ]) {
    success
  }
}

```
{% endtab %}

{% tab title="Response" %}
```javascript
{
  "data": {
    "profileRestrictionsUpdate": {
      "success": true
    }
  }
}
```
{% endtab %}
{% endtabs %}

Note that the replace argument is not defined; therefore, those will be the only two restrictions set to the current user's profile.

Validate that the restrictions are successfully updated using the[ My Profile](https://docs.suggestic.com/graphql/query/queries/my-profile) query to obtain a list of restrictions currently set to the user's profile.

{% tabs %}
{% tab title="Query" %}
```graphql
{
  myProfile {
    programName
    restrictions{
      id
      name
      isOnProgram
      subcategory
      slugname 
    }
  }
}
```
{% endtab %}

{% tab title="Response" %}
```javascript
{
  "data": {
    "myProfile": {
      "programName": "Balanced Diet",
      "restrictions": [
        {
          "id": "UmVzdHJpY3Rpb246ODU1ZjkzZjYtODQzOC00MTIzLTk3YzktM2U2YzU2MzllZjli",
          "name": "Dairy",
          "isOnProgram": false,
          "subcategory": "Most Common",
          "slugname": "dairy"
        },
        {
          "id": "UmVzdHJpY3Rpb246M2ZmZDQ1OGUtMjczZi00MTZmLWE5NjYtNmFkYzliYjQ3OWE1",
          "name": "Gluten",
          "isOnProgram": false,
          "subcategory": "Most Common",
          "slugname": "gluten"
        }
      ]
    }
  }
}
```
{% endtab %}
{% endtabs %}

In the following example, the replace argument is set as **False:**

{% tabs %}
{% tab title="Mutation" %}
```graphql
mutation {
  profileRestrictionsUpdate(
    restrictions: [
      "UmVzdHJpY3Rpb246NDI3MDM0MTEtNDA3OC00NTkyLWE1YjctNDgxM2I2NzMwYjg3"
    ]
    replace: false
    ) 
  {
    success
  }
}


```
{% endtab %}

{% tab title="Response" %}
```graphql
{
  "data": {
    "profileRestrictionsUpdate": {
      "success": true
    }
  }
}
```
{% endtab %}
{% endtabs %}

Use the [My Profile](https://docs.suggestic.com/graphql/query/queries/my-profile) query to obtain a list of restrictions currently set to the user's profile. See that the new restriction has been added to the list of user's restrictions:

{% tabs %}
{% tab title="Query" %}
```graphql
{
  myProfile {
    programName
    restrictions{
      id
      name
      isOnProgram
      subcategory
      slugname 
    }
  }
}
```
{% endtab %}

{% tab title="Response" %}
```javascript
{
  "data": {
    "myProfile": {
      "programName": "Balanced Diet",
      "restrictions": [
        {
          "id": "UmVzdHJpY3Rpb246NDI3MDM0MTEtNDA3OC00NTkyLWE1YjctNDgxM2I2NzMwYjg3",
          "name": "Avocado",
          "isOnProgram": false,
          "subcategory": "Fruits and Vegetables",
          "slugname": "avocado"
        },
        {
          "id": "UmVzdHJpY3Rpb246M2ZmZDQ1OGUtMjczZi00MTZmLWE5NjYtNmFkYzliYjQ3OWE1",
          "name": "Gluten",
          "isOnProgram": false,
          "subcategory": "Most Common",
          "slugname": "gluten"
        },
        {
          "id": "UmVzdHJpY3Rpb246ODU1ZjkzZjYtODQzOC00MTIzLTk3YzktM2U2YzU2MzllZjli",
          "name": "Dairy",
          "isOnProgram": false,
          "subcategory": "Most Common",
          "slugname": "dairy"
        }
      ]
    }
  }
}
```
{% endtab %}
{% endtabs %}

