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

# User

## Create a user and add it to the org

> \<ul>\<li>Roles Allowed: ADMIN\</li>\<li> Impersonated User Allowed: False \</li>\<li> Partner Allowed: True \</li>\<li> ask\_user\_to\_update\_password\_on\_login: Default value is False \</li>\<li> emailConfirmed: User's email will be considered to be confirmed \</li>\<li> Email to confirm email will not be sent \</li>\<li> Role of the user added will be Member \</li>\<li> Sometimes a user may be created without being added to the org and will have to be handled manually \</li>\</ul>

```json
{"openapi":"3.0.1","info":{"title":"OpenAPI definition","version":"v0"},"servers":[{"url":"https://apis.saleschat.pro"}],"security":[{"bearer-key":[]},{}],"components":{"securitySchemes":{"bearer-key":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"CreateUserReqDto":{"required":["email","first_name","last_name","password"],"type":"object","properties":{"email":{"maxLength":319,"minLength":0,"type":"string"},"password":{"maxLength":64,"minLength":8,"type":"string"},"ask_user_to_update_password_on_login":{"type":"boolean"},"first_name":{"maxLength":40,"minLength":0,"type":"string"},"last_name":{"maxLength":40,"minLength":0,"type":"string"}}},"CreateUserRespDto":{"type":"object","properties":{"user_id":{"type":"string"}}},"ErrorRespDto":{"type":"object","properties":{"error_code":{"type":"integer"},"error_message":{"type":"string"},"error_description":{"type":"string"},"payload":{"type":"object"}}}}},"paths":{"/v1/org/{orgId}/user":{"post":{"tags":["user-controller"],"summary":"Create a user and add it to the org","description":"<ul><li>Roles Allowed: ADMIN</li><li> Impersonated User Allowed: False </li><li> Partner Allowed: True </li><li> ask_user_to_update_password_on_login: Default value is False </li><li> emailConfirmed: User's email will be considered to be confirmed </li><li> Email to confirm email will not be sent </li><li> Role of the user added will be Member </li><li> Sometimes a user may be created without being added to the org and will have to be handled manually </li></ul>","operationId":"createUserAndAddToOrg","parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateUserReqDto"}}},"required":true},"responses":{"200":{"description":"User created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateUserRespDto"}}}},"401":{"description":"Unauthorized - Authentication is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorRespDto"}}}},"403":{"description":"Forbidden: Unauthorized access","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorRespDto"}}}},"422":{"description":"Required fields are missing or invalid values are provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorRespDto"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorRespDto"}}}}}}}}}
```

## Reset a users password

> \<ul>\<li>Roles Allowed: ADMIN\</li>\<li> Impersonated User Allowed: True \</li>\<li> Partner Allowed: True \</li>\<li> User will be required to reset the password on next login \</li>\</ul>

```json
{"openapi":"3.0.1","info":{"title":"OpenAPI definition","version":"v0"},"servers":[{"url":"https://apis.saleschat.pro"}],"security":[{"bearer-key":[]},{}],"components":{"securitySchemes":{"bearer-key":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"UserPasswordReqDto":{"required":["password"],"type":"object","properties":{"password":{"type":"string"},"ask_user_to_update_password_on_login":{"type":"boolean"}}},"ErrorRespDto":{"type":"object","properties":{"error_code":{"type":"integer"},"error_message":{"type":"string"},"error_description":{"type":"string"},"payload":{"type":"object"}}}}},"paths":{"/v1/org/{orgId}/user/{userId}/password/reset":{"post":{"tags":["user-controller"],"summary":"Reset a users password","description":"<ul><li>Roles Allowed: ADMIN</li><li> Impersonated User Allowed: True </li><li> Partner Allowed: True </li><li> User will be required to reset the password on next login </li></ul>","operationId":"resetPassword","parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"}},{"name":"userId","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserPasswordReqDto"}}},"required":true},"responses":{"204":{"description":"Successfully reset"},"401":{"description":"Unauthorized - Authentication is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorRespDto"}}}},"403":{"description":"Forbidden - You don't have permission to access this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorRespDto"}}}},"404":{"description":"UserId does not exist for this org","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorRespDto"}}}},"422":{"description":"Required fields are missing or invalid values are provided","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorRespDto"}}}},"500":{"description":"Internal Server Error - Something went wrong on the server","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorRespDto"}}}}}}}}}
```

