# Get a User

Endpoint allows getting a User by its `ID`on the Graph or by `externalUserId`. This API available only for user access-token integration.

## Get User

<mark style="color:blue;">`GET`</mark> `https://api.whisk.com/user/v2/me`

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

```javascript
{
  "user": {
    "id": "string",
    "email": "string",
    "phone": "string",
    "user_settings": {
      "personal_details": {
        "first_name": "string",
        "last_name": "string",
        "photo_url": "string",
        "gender": "GENDER_INVALID",
        "country": "string",
        "zipcode": "string",
        "language": "string",
        "activity_level": "ACTIVITY_LEVEL_INVALID",
        "age": 0,
        "height": {
          "value": 0,
          "unit": "UNIT_INVALID"
        },
        "weight": {
          "value": 0,
          "unit": "UNIT_INVALID"
        },
        "health_goals": {
          "list": [
            "HEALTH_GOAL_INVALID"
          ]
        },
        "year_of_birth": 0
      },
      "food_preferences": {
        "diets": {
          "list": [
            "DIET_INVALID"
          ]
        },
        "avoidance_list": {
          "list": [
            "AVOIDANCE_INVALID"
          ]
        },
        "disliked_ingredients": {
          "list": [
            {
              "name": "string",
              "canonical_name": "string"
            }
          ]
        },
        "organic_preference": "ORGANIC_PREFERENCE_INVALID",
        "nutrition_preferences": {
          "list": [
            "NUTRITION_INVALID"
          ]
        },
        "preferred_ingredients": {
          "list": [
            {
              "name": "string",
              "canonical_name": "string"
            }
          ]
        }
      },
      "cooking_preferences": {
        "household_adults": {
          "size": 0
        },
        "household_children": {
          "size": 0
        },
        "favourite_cuisines": {
          "list": [
            "CUISINE_INVALID"
          ]
        },
        "cooking_experience": "COOKING_EXPERIENCE_INVALID",
        "cooking_max_time": {
          "time": 0
        },
        "user_devices": {
          "list": {
            "device_type": "DEVICE_TYPE_INVALID",
            "custom_device": "DEVICE_TYPE_INVALID"
          }
        }
      },
      "shopping_preferences": {
        "preferred_retailers": {
          "retailers": [
            "string"
          ]
        },
        "budget_goal": "BUDGET_GOAL_INVALID",
        "ethical_preferences": {
          "list": [
            "ETHICAL_PREFERENCE_INVALID"
          ]
        }
      }
    },
    "has_password": true,
    "recommendations": {
      "daily_calories": 0
    }
  }
}
```

{% endtab %}

{% tab title="401 " %}

```
{
  "code": "auth.tokenRequired"
}
```

{% endtab %}
{% endtabs %}

### Sample Request

```bash
curl "https://api.whisk.com/user/v2/me" \
    -H "Accept: application/json" \
    -H "Authorization: Bearer <Access-Token>"
```

## Response

```bash
{
  "user": {
    "id": "string",
    "email": "string",
    "phone": "string",
    "user_settings": {
      ...
    },
    "has_password": true,
    "recommendations": {
      "daily_calories": 0
    }
  }
}
```

| ATTRIBUTE       | TYPE   | DESCRIPTION                                                                                                                  |
| --------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------- |
| id              | string | The id of the User on Whisk Graph                                                                                            |
| 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) |
| phone           | string |                                                                                                                              |
| user\_settings  | object |                                                                                                                              |
| has\_password   | bool   |                                                                                                                              |
| recommendations | object |                                                                                                                              |

### User Settings

In addition to the above data, you will also get a `user_settings` object back that looks like this:

```bash
"user_settings": {
      "personal_details": {
        "first_name": "string",
        "last_name": "string",
        "photo_url": "string",
        "gender": "GENDER_INVALID",
        "country": "string",
        "zipcode": "string",
        "language": "string",
        "activity_level": "ACTIVITY_LEVEL_INVALID",
        "age": 0,
        "height": {
          "value": 0,
          "unit": "UNIT_INVALID"
        },
        "weight": {
          "value": 0,
          "unit": "UNIT_INVALID"
        },
        "health_goals": {
          "list": [
            "HEALTH_GOAL_INVALID"
          ]
        },
        "year_of_birth": 0
      },
      "food_preferences": {
        "diets": {
          "list": [
            "DIET_INVALID"
          ]
        },
        "avoidance_list": {
          "list": [
            "AVOIDANCE_INVALID"
          ]
        },
        "disliked_ingredients": {
          "list": [
            {
              "name": "string",
              "canonical_name": "string"
            }
          ]
        },
        "organic_preference": "ORGANIC_PREFERENCE_INVALID",
        "nutrition_preferences": {
          "list": [
            "NUTRITION_INVALID"
          ]
        },
        "preferred_ingredients": {
          "list": [
            {
              "name": "string",
              "canonical_name": "string"
            }
          ]
        }
      },
      "cooking_preferences": {
        "household_adults": {
          "size": 0
        },
        "household_children": {
          "size": 0
        },
        "favourite_cuisines": {
          "list": [
            "CUISINE_INVALID"
          ]
        },
        "cooking_experience": "COOKING_EXPERIENCE_INVALID",
        "cooking_max_time": {
          "time": 0
        },
        "user_devices": {
          "list": {
            "device_type": "DEVICE_TYPE_INVALID",
            "custom_device": "DEVICE_TYPE_INVALID"
          }
        }
      },
      "shopping_preferences": {
        "preferred_retailers": {
          "retailers": [
            "string"
          ]
        },
        "budget_goal": "BUDGET_GOAL_INVALID",
        "ethical_preferences": {
          "list": [
            "ETHICAL_PREFERENCE_INVALID"
          ]
        }
      }
    },
```

###

{% hint style="info" %}
For more information on the user\_settings object, visit the [User Setting page](https://docs.whisk.com/api/user-model/user-profile).
{% endhint %}

### UserPreferences

| 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 |                                                                                                                                |
|                |                 |                                                                                                                                |

| 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            | The 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                                                                                                 |
