Creating a Permanent Access Key
Function
This API can be used by the administrator to create a permanent access key for an IAM user or used by an IAM user to create a permanent access key.
Access keys are identity credentials for using development tools (APIs, CLI, and SDKs) to access HUAWEI CLOUD. Access keys cannot be used to log in to the console. AK is used in conjunction with an SK to sign requests cryptographically, ensuring that the requests are secret, complete, and correct. For details about how to create an access key on the console, see Access Keys.
The API can be called using both the global endpoint and region-specific endpoints. For IAM endpoints, see Regions and Endpoints.
URI
POST /v3.0/OS-CREDENTIAL/credentials
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
Content-Type |
Yes |
String |
Fill application/json;charset=utf8 in this field. |
|
X-Auth-Token |
Yes |
String |
A token with Security Administrator permissions is required if the administrator is requesting to create a permanent access key for an IAM user. If an IAM user is requesting to create a permanent access key, the user token (no special permission requirements) of the user is required. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
Yes |
Object |
Authentication information. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
user_id |
Yes |
String |
ID of the IAM user who is requesting to create an access key. For details about how to obtain the user ID, see Obtaining Account, IAM User, Group, Project, Region, and Agency Information. |
|
description |
No |
String |
Description of the access key. |
Response Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
Object |
Authentication result. |
Example Request
POST https://iam.myhuaweicloud.com/v3.0/OS-CREDENTIAL/credentials
{
"credential": {
"description": "IAMDescription",
"user_id": "07609fb9358010e21f7bc003751c7c32"
}
}
Example Response
Status code: 201
The permanent access key is created successfully.
{
"credential": {
"access": "P83EVBZJMXCYTMUII...",
"create_time": "2020-01-08T06:25:19.014028Z",
"user_id": "07609fb9358010e21f7bc003751...",
"description": "IAMDescription",
"secret": "TTqAHPbhWorg9ozx8Dv9MUyzYnOKDppxzHt...",
"status": "active"
}
}
Status code: 400
Invalid parameters. (The number of access keys has reached the maximum allowed limit.)
{
"error": {
"message": "akSkNumExceed",
"code": 400,
"title": "Bad Request"
}
}
Status Codes
|
Status Code |
Description |
|---|---|
|
201 |
The permanent access key is created successfully. |
|
400 |
Invalid parameters, or the number of access keys has reached the maximum allowed limit. |
|
401 |
Authentication failed. |
|
403 |
Access denied. |
|
500 |
Internal server error. |
Error Codes
None
Last Article: Obtaining a Temporary Access Key and SecurityToken Through a Token
Next Article: Querying Permanent Access Keys
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.