Skip to main content
Version: 2.3.0

Create or Update Employee

Last updated: August 18, 2026 Updated by: VNPT eContract's team


Purpose​

Create a new employee or update an existing employee's information in the system, while automatically creating/updating the associated user account linked to that employee. This is the first step and must be performed before initializing a labor contract for the corresponding employee (see section 7.2).

  • Request URL: /api/employees/create-or-update
  • HTTP method: POST
  • HTTP content-type: application/json
  • Authorize: Bearer token
  • Parameters:
KeyTypeDescription
employeeCodestring[Required] Unique employee identifier (used to determine whether to create or update)
fullNamestring[Required] Employee's full name
dateOfBirthstring[Required] Date of birth (format: yyyy-MM-dd)
genderint[Required] Gender, per system category:
- 1: Male
- 2: Female
identityNumberstring[Required] National ID / Citizen ID number
emailstring[Required] Employee's email address
phoneNumberstring[Required] Phone number
socialInsuranceCodestringSocial insurance book number
statusint[Required] Employee status (1: Active)
workingPositionint[Required] Job position, per system category
contractTypeint[Required] Contract type (2: Fixed-term)
contractReportTypeintContract reporting type
contractSigningMethodint[Required] Contract signing method (1: Electronic labor contract)
jobTitlestring[Required] Job title
salarynumber[Required] Salary amount
salaryAllowancenumberSalary allowance
contractEffectiveDatestring[Required] Effective date of the employee's current contract (format: yyyy-MM-dd)
contractExpiredDatestringContract expiration date (format: yyyy-MM-dd; pass null if the contract has no fixed term)
contractNotestringContract note
userobject[Required] Login account information object
{
  "code": "string",                       // [Required] Linked login account code
  "username": "string",                   // [Required] Login username (usually an email)
  "name": "string",                       // [Required] Display name of the account
  "generateSelfSignedCertEnabled": boolean // Automatically generate a self-signed certificate (true/false)
}
note

The request body is an array, allowing multiple employees to be created/updated in a single call. If employeeCode already exists in the system, the corresponding record will be updated; otherwise, a new record will be created.

Sample Request​

[
{
"employeeCode": "NVC20260805062149",
"fullName": "Nguyen Van Cuong 2149",
"dateOfBirth": "1997-02-17",
"gender": 1,
"identityNumber": "909218625041",
"email": "nguyenvancuong20260805062149@example.com",
"phoneNumber": "091****109",
"socialInsuranceCode": "BH178591090921862504",
"status": 1,
"workingPosition": 1,
"contractType": 2,
"contractReportType": 1,
"contractSigningMethod": 1,
"jobTitle": "Business Specialist",
"salary": 20000000,
"salaryAllowance": 4,
"contractEffectiveDate": "2026-01-15",
"contractExpiredDate": null,
"contractNote": "Fixed-term labor contract created via API",
"user": {
"code": "NVC20260805062149",
"username": "nguyenvancuong20260805062149@example.com",
"name": "Nguyen Van Cuong 2149",
"generateSelfSignedCertEnabled": false
}
}
]

Sample Response — HTTP 200​

{
"data": [
{
"id": 1430,
"createdDate": "2026-08-05T13:21:52.8949042+07:00",
"userId": 70427,
"user": {
"id": 70427,
"createdDate": "2026-08-05T13:21:51.9310169+07:00",
"comId": 7354,
"code": "NVC20260805062149",
"username": "nguyenvancuong20260805062149@example.com",
"name": "Nguyen Van Cuong 2149",
"phone": "091****109",
"email": "nguyenvancuong20260805062149@example.com",
"identityVerificationStatus": {
"value": 0,
"description": "Not verified"
},
"identityVerifiedType": {
"value": 0,
"description": "Unknown"
},
"identityVerifiedSource": {
"value": 0,
"description": "Unknown"
},
"isValid": false,
"signConfirmationEnabled": true,
"isAccountLocked": false,
"accountId": "5cf86e5e-b873-48a5-9c6b-eb9c3384dcda",
"signMethod": {
"value": 2,
"description": "VNPT SmartCA"
},
"status": {
"value": 1,
"description": "Enabled"
},
"receiveOtpMethod": {
"value": 1,
"description": "Email"
},
"receiveNotificationMethod": {
"value": 0,
"description": "Email"
},
"usedMemory": 0,
"waitingChangeRequest": false,
"twoFactorEnabled": false
},
"employeeCode": "NVC20260805062149",
"fullName": "Nguyen Van Cuong 2149",
"dateOfBirth": "1997-02-17T00:00:00",
"gender": 1,
"identityNumber": "909218625041",
"email": "nguyenvancuong20260805062149@example.com",
"phoneNumber": "091****109",
"socialInsuranceCode": "BH178591090921862504",
"status": {
"value": 1,
"description": "Enabled"
},
"currentWorkingPosition": 1,
"currentJobTitle": "Business Specialist",
"currentSalary": 20000000,
"currentSalaryAllowance": 4,
"currentContractType": 2,
"currentReportType": 1,
"currentContractEffectiveDate": "2026-01-15T00:00:00",
"currentContractNote": "Fixed-term labor contract created via API",
"currentContractSigningMethod": {
"value": 1,
"description": "Electronic Labor Contract"
},
"syncStatus": {
"value": 1,
"description": "Not Synced"
},
"currentContractNumber": ""
}
],
"success": true,
"code": 0,
"messages": [
"Create 1 employee success, update 0 employee success."
]
}
info