## Generate a magic link for a user

> \<ul>\<li>Roles Allowed: ADMIN\</li>\<li> Impersonated User Allowed: False \</li>\<li> Partner Allowed: True \</li>\</ul>

```json
{"openapi":"3.0.1","info":{"title":"OpenAPI definition","version":"v0"},"servers":[{"url":"https://apis.saleschat.pro"}],"security":[{"bearer-key":[]},{}],"components":{"securitySchemes":{"bearer-key":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"MagicLinkRespDto":{"type":"object","properties":{"url":{"type":"string"}}},"ErrorRespDto":{"type":"object","properties":{"error_code":{"type":"integer"},"error_message":{"type":"string"},"error_description":{"type":"string"},"payload":{"type":"object"}}}}},"paths":{"/v1/org/{orgId}/user/{userId}/magiclink":{"get":{"tags":["user-controller"],"summary":"Generate a magic link for a user","description":"<ul><li>Roles Allowed: ADMIN</li><li> Impersonated User Allowed: False </li><li> Partner Allowed: True </li></ul>","operationId":"generateMagicLink","parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"}},{"name":"userId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successfully generated magic link","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MagicLinkRespDto"}}}},"401":{"description":"Unauthorized - Authentication is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorRespDto"}}}},"403":{"description":"Forbidden - You don't have permission to access this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorRespDto"}}}},"404":{"description":"UserId does not exist for this org or user has been deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorRespDto"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorRespDto"}}}}}}}}}
```

## Get user by email

> \<ul>\<li>Roles Allowed: MEMBER\</li>\<li> Impersonated User Allowed: True \</li>\<li> Partner Allowed: True \</li>\<li> Supports Partial match on email ID\</li>\</ul>

```json
{"openapi":"3.0.1","info":{"title":"OpenAPI definition","version":"v0"},"servers":[{"url":"https://apis.saleschat.pro"}],"security":[{"bearer-key":[]},{}],"components":{"securitySchemes":{"bearer-key":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"PaginatedItemGetUserRespDto":{"type":"object","properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/GetUserRespDto"}},"has_more":{"type":"boolean"}}},"GetUserRespDto":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"first_name":{"type":"string"},"last_name":{"type":"string"}}},"ErrorRespDto":{"type":"object","properties":{"error_code":{"type":"integer"},"error_message":{"type":"string"},"error_description":{"type":"string"},"payload":{"type":"object"}}}}},"paths":{"/v1/org/{orgId}/user":{"get":{"tags":["user-controller"],"summary":"Get user by email","description":"<ul><li>Roles Allowed: MEMBER</li><li> Impersonated User Allowed: True </li><li> Partner Allowed: True </li><li> Supports Partial match on email ID</li></ul>","operationId":"getUserListByEmail","parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"}},{"name":"q","in":"query","required":true,"schema":{"type":"string","default":""}},{"name":"offset","in":"query","required":false,"schema":{"minimum":0,"type":"integer","format":"int32","default":0}},{"name":"size","in":"query","required":false,"schema":{"minimum":0,"type":"integer","format":"int32","default":10}}],"responses":{"200":{"description":"Successfully fetched user for email ID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedItemGetUserRespDto"}}}},"401":{"description":"Unauthorized - Authentication is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorRespDto"}}}},"403":{"description":"Forbidden - You don't have permission to access this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorRespDto"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorRespDto"}}}}}}}}}
```

## Delete a user

> \<ul>\<li>Roles Allowed: ADMIN\</li>\<li> Impersonated User Allowed: False \</li>\<li>Partner Allowed: True\</li>\</ul>

