User management API

IAM IAM

  • API Reference
    • Common request header and common response header
    • Data type
    • Error code
    • Feature Update Records
    • General Description
    • Introduction
    • Service domain
    • STS-Related Interfaces
  • API Reference_IAM
    • Common request header and common response header
    • Data type
    • Error code
    • General Description
    • Group management API
    • Introduction
    • Policy management API
    • Role Management Interfaces
    • Service domain
    • User management API
  • FAQs
    • Common Questions Overview
    • FAQs related to IAM users
    • FAQs related to product permissions
  • Function Release Records
  • Operation guide
    • Account Security Audit
    • Enterprise Account Integration
      • Federated Login Overview
      • IAM Role-based SSO
      • IAM User-based SSO
    • Group Management
    • Message Center
    • Permission Policies
      • ACL
      • Authorization
      • Managing IAM Policies
      • Permission Policy Overview
      • Policy Authentication Evaluation Logic
      • Strategy type
      • Tag-Based Authorization and Authentication
    • Role Management
      • Common scenarios
      • Create role
      • FAQs
      • Managing Roles
      • Overview
      • Related concepts
      • Using Roles
    • Settings
    • User
      • IAM User Operations
      • Two-Factor Authentication
      • User management
    • User Anomaly Behavior Analysis (Public Beta)
      • Risk Behavior Management
  • Operation records
    • Cloud Trail (Public Beta)
  • Product Announcement
    • Baidu Intelligent Cloud Enables Login Protection MFA Multi-Factor Authentication Notification for All Users
  • Product Description
    • Application scenarios
    • Concepts
    • Currently Supported Product Lines
    • Product functions
    • Product overview
    • System Restrictions
    • Enterprise Organization vs Identity and Access Management
  • Product pricing
    • Product pricing
  • Quick Start
    • Create groups and grant permissions
    • Creating IAM User Administrators
  • SDK
    • Go-SDK
      • Error handling
      • Group management API
      • Initialize SDK
      • Install the SDK Package
      • Overview
      • Policy management API
      • Role Management Interfaces
      • User management API
      • Version Change Records
    • Java-SDK
      • Error code
      • Group management API
      • Initialization
      • Install the SDK Package
      • Overview
      • Policy management API
      • Role Management Interfaces
      • User management API
      • Version Change Records
    • Python-SDK
      • Error code
      • Group management API
      • Initialization
      • Install the SDK Package
      • Overview
      • Policy management API
      • Role Management Interfaces
      • User management API
      • Version Change Records
  • Testing Knowledge Base SDK
  • Typical Practices
    • Baidu Intelligent Cloud Partner Guide to Creating IAM Users
    • User Management and Permission Assignment
All documents
menu
No results found, please re-enter

IAM IAM

  • API Reference
    • Common request header and common response header
    • Data type
    • Error code
    • Feature Update Records
    • General Description
    • Introduction
    • Service domain
    • STS-Related Interfaces
  • API Reference_IAM
    • Common request header and common response header
    • Data type
    • Error code
    • General Description
    • Group management API
    • Introduction
    • Policy management API
    • Role Management Interfaces
    • Service domain
    • User management API
  • FAQs
    • Common Questions Overview
    • FAQs related to IAM users
    • FAQs related to product permissions
  • Function Release Records
  • Operation guide
    • Account Security Audit
    • Enterprise Account Integration
      • Federated Login Overview
      • IAM Role-based SSO
      • IAM User-based SSO
    • Group Management
    • Message Center
    • Permission Policies
      • ACL
      • Authorization
      • Managing IAM Policies
      • Permission Policy Overview
      • Policy Authentication Evaluation Logic
      • Strategy type
      • Tag-Based Authorization and Authentication
    • Role Management
      • Common scenarios
      • Create role
      • FAQs
      • Managing Roles
      • Overview
      • Related concepts
      • Using Roles
    • Settings
    • User
      • IAM User Operations
      • Two-Factor Authentication
      • User management
    • User Anomaly Behavior Analysis (Public Beta)
      • Risk Behavior Management
  • Operation records
    • Cloud Trail (Public Beta)
  • Product Announcement
    • Baidu Intelligent Cloud Enables Login Protection MFA Multi-Factor Authentication Notification for All Users
  • Product Description
    • Application scenarios
    • Concepts
    • Currently Supported Product Lines
    • Product functions
    • Product overview
    • System Restrictions
    • Enterprise Organization vs Identity and Access Management
  • Product pricing
    • Product pricing
  • Quick Start
    • Create groups and grant permissions
    • Creating IAM User Administrators
  • SDK
    • Go-SDK
      • Error handling
      • Group management API
      • Initialize SDK
      • Install the SDK Package
      • Overview
      • Policy management API
      • Role Management Interfaces
      • User management API
      • Version Change Records
    • Java-SDK
      • Error code
      • Group management API
      • Initialization
      • Install the SDK Package
      • Overview
      • Policy management API
      • Role Management Interfaces
      • User management API
      • Version Change Records
    • Python-SDK
      • Error code
      • Group management API
      • Initialization
      • Install the SDK Package
      • Overview
      • Policy management API
      • Role Management Interfaces
      • User management API
      • Version Change Records
  • Testing Knowledge Base SDK
  • Typical Practices
    • Baidu Intelligent Cloud Partner Guide to Creating IAM Users
    • User Management and Permission Assignment
  • Document center
  • arrow
  • IAMIAM
  • arrow
  • SDK
  • arrow
  • Go-SDK
  • arrow
  • User management API
Table of contents on this page
  • Create User
  • Query user
  • Update user
  • List users
  • Delete user
  • Configure console login for the user
  • Query console login configuration
  • Disable console login configuration
  • Modify IAM user operation protection
  • Modify IAM User Password
  • Create user's AccessKey
  • Disable user's AccessKey
  • Enable user's AccessKey
  • Delete user's AccessKey
  • List user's AccessKeys
  • Query IAM user-based SSO information
  • Update user-based SSO status
  • Update IAM user-based SSO configuration
  • Delete IAM user-based SSO configuration

User management API

Updated at:2025-10-27

Create User

Create an IAM user using the provided codes.

Go
1    name := "test-user-sdk-go"
2    args := &api.CreateUserArgs{
3		Name:        name,
4        Description: "description",
5    }
6    
7    result, err := client.CreateUser(args)
8    if err != nil {
9        fmt.Println("Create iam user failed", err)
10    } else {
11        fmt.Println("Create iam user success", result)
12    }	

Prompt:

  • For detailed parameter configuration and constraints, refer to IAM API documentation CreateUser.

Query user

Retrieve an IAM user using the provided codes.

Go
1	name := "test-user-sdk-go"
2	result, err := client.GetUser(name)
3	if err != nil {
4		fmt.Println("Get iam user failed", err)
5	} else {
6		fmt.Println("Get iam user success", result)
7	}

Prompt:

  • For detailed parameter configuration and constraints, refer to IAM API documentation GetUser.

Update user

Update an IAM user using the provided codes.

Go
1    name := "test-user-sdk-go"
2	args := &api.UpdateUserArgs{
3		Description: "newDescription",
4	}
5	result, err := client.UpdateUser(name, args)
6	if err != nil {
7		fmt.Println("Update iam user failed", err)
8	} else {
9		fmt.Println("Update iam user success", result)
10	}

Prompt:

  • For detailed parameter configuration and constraints, refer to IAM API documentation UpdateUser.

List users

List IAM users using the provided codes.

Go
1	result, err := client.ListUser()
2	if err != nil {
3		fmt.Println("List iam user failed", err)
4	} else {
5		fmt.Println("List iam user success", result)
6	}

Prompt:

  • For detailed parameter configuration and constraints, refer to IAM API documentation ListUser.

Delete user

Update an IAM user using the provided codes.

Go
1	name := "test-user-sdk-go"
2	err = client.DeleteUser(name)
3	if err != nil {
4		fmt.Println("Delete iam user failed", err)
5	} else {
6		fmt.Println("Delete iam user success", name)
7	}

Prompt:

  • For detailed parameter configuration and constraints, refer to IAM API documentation DeleteUser.

Configure console login for the user

Set up console login for the user using the provided codes, including establishing a login password, enabling MFA for login, and setting up third-party account binding.

Go
1	name := "test-user-sdk-go-login-profile"
2	args := &api.UpdateUserLoginProfileArgs{
3		Password:        "1@3Qwe4f",
4		EnabledLoginMfa: false,
5		LoginMfaType:    "PHONE",
6	}
7	result, err := client.UpdateUserLoginProfile(name, args)
8	if err != nil {
9		fmt.Println("Update iam user login profile failed", err)
10	} else {
11		fmt.Println("Update iam user login profile success", result)
12	}

Prompt:

  • For detailed parameter configurations and constraints, please refer to the IAM API documentation Update User Login Profile .

Query console login configuration

Retrieve a user's console login settings using the provided codes.

Go
1	name := "test-user-sdk-go-login-profile"
2	result, err := client.GetUserLoginProfile(name)
3	if err != nil {
4		fmt.Println("Get iam user login profile failed", err)
5	} else {
6		fmt.Println("Get iam user login profile success", result)
7	}

Prompt:

  • For detailed parameter configurations and constraints, please refer to the IAM API documentation GetUserLoginProfile.

Disable console login configuration

Disable a user's console login configuration, effectively deactivating their console login access.

Go
1	name := "test-user-sdk-go-login-profile"
2	err = client.DeleteUserLoginProfile(name)
3	if err != nil {
4		fmt.Println("Delete iam user login profile failed", err)
5	} else {
6		fmt.Println("Delete iam user login profile success", name)
7	}

Prompt:

  • For detailed parameter configurations and constraints, please refer to the IAM API documentation DeleteUserLoginProfile.

Modify IAM user operation protection

Adjust the IAM user operation protections using the provided codes.

Go
1    userName := "test-user-sdk-go-switch-operation-mfa"
2    enableMfa := true
3    mfaType := "PHONE,TOTP"
4    args := &api.UserSwitchMfaArgs{
5        UserName:   userName,
6        EnabledMfa: enableMfa,
7        MfaType:    mfaType,
8    }
9    err := IAM_CLIENT.UserOperationMfaSwitch(args)
10    if err != nil {
11        fmt.Println("switch user mfa failed", err)
12    } else {
13        fmt.Println("switch user mfa success", result)
14    }

Prompt:

  • For detailed parameter configurations and constraints, please refer to the IAM API documentation Modify IAM User Operation Protection.

Modify IAM User Password

Change the IAM user password using the provided codes.

Go
1    userName := "test-user-name-sdk-go-sub-update"
2    Password := "Baidu@123"
3    args := &api.UpdateSubUserArgs{
4        Password: Password,
5    }
6    res, err := IAM_CLIENT.SubUserUpdate(userName, args)
7    if err != nil {
8        fmt.Println("update sub user failed", err)
9    } else {
10        fmt.Println("update sub user success", result)
11    }

Prompt:

  • For detailed parameter configuration and constraints, refer to the IAM API documentation Modify the IAM user Password.

Create user's AccessKey

Generate a set of AccessKeys for a user using the provided codes.

Go
1	name := "test-user-sdk-go-accessKey"
2	result, err := client.CreateAccessKey(name)
3	if err != nil {
4		fmt.Println("Create accessKey failed", err)
5	} else {
6		fmt.Println("Create accessKey success", result)
7	}

Prompt:

  • For detailed parameter configuration and constraints, refer to the IAM API documentationCreate User AccessKey.

Disable user's AccessKey

Deactivate a user's AccessKey using the provided codes.

Go
1	name := "test-user-sdk-go-accessKey"
2	accessKeyId := "<your-access-key-id>"
3	result, err := client.DisableAccessKey(name, accessKeyId)
4	if err != nil {
5		fmt.Println("Disable accessKey failed", err)
6	} else {
7		fmt.Println("Disable accessKey success", result)
8	}

