Creating an IAM User
Function
This API is provided for the administrator to create an IAM user. An IAM user needs to change its password at the first login.
The API can be called using both the global endpoint and region-specific endpoints. For IAM endpoints, see Regions and Endpoints.
Restrictions
When you use this API to create an IAM user, you cannot specify a mobile number or email address for the IAM user. To specify a mobile number and email address, used the API described in Creating an IAM User (Recommended).
Debugging
You can debug this API in API Explorer.
URI
POST /v3/users
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
Content-Type |
Yes |
String |
Fill application/json;charset=utf8 in this field. |
X-Auth-Token |
Yes |
String |
Access token issued to a user to bear its identity and permissions. For details about the permissions required by the token, see Actions. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
Yes |
Object |
User information. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
IAM username, which consists of 1 to 64 characters. It can contain letters (case-sensitive), digits, spaces, hyphens (-), underscores (_), and periods (.), and cannot start with a digit or space. |
domain_id |
No |
String |
ID of the account used to create the IAM user. |
password |
No |
String |
Password of the user. The password must meet the following requirements:
|
enabled |
No |
Boolean |
Enabling status of the IAM user. true (default value) indicates that the user is enabled. false indicates that the user is disabled. |
description |
No |
String |
Description of the IAM user. |
Response Parameters
Parameter |
Type |
Description |
---|---|---|
Object |
IAM user information. |
Parameter |
Type |
Description |
---|---|---|
enabled |
Boolean |
Enabling status of the IAM user. true (default value) indicates that the user is enabled. false indicates that the user is disabled. |
id |
String |
IAM user ID. |
domain_id |
String |
ID of the account used to create the IAM user. |
name |
String |
IAM username. |
Object |
IAM user resource link information. |
|
pwd_status |
Boolean |
Password status. true indicates that the password needs to be changed, and false indicates that the password is normal. If no password is set, this parameter may not be returned. |
password_expires_at |
String |
Password expiration time. If this parameter is set to null, the password will never expire.
NOTE:
The value is a UTC time in the YYYY-MM-DDTHH:mm:ss.ssssss format, for example, 2023-06-28T08:56:33.710000. |
description |
String |
Description of the IAM user. |
Example Request
Request for an administrator to create an IAM user named IAMUser
POST https://iam.myhuaweicloud.com/v3/users
{ "user": { "name": "IAMUser", "domain_id": "d78cbac186b744899480f25bd02...", "enabled": true, "password": "IAMPassword@", "description": "IAMDescription" } }
Example Response
Status code: 201
The IAM user is created successfully.
{
"user": {
"description": "IAMDescription",
"name": "IAMUser",
"enabled": true,
"links": {
"self": "https://iam.myhuaweicloud.com/v3/users/076598a17b0010e21fdec003f3a2aa45"
},
"domain_id": "d78cbac186b744899480f25b...",
"id": "076598a17b0010e21fdec003f3a2a...",
"password_expires_at": null,
"domain_id": "54a636f5a39c4e13809489dbcaa8e6b0",
"pwd_status": false
}
}
Status Codes
Status Code |
Description |
---|---|
201 |
The IAM user is created successfully. |
400 |
Invalid parameters. |
401 |
Authentication failed. |
403 |
Access denied. |
404 |
The requested resource cannot be found. |
405 |
The method specified in the request is not allowed for the requested resource. |
409 |
A resource conflict occurs. |
413 |
The request entity is too large. |
500 |
Internal server error. |
503 |
Service unavailable. |
Error Codes
For details, see Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot