Group 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
  • Python-SDK
  • arrow
  • Group management API
Table of contents on this page
  • Create group
  • Query group
  • Update group
  • Delete group
  • List groups
  • Add user to group
  • Remove user from group
  • List the group to which a user belongs
  • List users within a group

Group management API

Updated at:2025-10-27

Create group

Create a group with reference to the following codes:

Python
1def create_group():
2    iam_client = IamClient(iam_sample_conf.config)
3    
4# Group creation request as dict
5# Set group name
6# Set group description
7    create_group_request = {"name": "test_group", "description": "create test_group"}
8    response = iam_client.create_group(create_group_request)
9    print(response)

Query group

Query a group with reference to the following codes:

Python
1def get_group():
2    iam_client = IamClient(iam_sample_conf.config)
3    
4# Group name
5    group_name = b"test_group"
6    response = iam_client.get_group(group_name)
7    print(response)

Update group

Update a group with reference to the following codes:

Python
1def update_group():
2    iam_client = IamClient(iam_sample_conf.config)
3# Current group name
4    group_name = b"test_group"
5    
6# Group update request as dict
7# Set new group name
8# Set group description
9    update_group_request = {"name": "test_group_new", "description": "update test_group"}
10    response = iam_client.update_group(group_name, update_group_request)
11    print(response)

Delete group

Delete a group with reference to the following codes:

Python
1def delete_group():
2    iam_client = IamClient(iam_sample_conf.config)
3    
4# Current group name
5    group_name = b"test_group"
6    response = iam_client.delete_group(group_name)
7    print(response)

List groups

List groups with reference to the following codes:

Python
1def list_group():
2    iam_client = IamClient(iam_sample_conf.config)
3    response = iam_client.list_group()
4    print(response)

Add user to group

Add a user to a group with reference to the following codes:

Python
1def add_user_to_group():
2    iam_client = IamClient(iam_sample_conf.config)
3    
4# Group name
5    group_name = b"test_group"
6# User to be added to group
7    user_name = b"test_user"
8    response = iam_client.add_user_to_group(group_name, user_name)
9    print(response)

Remove user from group

Remove a user from a group with reference to the following codes:

Python
1def remove_user_from_group():
2    iam_client = IamClient(iam_sample_conf.config)
3    
4# Group name
5    group_name = b"test_group"
6    
7# User to be removed from group
8    user_name = b"test_user"
9    response = iam_client.remove_user_from_group(group_name, user_name)
10    print(response)

List the group to which a user belongs

List groups to which the users belong with reference to the following codes:

Python
1def list_user_group():
2    iam_client = IamClient(iam_sample_conf.config)
3# Username
4    user_name = b"test_user"
5    response = iam_client.list_user_group(user_name)
6    print(response)

List users within a group

List users within a group with reference to the following codes:

Python
1def list_group_user():
2    iam_client = IamClient(iam_sample_conf.config)
3    group_name = b"test_group"
4    response = iam_client.list_group_user(group_name)
5    print(response)

Previous
Error code
Next
Initialization