# User

## Assign a healthcare party ID to current user

<mark style="color:orange;">`PUT`</mark> `https://demo.icure.cloud/rest/v2/user/current/hcparty/{healthcarePartyId}`

UserDto gets returned.

#### Path Parameters

| Name                                                | Type   | Description |
| --------------------------------------------------- | ------ | ----------- |
| healthcarePartyId<mark style="color:red;">\*</mark> | String |             |

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

{% endtab %}
{% endtabs %}

<mark style="color:blue;">`GET`</mark> `https://demo.icure.cloud/rest/v2/user/checkPassword`

#### Headers

| Name                                       | Type   | Description |
| ------------------------------------------ | ------ | ----------- |
| password<mark style="color:red;">\*</mark> | String |             |

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

{% endtab %}
{% endtabs %}

## Check token validity

<mark style="color:blue;">`GET`</mark> `https://demo.icure.cloud/rest/v2/user/token/{userId}`

#### Path Parameters

| Name                                     | Type   | Description |
| ---------------------------------------- | ------ | ----------- |
| userId<mark style="color:red;">\*</mark> | String |             |

#### Headers

| Name                                    | Type   | Description |
| --------------------------------------- | ------ | ----------- |
| token<mark style="color:red;">\*</mark> | String |             |

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

{% endtab %}
{% endtabs %}

## Create a user

<mark style="color:green;">`POST`</mark> `https://demo.icure.cloud/rest/v2/user`

Create a user. HealthcareParty ID should be set. Email or Login have to be set. If login hasn't been set, Email will be used for Login instead.

#### Request Body

| Name                                   | Type | Description |
| -------------------------------------- | ---- | ----------- |
| body<mark style="color:red;">\*</mark> | User |             |

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

{% endtab %}
{% endtabs %}

## Create a user

<mark style="color:green;">`POST`</mark> `https://demo.icure.cloud/rest/v2/user/inGroup/{groupId}`

Create a user. HealthcareParty ID should be set. Email has to be set and the Login has to be null. On server-side, Email will be used for Login.

#### Path Parameters

| Name                                      | Type   | Description |
| ----------------------------------------- | ------ | ----------- |
| groupId<mark style="color:red;">\*</mark> | String |             |

#### Request Body

| Name                                   | Type | Description |
| -------------------------------------- | ---- | ----------- |
| body<mark style="color:red;">\*</mark> | User |             |

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

{% endtab %}
{% endtabs %}

## Delete a User based on his/her ID.

<mark style="color:red;">`DELETE`</mark> `https://demo.icure.cloud/rest/v2/user/{userId}`

Delete a User based on his/her ID. The return value is an array containing the ID of deleted user.

#### Path Parameters

| Name                                     | Type   | Description |
| ---------------------------------------- | ------ | ----------- |
| userId<mark style="color:red;">\*</mark> | String |             |

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

{% endtab %}
{% endtabs %}

## Delete a User based on his/her ID.

<mark style="color:red;">`DELETE`</mark> `https://demo.icure.cloud/rest/v2/user/inGroup/{groupId}/{userId}`

Delete a User based on his/her ID. The return value is an array containing the ID of deleted user.

#### Path Parameters

| Name                                      | Type   | Description |
| ----------------------------------------- | ------ | ----------- |
| groupId<mark style="color:red;">\*</mark> | String |             |
| userId<mark style="color:red;">\*</mark>  | String |             |

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

{% endtab %}
{% endtabs %}

<mark style="color:blue;">`GET`</mark> `https://demo.icure.cloud/rest/v2/user/encodePassword`

#### Headers

| Name                                       | Type   | Description |
| ------------------------------------------ | ------ | ----------- |
| password<mark style="color:red;">\*</mark> | String |             |

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

{% endtab %}
{% endtabs %}

## Get the list of users by healthcare party id

<mark style="color:blue;">`GET`</mark> `https://demo.icure.cloud/rest/v2/user/byHealthcarePartyId/{id}`

#### Path Parameters

| Name                                 | Type   | Description |
| ------------------------------------ | ------ | ----------- |
| id<mark style="color:red;">\*</mark> | String |             |

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

{% endtab %}
{% endtabs %}

## Send a forgotten email message to an user

<mark style="color:green;">`POST`</mark> `https://demo.icure.cloud/rest/v2/user/forgottenPassword/{email}`

#### Path Parameters

| Name                                    | Type   | Description           |
| --------------------------------------- | ------ | --------------------- |
| email<mark style="color:red;">\*</mark> | String | the email of the user |

#### Request Body

| Name                                   | Type          | Description |
| -------------------------------------- | ------------- | ----------- |
| body<mark style="color:red;">\*</mark> | EmailTemplate |             |

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