Prompt:

  • For detailed parameter configuration and constraints, refer to the IAM API documentation Disable User’s AccessKey.

Enable user's AccessKey

Activate a user’s AccessKey using the provided codes.

Go
1	name := "test-user-sdk-go-accessKey"
2	accessKeyId := "<your-access-key-id>"
3	result, err := client.EnableAccessKey(name, accessKeyId)
4	if err != nil {
5		fmt.Println("Enable accessKey failed", err)
6	} else {
7		fmt.Println("Enable accessKey success", result)
8	}

Prompt:

  • For detailed parameter configuration and constraints, refer to the IAM API documentationEnable User’s AccessKey.

Delete user's AccessKey

Remove a specified set of AccessKeys for the user.

Go
1	name := "test-user-sdk-go-accessKey"
2	accessKeyId := "<your-access-key-id>"
3	err = client.DeleteAccessKey(name, accessKeyId)
4	if err != nil {
5		fmt.Println("Delete accessKey failed", err)
6	} else {
7		fmt.Println("Delete accessKey success", accessKeyId)
8	}

Prompt:

  • For detailed parameter configuration and constraints, refer to the IAM API documentationDelete User’s AccessKey.

List user's AccessKeys

Display all AccessKeys of a user.

Go
1	name := "test-user-sdk-go-accessKey"
2	result, err := client.ListAccessKey(name)
3	if err != nil {
4		fmt.Println("List accessKey failed", err)
5	} else {
6		fmt.Println("List accessKey success", result)
7	}

Prompt:

  • For detailed parameter configuration and constraints, refer to the IAM API documentation List User’s AccessKey.

Query IAM user-based SSO information

Retrieve IAM user-based SSO details, aligning with the content of the menu: Identity and Access Management - Enterprise Account Integration - IAM User-based SSO.

Go
1    result, err := client.GetSubUserIdpConfig()
2    if err != nil {
3		fmt.Println("Get subUser idp config failed", err)
4	} else {
5		fmt.Println("Get subUser idp config success", result)
6	}

Prompt:

  • For detailed parameter configurations and constraints, refer to the IAM API documentation Query User-based SSO Information.

Update user-based SSO status

Change the user-based SSO status.

Go
1    status := "disable"
2    result, err := client.UpdateSubUserIdpStatus(status)
3    if err != nil {
4		fmt.Println("Updte subUser idp config status failed", err)
5	} else {
6		fmt.Println("Updte subUser idp config status success", result)
7	}

Prompt:

  • For detailed parameter configurations and constraints, refer to the IAM API documentation Update IAM User-based SSO Function Status.

Update IAM user-based SSO configuration

Modify IAM user-based SSO settings.

Go
1    var request api.UpdateSubUserIdpRequest
2    
3    fileName := "ok.xml"
4    request.AuxiliaryDomain = "<your-auxiliary-domain>"
5    request.FileName = "<your-file-name>"
6    request..EncodeMetadata = "<your-encode-metadata>"
7    
8    result, err := client.UpdateSubUserIdp(&request)
9    if err != nil {
10		fmt.Println("Updte subUser idp config failed", err)
11	} else {
12		fmt.Println("Updte subUser idp config success", result)
13	}

Prompt:

  • For detailed parameter configurations and constraints, refer to the IAM API documentation Update IAM User-based SSO Function Configuration.

Delete IAM user-based SSO configuration

Remove IAM user-based SSO function settings.

Go
1    err := IAM_CLIENT.DeleteSubUserIdp()
2    if err != nil {
3		fmt.Println("Delete subUser idp config failed", err)
4	} else {
5		fmt.Println("Updte subUser idp config success")
6	}

Prompt:

  • For detailed parameter configurations and constraints, refer to the IAM API documentation Delete IAM User-based SSO Configuration.

Previous
Role Management Interfaces
Next
Version Change Records