# createUser

## Overview

Creates a new user with the given name and email, activates the account, assigns roles, creates an IdP user with an auto-generated password. Returns the user details and initial password.

## Modules Commands Used

- [user-management] CreateUser
- [user-management] ActivateUser
- [user-management] AssignRoleToUser

## Exception Handling

| Error Code | Description |
| --- | --- |
| USER_MANAGEMENT_USER_ALREADY_EXISTS | A user with the same email already exists |
| USER_MANAGEMENT_MISSING_REQUIRED_FIELD | A required field (name or email) is missing |
| USER_MANAGEMENT_INVALID_EMAIL | The email address format is invalid |
| USER_MANAGEMENT_ROLE_NOT_FOUND | A specified role does not exist |
| USER_MANAGEMENT_USER_NOT_FOUND | The user was not found during role assignment |
| USER_MANAGEMENT_USER_NOT_ACTIVE | The user is not in active status for role assignment |
| INSUFFICIENT_PERMISSION | The caller does not have permission to perform this operation |
