Create User API
Overview
Creates a new corporate employee / user account and assigns them to a company, department, and employee band.
- Endpoint:
/api/users/create - Method:
POST - Access: Corporate Admin / Admin
Request Body Schema
| Field | Type | Required | Description |
|---|---|---|---|
email | String | Yes | Valid unique email address |
password | String | No | Password (Default: "Password123!") |
firstName | String | Yes | User first name |
lastName | String | No | User last name |
phone | String | No | Contact phone number |
companyId | String (UUID) | No | Assigned company ID |
departmentId | String (UUID) | No | Assigned department ID |
bandId | String (UUID) | No | Assigned Employee Band ID |
Request Body Example
{
"email": "vikram.singh@abbott.com",
"firstName": "Vikram",
"lastName": "Singh",
"phone": "+919876543210",
"companyId": "c478a846-993d-4c8d-bf8d-d77cb3370e01",
"departmentId": "d1234567-89ab-cdef-0123-456789abcdef",
"bandId": "b1234567-89ab-cdef-0123-456789abcdef"
}
Success Response (201 Created)
{
"success": true,
"message": "User created successfully",
"data": {
"id": "u9876543-21ba-fedc-3210-9876543210fe",
"email": "vikram.singh@abbott.com",
"firstName": "Vikram",
"lastName": "Singh",
"employeeBand": "Band 1",
"company": {
"id": "c478a846-993d-4c8d-bf8d-d77cb3370e01",
"name": "Abbott Healthcare"
},
"department": {
"id": "d1234567-89ab-cdef-0123-456789abcdef",
"name": "Marketing"
},
"band": {
"id": "b1234567-89ab-cdef-0123-456789abcdef",
"name": "Band 1",
"autoApprovalLimit": "7000.00"
}
}
}
Database Impact
- Table:
users(Usermodel) - Operations:
INSERTintouserswith hashed password.