# User Management

## Get all users assigned to this tenant

<mark style="color:blue;">`GET`</mark> `https://env1.telm.ai/api/auth/auth/{tenant}/users`

#### Path Parameters

| Name                                     | Type   | Description    |
| ---------------------------------------- | ------ | -------------- |
| tenant<mark style="color:red;">\*</mark> | string | Name of Tenant |

#### Headers

| Name                                             | Type   | Description                                     |
| ------------------------------------------------ | ------ | ----------------------------------------------- |
| Content-type                                     | string | application/json                                |
| Authentication<mark style="color:red;">\*</mark> | string | Bearer \<access\_token from authentication api> |

{% tabs %}
{% tab title="200 List of users" %}

```
[
  {
    "email": "string",
    "first_name": "string",
    "id": "string",
    "last_name": "string",
    "role": "string"
  }
]
```

{% endtab %}
{% endtabs %}

## Get a user's details

<mark style="color:blue;">`GET`</mark> `https://env1.telm.ai/api/auth/auth/{tenant}/users/{user_email}`

#### Path Parameters

| Name                                          | Type   | Description    |
| --------------------------------------------- | ------ | -------------- |
| tenant<mark style="color:red;">\*</mark>      | string | Name of Tenant |
| user\_email<mark style="color:red;">\*</mark> | String | User email     |

#### Headers

| Name                                             | Type   | Description                                     |
| ------------------------------------------------ | ------ | ----------------------------------------------- |
| Content-type                                     | string | application/json                                |
| Authentication<mark style="color:red;">\*</mark> | string | Bearer \<access\_token from authentication api> |

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

```
{
    "email": "string",
    "first_name": "string",
    "id": "string",
    "last_name": "string",
    "role": "string"
 }
```

{% endtab %}
{% endtabs %}

## Create User

<mark style="color:green;">`POST`</mark> `https://env1.telm.ai/api/auth/auth/{tenant}/users`

#### Path Parameters

| Name                                     | Type   | Description    |
| ---------------------------------------- | ------ | -------------- |
| tenant<mark style="color:red;">\*</mark> | string | Name of Tenant |

#### Query Parameters

| Name                                          | Type   | Description                                                                                   |
| --------------------------------------------- | ------ | --------------------------------------------------------------------------------------------- |
| password                                      | string | Optional. If not provided, user will received an email to activate account and set a password |
| last\_name<mark style="color:red;">\*</mark>  | string | Last name                                                                                     |
| first\_name<mark style="color:red;">\*</mark> | string | First name                                                                                    |
| email<mark style="color:red;">\*</mark>       | string | Email of the new user                                                                         |
| role<mark style="color:red;">\*</mark>        | string | "admin" / "user"                                                                              |

#### Headers

| Name                                             | Type   | Description      |
| ------------------------------------------------ | ------ | ---------------- |
| Content-type                                     | string | application/json |
| Authentication<mark style="color:red;">\*</mark> | string | Bearer {token}   |

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

```
{    
    "message": "User was added successfully"
}
```

{% endtab %}
{% endtabs %}

## Update User details

<mark style="color:orange;">`PUT`</mark> `https://env1.telm.ai/api/auth/auth/<tenant>/user/<user_email>`

This endpoint allows you to update user details

#### Path Parameters

| Name                                          | Type   | Description                                   |
| --------------------------------------------- | ------ | --------------------------------------------- |
| user\_email<mark style="color:red;">\*</mark> | string | Email of user whose details are to be updated |
| tenant<mark style="color:red;">\*</mark>      | string | Name of tenant                                |

#### Query Parameters

| Name                                          | Type   | Description                                                                                            |
| --------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------ |
| last\_name<mark style="color:red;">\*</mark>  | string | Updated last name                                                                                      |
| role<mark style="color:red;">\*</mark>        | string | “admin” / “user” Currently mandatory. Even if there are no updates to this field, it must be provided. |
| first\_name<mark style="color:red;">\*</mark> | string | Updated first name                                                                                     |

#### Headers

| Name                                             | Type   | Description      |
| ------------------------------------------------ | ------ | ---------------- |
| Content-type                                     | string | application/json |
| Authentication<mark style="color:red;">\*</mark> | string | Bearer {token}   |

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

```
{    
    "message": "User was updated successfully"
}
```

{% endtab %}
{% endtabs %}

## Delete user

<mark style="color:red;">`DELETE`</mark> `https://env1.telm.ai/api/auth/auth/{tenant}/users/{user_email}`

#### Path Parameters

| Name                                          | Type   | Description    |
| --------------------------------------------- | ------ | -------------- |
| tenant<mark style="color:red;">\*</mark>      | string | Name of Tenant |
| user\_email<mark style="color:red;">\*</mark> | String | User email     |

#### Headers

| Name                                             | Type   | Description      |
| ------------------------------------------------ | ------ | ---------------- |
| Content-type                                     | string | application/json |
| Authentication<mark style="color:red;">\*</mark> | string | Bearer {token}   |

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

```
{
    "message":string
}
```

{% endtab %}
{% endtabs %}

## Assign user to tenant

<mark style="color:orange;">`PUT`</mark> `https://env1.telm.ai/api/auth/auth/{tenant}/users/{user_email}/assign`

#### Path Parameters

| Name                                          | Type   | Description    |
| --------------------------------------------- | ------ | -------------- |
| tenant<mark style="color:red;">\*</mark>      | string | Name of Tenant |
| user\_email<mark style="color:red;">\*</mark> | String | User email     |

#### Headers

| Name                                             | Type   | Description                                     |
| ------------------------------------------------ | ------ | ----------------------------------------------- |
| Content-type                                     | string | application/json                                |
| Authentication<mark style="color:red;">\*</mark> | string | Bearer \<access\_token from authentication api> |

#### Request Body

| Name                                   | Type   | Description            |
| -------------------------------------- | ------ | ---------------------- |
| role<mark style="color:red;">\*</mark> | String | Role "user" or "admin" |

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

```
{
    "message":string
}
```

{% endtab %}
{% endtabs %}

## Change Password for a specific user email

<mark style="color:orange;">`PUT`</mark> `https://env1.telm.ai/api/auth/auth/<tenant>/user/<user_email>/password`

#### Path Parameters

| Name                                          | Type   | Description                                      |
| --------------------------------------------- | ------ | ------------------------------------------------ |
| user\_email<mark style="color:red;">\*</mark> | string | Email of user whose password needs to be changed |
| tenant<mark style="color:red;">\*</mark>      | string | Name of tenant                                   |

#### Query Parameters

| Name                                           | Type   | Description      |
| ---------------------------------------------- | ------ | ---------------- |
| old-password<mark style="color:red;">\*</mark> | string | Current password |
| new-password<mark style="color:red;">\*</mark> | string | New password     |

#### Headers

| Name                                             | Type   | Description                                    |
| ------------------------------------------------ | ------ | ---------------------------------------------- |
| Content-type                                     | string | application/json                               |
| Authentication<mark style="color:red;">\*</mark> | string | Bearer \<access\_toke from Authentication API> |

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

```
{    
    "message": "User was updated successfully"}
```

{% endtab %}
{% endtabs %}

## Reset Password

<mark style="color:red;">`DELETE`</mark> `https://env1.telm.ai/api/auth/auth/<tenant>/user/<user_email>/password`

This api will trigger an email being sent to reset their password

#### Path Parameters

| Name                                          | Type   | Description                                    |
| --------------------------------------------- | ------ | ---------------------------------------------- |
| user\_email<mark style="color:red;">\*</mark> | string | Email of user whose password needs to be reset |
| tenant<mark style="color:red;">\*</mark>      | string | Name of tenant                                 |

#### Headers

| Name                                             | Type   | Description                                    |
| ------------------------------------------------ | ------ | ---------------------------------------------- |
| Content-type                                     | string | application/json                               |
| Authentication<mark style="color:red;">\*</mark> | string | Bearer \<access\_toke from Authentication API> |

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

```
{    
    "message": string
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: 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:

```
GET https://docs.telm.ai/telmai/admin-apis/update-user.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
