Skip to main content
Version: 2.3.0

Create user

Updated date: 18/09/2026
Updated by: VNPT eContract's team


Purpose​

Function to create new user information and login account for the system.

  • Request URL: /api/users/create
  • HTTP method: POST
  • HTTP content-type: application/json
  • Authorize: Bearer token
  • Parameter:
KeyTypeDescription
codestring[Required] Code of user
usernamestring[Required] Username of user
namestring[Required] Full Name of user
emailstring[Required] Email of user
phonestring[Required] Phone number
addressstringAddress of user
groupIdsArray[int]Array of group user Ids
departmentIdsArray[int]Array of department Ids
roleIdsArray[Guild]Array of role Ids
titleIdsArray[int]Array of title Ids
taxcodestringTax code of user
addressstringAddress of user
faxstringFax number of user
descriptionstringDescription
signatureTextstringDefault signature text
signConfirmationEnabledbooleanSign, approve using two-factor authentication
generateSelfSignedCertEnabledbooleanGenerate Self-signed certificate
statusintStatus of user
1: Enabled
-1: Disabled
receiveOtpMethodintReceive OTP method
1: Email
2: SMS
-1: None
receiveNotificationMethodintReceive document notification method
0: Email
1: SMS
-1: None
signMethodintSign method
2: VNPT Smart CA
3: Sign Token
receiveInfoAccountMethodintReceive account information
0: Email
1: SMS
-1: None
caution
  • When creating a new user, all required fields must be provided, including roleIds and departmentIds.
  • For subsequent update calls, a partial payload can be sent (only the fields that need to be updated).
  • Fields that are not included in the request will retain their current values (will not be set to null).

Sample request​

{
"code": "USER01",
"username": "your_username",
"name": "Nguyen Van A",
"email": "email_address",
"address": "user_address",
"phone": "0919XXXXXX",
"taxcode": "1234567890",
"address": "District 3, Ho Chi Minh City",
"fax": "123",
"description": "",
"signatureText": "",
"signConfirmationEnabled": true,
"generateSelfSignedCertEnabled": false,
"status": 1,
"receiveOtpMethod": 1,
"receiveNotificationMethod": 0,
"signMethod": 2,
"groupIds": [1],
"departmentIds": [1],
"roleIds": ["30933485-7f71-46af-71a3-08def1dc25d3"],
"titleIds": [1]
}

Sample response body​

{
"data": {
"id": 4401,
"createdDate": "2022-12-13T14:55:32.2867265+07:00",
"comId": 164,
"code": "USER01",
"name": "Nguyen Van A",
"phone": "0919XXXXXX",
"taxcode": "1234567890",
"email": "email_address",
"address": "user_address",
"identityVerificationStatus": {
"value": 0,
"description": "Not verified"
},
"identityVerifiedType": {
"value": 0,
"description": "Unknown"
},
"identityVerifiedSource": {
"value": 0,
"description": "Unknown"
},
"isValid": false,
"signConfirmationEnabled": true,
"isAccountLocked": false,
"accountId": "75d5d881-9a88-40ea-9eca-5e370a087e3a",
"signatureText": "",
"roles": [
{
"id": "30933485-7f71-46af-71a3-08def1dc25d3",
"code": "Default",
"name": "Default",
"description": "Default role with document processing permissions",
"roleLevel": 0
}
],
"departments": [
{
"id": 1,
"name": "Human Resources",
"code": "HR"
}
],
"groups": [
{
"id": 1,
"code": "USER_GRP",
"name": "User Group"
}
],
"signMethod": {
"value": 2,
"description": "VNPT Smart CA"
},
"status": {
"value": 1,
"description": "Enabled"
},
"receiveOtpMethod": {
"value": 1,
"description": "Email"
},
"receiveNotificationMethod": {
"value": 0,
"description": "Email"
},
"personalCertificateId": 5111,
"userCertificates": [],
"smartCaGroups": [],
"waitingChangeRequest": false,
"twoFactorEnabled": false,
"titles": [
{
"id": 1,
"code": "KTT",
"name": "Chief Accountant",
"description": "Chief Accountant"
}
],
"allowedCertificateUids": []
},
"success": true,
"code": 0,
"messages": [
"Create user success"
]
}

Response Body Description​

KeyTypeDescription
successbooleanResponse status (true: Success, false: Failure)
codeintResponse code from the system
messagesarrayList of messages returned by the system (e.g., ["Create user success"])
dataobjectObject containing detailed information about the successfully created user (see user details)

Common Errors​

MessageDescription
Username 'username' is already takenThe username already exists in the system
User code 'usercode' already exists in the companyThe user code already exists in the system