Updated on 2025-10-16 GMT+08:00

Updating a User

Function

This API is used to modify a user.

Calling Method

For details, see Calling APIs.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, no identity policy-based permission required for calling this API.

URI

PUT /v1/csms/users/{user_id}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

user_id

Yes

String

User ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

It can be obtained by calling the IAM API. The token is the value of X-Subject-Token in the response header.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

user_name

No

String

Username, which is a unique identifier in an enterprise.

mobile

No

String

Mobile number, which is unique in an enterprise.

org_code

No

String

Organization code.

name

No

String

Name.

email

No

String

Email address.

employee_id

No

String

Employee ID.

first_name

No

String

Name.

middle_name

No

String

Middle name.

last_name

No

String

Last name.

pwd_must_modify

No

String

Whether the password must be changed upon first login. The default value is true.

attr_gender

No

String

Gender. The value can be unknown, male, or female.

attr_birthday

No

String

Date of birth, in yyyy-mm-dd format

attr_nick_name

No

String

Alias.

attr_identity_type

No

String

Certificate type. The value can be:

id_card: ID card

HongKong_Macau_Taiwan_residence_permit: Residence permit for Hong Kong, Macao, and Taiwan residents

mainland_travel_permit_for_HongKong_Macao: Chinese mainland travel permits for Hong Kong and Macao residents

mainland_travel_permit_for_Taiwan: Chinese mainland travel permits for Taiwan residents

chinese_passport: Chinese passport

*overseas_passport: Foreign passport

overseas_driver_license: Foreign driver license

**officer_id: Military ID card

foreigner_residence_permit: Residence permit for foreigners

other: others

attr_identity_number

No

String

Certificate number.

attr_area

No

String

Country or region code.

attr_city

No

String

City.

attr_manager_id

No

String

Immediate superior.

attr_user_type

No

String

Personnel type. The value can be regular (formal), intern (internship), dispatch (labor dispatch), or outsourcing (labor outsourcing).

attr_hire_date

No

String

Onboarding date, in yyyy-MM-dd format.

attr_work_place

No

String

Work location.

user_org_relation_list

No

Array of UserOrgRelationListOption objects

Relationships between users and organizations. The main organization information must be included if this parameter is set.

extension

No

String

Custom extended attribute.

Table 4 UserOrgRelationListOption

Parameter

Mandatory

Type

Description

orgCode

Yes

String

Organization code.

relationType

Yes

String

Ownership. A user can only belong to one organization and can be mounted to at most nine organizations.

The value can be 0 (mounting) or 1 (belonging).

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

user_id

String

User ID.

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error details.

Example Requests

Modify the username to zhangsan, mobile number to 12345678901, and email address to zhangsan@example.com.

{
  "user_name" : "zhangsan",
  "org_code" : "10000",
  "name" : "zhangsan",
  "mobile" : "12345678901",
  "email" : "zhangsan@example.com",
  "employee_id" : "123456789",
  "pwd_must_modify" : false,
  "first_name" : "F",
  "middle_name" : "M",
  "last_name" : "L",
  "attr_gender" : "male",
  "attr_birthday" : "1990-02-01",
  "attr_nick_name" : "zhangsan",
  "attr_identity_type" : "id_card",
  "attr_identity_number" : "123456789",
  "attr_area" : "CN",
  "attr_city" : "xxx",
  "attr_manager_id" : "123456789",
  "attr_user_type" : "regular",
  "attr_hire_date" : "2021-04-01",
  "attr_work_place" : "xxx",
  "user_org_relation_list" : [ {
    "orgCode" : "10000",
    "relationType" : 1
  }, {
    "orgCode" : "TestOrg1",
    "relationType" : 0
  }, {
    "orgCode" : "TestOrg2",
    "relationType" : 0
  } ],
  "extension" : {
    "age" : "18"
  }
}

Example Responses

Status code: 200

Request succeeded.

{
  "user_id" : "20210621095935811-5E16-6B3060..."
}

Status Codes

Status Code

Description

200

Request succeeded.

400

Request failed.

Error Codes

See Error Codes.