Note: the messages field returned indicates the number of records successfully created/updated, e.g., "Create 1 employee success, update 0 employee success."

Response Parameters​

KeyTypeDescription
dataArray[object]List of employees successfully created/updated
successbooleanRequest processing status (true: Success, false: Failed)
codeintResponse status code
messagesArray[string]List of processing result messages from the system

Details of the data attributes:​

KeyTypeDescription
idintEmployee record ID in the system
createdDatestringRecord creation time (ISO 8601 format)
userIdintID of the linked user account
userobjectDetails of the linked login account (see below)
employeeCodestringUnique employee identifier
fullNamestringEmployee's full name
dateOfBirthstringDate of birth (ISO 8601 format)
genderintGender (1: Male, 2: Female)
identityNumberstringNational ID / Citizen ID number
emailstringEmployee's email address
phoneNumberstringPhone number
socialInsuranceCodestringSocial insurance number
statusobjectEmployee status
1: Enabled
-1: Disabled
currentWorkingPositionintCurrent job position
currentJobTitlestringJob title
currentSalarynumberCurrent salary
currentSalaryAllowancenumberSalary allowance
currentContractTypeintContract type
1: Indefinite-term Labor Contract
2: Fixed-term Labor Contract
currentReportTypeintContract reporting type
currentContractEffectiveDatestringContract effective date (ISO 8601 format)
currentContractNotestringContract note
currentContractSigningMethodobjectContract signing method
1: Electronic Labor Contract
2: Paper Labor Contract
syncStatusobjectSynchronization status
1: Not Synced
2: Synced
3: Failed
currentContractNumberstringCurrent contract number

Details of the user object in the response:​

KeyTypeDescription
idintUser account ID
createdDatestringAccount creation time (ISO 8601 format)
comIdintCompany/organization ID
codestringUser account code
usernamestringLogin username
namestringDisplay name of the user
phonestringPhone number
emailstringEmail address
identityVerificationStatusobjectIdentity verification status (0: Not verified)
identityVerifiedTypeobjectIdentity verification type
identityVerifiedSourceobjectIdentity verification source
isValidbooleanAccount validity status
signConfirmationEnabledbooleanEnable/disable sign confirmation
isAccountLockedbooleanAccount lock status
accountIdstringSystem account GUID
signMethodobjectSigning method (2: VNPT SmartCA)
statusobjectAccount status (1: Enabled)
receiveOtpMethodobjectOTP receiving method (1: Email)
receiveNotificationMethodobjectNotification receiving method (0: Email)
usedMemorynumberStorage capacity used
waitingChangeRequestbooleanWhether there is a pending change request awaiting approval
twoFactorEnabledbooleanEnable/disable two-factor authentication

Common Errors​

successcodemessagesMeaning
false400"Identity number already exists for another employee: 0123456XXXXX"This national ID / Citizen ID number is already used by another employee. Check the value or use a different one.
false0"The user already exists with a different username. Please check again in the User list"The employee code (User Code) already exists in the system, linked to a different username. Check the User list and update the User Code.
false0"Username example@email.com already exists in the company"This username/email already exists within the company. Use a different username.