{% endtab %}
{% endtabs %}

## Get Currently logged-in user session.

<mark style="color:blue;">`GET`</mark> `https://demo.icure.cloud/rest/v2/user/session`

Get current user.

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

{% endtab %}
{% endtabs %}

## Get presently logged-in user.

<mark style="color:blue;">`GET`</mark> `https://demo.icure.cloud/rest/v2/user/current`

Get current user.

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

{% endtab %}
{% endtabs %}

## Get presently logged-in user.

<mark style="color:blue;">`GET`</mark> `https://demo.icure.cloud/rest/v2/user/matches`

Get current user.

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

{% endtab %}
{% endtabs %}

## Require a new temporary token for authentication

<mark style="color:green;">`POST`</mark> `https://demo.icure.cloud/rest/v2/user/token/{userId}/{key}`

#### Path Parameters

| Name                                     | Type   | Description                                                                               |
| ---------------------------------------- | ------ | ----------------------------------------------------------------------------------------- |
| userId<mark style="color:red;">\*</mark> | String |                                                                                           |
| key<mark style="color:red;">\*</mark>    | String | The token key. Only one instance of a token with a defined key can exist at the same time |

#### Query Parameters

| Name          | Type | Description                   |
| ------------- | ---- | ----------------------------- |
| tokenValidity | Long | The token validity in seconds |

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

{% endtab %}
{% endtabs %}

## Get a user by his ID

<mark style="color:blue;">`GET`</mark> `https://demo.icure.cloud/rest/v2/user/{userId}`

General information about the user

#### Path Parameters

| Name                                     | Type   | Description |
| ---------------------------------------- | ------ | ----------- |
| userId<mark style="color:red;">\*</mark> | String |             |

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

{% endtab %}
{% endtabs %}

## Get a user by his Email/Login

<mark style="color:blue;">`GET`</mark> `https://demo.icure.cloud/rest/v2/user/byEmail/{email}`

General information about the user

#### Path Parameters

| Name                                    | Type   | Description |
| --------------------------------------- | ------ | ----------- |
| email<mark style="color:red;">\*</mark> | String |             |

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

{% endtab %}
{% endtabs %}

## List users with(out) pagination

<mark style="color:blue;">`GET`</mark> `https://demo.icure.cloud/rest/v2/user`

Returns a list of users.

#### Query Parameters

| Name            | Type    | Description         |
| --------------- | ------- | ------------------- |
| startKey        | String  | An user email       |
| startDocumentId | String  | An user document ID |
| limit           | Integer | Number of rows      |

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

{% endtab %}
{% endtabs %}

## List users with(out) pagination

<mark style="color:blue;">`GET`</mark> `https://demo.icure.cloud/rest/v2/user/inGroup/{groupId}`

Returns a list of users.

#### Path Parameters

| Name                                      | Type   | Description |
| ----------------------------------------- | ------ | ----------- |
| groupId<mark style="color:red;">\*</mark> | String |             |

#### Query Parameters

| Name            | Type    | Description         |
| --------------- | ------- | ------------------- |
| startKey        | String  | An user login       |
| startDocumentId | String  | An user document ID |
| limit           | Integer | Number of rows      |

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

{% endtab %}
{% endtabs %}

## Modify a User property

<mark style="color:orange;">`PUT`</mark> `https://demo.icure.cloud/rest/v2/user/{userId}/properties`

Modify a User properties based on his/her ID. The return value is the modified user.

#### Path Parameters

| Name                                     | Type   | Description |
| ---------------------------------------- | ------ | ----------- |
| userId<mark style="color:red;">\*</mark> | String |             |

#### Request Body

| Name | Type | Description |
| ---- | ---- | ----------- |
| body | List |             |

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

{% endtab %}
{% endtabs %}

## Modify a user.

<mark style="color:orange;">`PUT`</mark> `https://demo.icure.cloud/rest/v2/user`

No particular return value. It's just a message.

#### Request Body

| Name                                   | Type | Description |
| -------------------------------------- | ---- | ----------- |
| body<mark style="color:red;">\*</mark> | User |             |

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

{% endtab %}
{% endtabs %}

## Modify a user.

<mark style="color:orange;">`PUT`</mark> `https://demo.icure.cloud/rest/v2/user/inGroup/{groupId}`

No particular return value. It's just a message.

#### Path Parameters

| Name                                      | Type   | Description |
| ----------------------------------------- | ------ | ----------- |
| groupId<mark style="color:red;">\*</mark> | String |             |

#### Request Body

| Name                                   | Type | Description |
| -------------------------------------- | ---- | ----------- |
| body<mark style="color:red;">\*</mark> | User |             |

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

{% endtab %}
{% endtabs %}
