Updated on 2024-07-30 GMT+08:00

Querying Permanent Access Keys

Function

This API can be used by the administrator to query all permanent access key of an IAM user or used by an IAM user to query all of their own permanent access keys.

The API can be called using both the global endpoint and region-specific endpoints. For IAM endpoints, see Regions and Endpoints.

Debugging

You can debug this API in API Explorer.

URI

GET /v3.0/OS-CREDENTIAL/credentials

Table 1 Query parameters

Parameter

Mandatory

Type

Description

user_id

No

String

User ID.

Request Parameters

Table 2 Parameters in the request header

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Fill application/json;charset=utf8 in this field.

X-Auth-Token

Yes

String

If an IAM user is requesting to query their own permanent access keys, the user token (no special permission requirements) of the user is required.

If the administrator is requesting to query all permanent access keys of an IAM user, see Actions.

Response Parameters

Table 3 Parameters in the response body

Parameter

Type

Description

credentials

Array of objects

Authentication result.

Table 4 credentials

Parameter

Type

Description

user_id

String

IAM user ID.

access

String

AK.

status

String

Status of the access key.

Options:

  • active: Enabled
  • inactive: Disabled

create_time

String

Time when the access key was created.

NOTE:

The value is a UTC time in the YYYY-MM-DDTHH:mm:ss.ssssssZ format, for example, 2023-06-28T08:56:33.710000Z. For details about the date and timestamp formats, see ISO-8601.

description

String

Description of the access key.

Example Request

  • Request for an IAM user to query their own permanent access keys
    GET https://iam.myhuaweicloud.com/v3.0/OS-CREDENTIAL/credentials
  • Request for an administrator to query all permanent access keys of an IAM user (user ID: 07609fb9358010e21f7bc003751c...)
    GET https://iam.myhuaweicloud.com/v3.0/OS-CREDENTIAL/credentials?user_id=07609fb9358010e21f7bc0037....

Example Response

Status code: 200

The request is successful.

{
    "credentials": [
        {
            "access": "LOSZM4YRVLKOY9E8X...",
            "create_time": "2020-01-08T06:26:08.123059Z",
            "user_id": "07609fb9358010e21f7bc0037...",
            "description": "",
            "status": "active"
        },
        {
            "access": "P83EVBZJMXCYTMU...",
            "create_time": "2020-01-08T06:25:19.014028Z",
            "user_id": "07609fb9358010e21f7bc003751...",
            "description": "",
            "status": "active"
        }
    ]
}

Status Codes

Status Code

Description

200

The request is successful.

400

Invalid parameters.

401

Authentication failed.

403

Access denied.

404

The requested resource cannot be found.

500

Internal server error.

Error Codes

None