> For the complete documentation index, see [llms.txt](https://docs.whisk.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.whisk.com/api/user-model/update-a-user.md).

# Update User Settings using Patch

This API available only for user access-token integration

Endpoint allows updating fields in a User by its `ID`on the Graph or by `externalUserId`. In the JSON request body, include a JsonPatch patch object that specifies the operation to perform, one or more fields to update, and a new value for each updated field.

{% hint style="info" %}
**Note**: To know more about JsonPatch take a look at [JsonPatch ](http://jsonpatch.com/)website.
{% endhint %}

## Update Recipe

<mark style="color:purple;">`PATCH`</mark> `https://api.whisk.com/user/v2/settings`

#### Path Parameters

| Name | Type   | Description                              |
| ---- | ------ | ---------------------------------------- |
| id   | string | User Id on the Graph or User external Id |

#### Request Body

| Name  | Type   | Description                                                                  |
| ----- | ------ | ---------------------------------------------------------------------------- |
| op    | string | The operation to perform: `Add`, `Remove`, `Replace`, `Copy`, `Move`, `Test` |
| path  | string |                                                                              |
| from  | string |                                                                              |
| value | string |                                                                              |

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

```javascript
{
  "id": "3d4fda8595114a3a9f7b12fd471a4169",
  "externalId": "1654732567",
  "email": "johndoe@whisk.com",
  "firstName": "John",
  "lastName": "Doe",
  "displayName": "John Doe",
  "pictureUrl": "http://john.doe.picture.url.jpg",
  "updatedAt": 1524150524000,
  "createAt": 1524150524000,
  "preferences": {
    "diets": [
      "vegetarian",
      "vegan"
    ],
    "avoidances": [
      "egg",
      "celery"
    ],
    "dislikedIngredients": [
      {
        "name": "milk"
      }
    ],
    "householdSizeAdults": 2,
    "householdSizeChildren": 1,
    "gender": "male",
    "cookingSkill": "amateur",
    "language": "ko",
    "country": "kr"
  }
}
```

{% endtab %}
{% endtabs %}

### Sample Request

```bash
curl "https://graph.whisk.com/v1/users" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer <Access-Token>" \
  -d '[
    {
      "op": "remove",
      "path": "/email"
    },
    {
      "op": "replace",
      "path": "/displayName",
      "value": "John Doe"
    },
    {
      "op": "add",
      "path": "/pictureUrl",
      "value": ""
    }
  ]'
```

## Response

| ATTRIBUTE      | TYPE            | DESCRIPTION                                                                                                                    |
| -------------- | --------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| id\*           | string          | The id of the User on Whisk Graph                                                                                              |
| externalUserId | string          | The user id you have defined for the user. (Max limit of 255 UTF-8 characters, and should not have trailing or leading spaces) |
| email          | string          | The email you have defined for the user. (Max limit of 255 UTF-8 characters, and should not have trailing or leading spaces)   |
| firstName      | string          | The first name of the user                                                                                                     |
| lastName       | string          | The last name of the user                                                                                                      |
| displayName    | string          | The display name of the user                                                                                                   |
| createdAt\*    | timestamp       | The time the user was added to Whisk                                                                                           |
| updatedAt\*    | timestamp       | The last time the user was updated                                                                                             |
| pictureUrl     | string          | The profile picture url of a user                                                                                              |
| preferences    | UserPreferences |                                                                                                                                |

### UserPreferences

| ATTRIBUTE             | TYPE            | DESCRIPTION                                                                                                       |
| --------------------- | --------------- | ----------------------------------------------------------------------------------------------------------------- |
| country               | string          | Country iso code. Examples: gb, kr, us...                                                                         |
| zipcode               | string          | Postal code. Examples: 10001, 80333...                                                                            |
| language              | string          | Language iso code. Examples: en, ko, fr...                                                                        |
| cookingSkill          | enum            | Measure of a person’s competence in preparing and cooking foods Possible values: amateur, intermediate, advanced. |
| gender                | enum            | Possible values: female, male.                                                                                    |
| householdSizeChildren | integer         | Number of children                                                                                                |
| householdSizeAdults   | integer         | Number of adults Default value: 1                                                                                 |
| dislikedIngredients   | array \[string] | Products and ingredients which will be excluded in search and feed APIs.                                          |
| diets                 | array \[string] | more about diets                                                                                                  |
| avoidances            | array \[string] | more about avoidances                                                                                             |


---

# 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.whisk.com/api/user-model/update-a-user.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.