```json
{"openapi":"3.0.1","info":{"title":"OpenAPI definition","version":"v0"},"servers":[{"url":"https://apis.saleschat.pro"}],"security":[{"bearer-key":[]},{}],"components":{"securitySchemes":{"bearer-key":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"ErrorRespDto":{"type":"object","properties":{"error_code":{"type":"integer"},"error_message":{"type":"string"},"error_description":{"type":"string"},"payload":{"type":"object"}}}}},"paths":{"/v1/org/{orgId}/user/{userId}/delete":{"post":{"tags":["user-controller"],"summary":"Delete a user","description":"<ul><li>Roles Allowed: ADMIN</li><li> Impersonated User Allowed: False </li><li>Partner Allowed: True</li></ul>","operationId":"deleteUser","parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"}},{"name":"userId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Successfully deleted"},"401":{"description":"Unauthorized - Authentication is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorRespDto"}}}},"403":{"description":"Forbidden - You don't have permission to access this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorRespDto"}}}},"404":{"description":"User Id does not exist","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorRespDto"}}}},"500":{"description":"Internal Server Error - Something went wrong on the server","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorRespDto"}}}}}}}}}
```

## Disable a user

> \<ul>\<li>Roles Allowed: ADMIN\</li>\<li> Impersonated User Allowed: False \</li>\<li>Partner Allowed: True\</li>\</ul>

```json
{"openapi":"3.0.1","info":{"title":"OpenAPI definition","version":"v0"},"servers":[{"url":"https://apis.saleschat.pro"}],"security":[{"bearer-key":[]},{}],"components":{"securitySchemes":{"bearer-key":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"ErrorRespDto":{"type":"object","properties":{"error_code":{"type":"integer"},"error_message":{"type":"string"},"error_description":{"type":"string"},"payload":{"type":"object"}}}}},"paths":{"/v1/org/{orgId}/user/{userId}/disable":{"post":{"tags":["user-controller"],"summary":"Disable a user","description":"<ul><li>Roles Allowed: ADMIN</li><li> Impersonated User Allowed: False </li><li>Partner Allowed: True</li></ul>","operationId":"disableUser","parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"}},{"name":"userId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Successfully disabled"},"401":{"description":"Unauthorized - Authentication is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorRespDto"}}}},"403":{"description":"Forbidden - You don't have permission to access this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorRespDto"}}}},"404":{"description":"userId does not exist for this org","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorRespDto"}}}},"500":{"description":"Internal Server Error - Something went wrong on the server","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorRespDto"}}}}}}}}}
```

## Enable a user

> \<ul>\<li>Roles Allowed: ADMIN\</li>\<li> Impersonated User Allowed: False \</li>\<li>Partner Allowed: True\</li>\</ul>

```json
{"openapi":"3.0.1","info":{"title":"OpenAPI definition","version":"v0"},"servers":[{"url":"https://apis.saleschat.pro"}],"security":[{"bearer-key":[]},{}],"components":{"securitySchemes":{"bearer-key":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"ErrorRespDto":{"type":"object","properties":{"error_code":{"type":"integer"},"error_message":{"type":"string"},"error_description":{"type":"string"},"payload":{"type":"object"}}}}},"paths":{"/v1/org/{orgId}/user/{userId}/enable":{"post":{"tags":["user-controller"],"summary":"Enable a user","description":"<ul><li>Roles Allowed: ADMIN</li><li> Impersonated User Allowed: False </li><li>Partner Allowed: True</li></ul>","operationId":"enableUser","parameters":[{"name":"orgId","in":"path","required":true,"schema":{"type":"string"}},{"name":"userId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Successfully enabled"},"401":{"description":"Unauthorized - Authentication is required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorRespDto"}}}},"403":{"description":"Forbidden - You don't have permission to access this resource","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorRespDto"}}}},"404":{"description":"userId does not exist for this org","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorRespDto"}}}},"500":{"description":"Internal Server Error - Something went wrong on the server","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorRespDto"}}}}}}}}}
```
