Skip to main content
Version: 2.3.0

Create or update user

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


Purpose​

The function that creates new or updates existing information of one or multiple users within the system.

  • Request URL: /api/users/create-or-update
  • HTTP method: POST
  • HTTP content-type: application/json
  • Authorize: Bearer token
  • Parameter:
KeyTypeDescription
codestring[Required] Code of user
userNamestring[Required] Username of user
namestringFull Name of user
emailstringEmail of user
addressstringAddress of user
phonestringPhone number
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": 8072,
"createdDate": "2023-06-28T14:31:30.9534748",
"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": "e06d8b9c-6f49-4751-87d0-6367c524a6ce",
"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 0 user success, update 1 user success."
]
}

Response Body Description​

KeyTypeDescription
successbooleanResponse status (true: Success, false: Failure)
codeintResponse code from the system
messagesarrayList of processing result messages from the system (e.g., ["Create 0 user success, update 1 user success."])
dataarrayList of objects containing detailed information about the users who were newly created or updated (see user details)