tencent cloud

Feedback

ListKeyDetail

Last updated: 2023-08-07 17:45:14

1. API Description

Domain name for API request: kms.tencentcloudapi.com.

Get the master key list details according to the specified Offset and Limit.

A maximum of 100 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: ListKeyDetail.
Version Yes String Common Params. The value used for this API: 2019-01-18.
Region No String Common Params. This parameter is not required for this API.
Offset No Integer This parameter has the same meaning of the Offset in an SQL query, indicating that this acquisition starts from the "No. Offset value" element of the array arranged in a certain order. The default value is 0.
Limit No Integer This parameter has the same meaning of the Limit in an SQL query, indicating that up to Limit value elements can be obtained in this request. The default value is 10 and the maximum value is 200.
Role No Integer Filters by creator role. 0 (default value): the CMK is created by the user; 1: the CMK is created automatically by an authorized Tencent Cloud service.
OrderType No Integer Sorts by CMK creation time. 0: descending; 1: ascending
KeyState No Integer Filters by CMK status. 0: all CMKs; 1: CMKs in Enabled status only; 2: CMKs in Disabled status only; 3: CMKs in PendingDelete status only (i.e., keys with schedule deletion enabled); 4: CMKs in PendingImport status only; 5: CMKs in Archived status only.
SearchKeyAlias No String Performs a fuzzy query by KeyId or Alias
Origin No String Filters by CMK type. "TENCENT_KMS" indicates to filter CMKs whose key materials are created by KMS; "EXTERNAL" indicates to filter CMKs of EXTERNAL type whose key materials are imported by users; "ALL" or empty indicates to filter CMKs of both types. This value is case-sensitive.
KeyUsage No String Filters by the KeyUsage field value. Valid values: ALL (all CMKs), ENCRYPT_DECRYPT (used when this field is left empty), ASYMMETRIC_DECRYPT_RSA_2048, ASYMMETRIC_DECRYPT_SM2, ASYMMETRIC_SIGN_VERIFY_SM2, ASYMMETRIC_SIGN_VERIFY_RSA_2048, and ASYMMETRIC_SIGN_VERIFY_ECC.
TagFilters.N No Array of TagFilter Tag filter condition
HsmClusterId No String ID of the HSM cluster. This field is only valid for Exclusive and Managed KMS instances.

3. Output Parameters

Parameter Name Type Description
TotalCount Integer Total number of CMKs
KeyMetadatas Array of KeyMetadata List of returned attribute information.
Note: this field may return null, indicating that no valid values can be obtained.
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Getting CMK list details

Input Example

https://kms.tencentcloudapi.com/?Action=ListKeyDetail
&Offset=0
&Limit=3
&Role=0
&<Common request parameters>

Output Example

{
    "Response": {
        "RequestId": "1b580852-1e38-11e9-b129-5cb9019b4b00",
        "KeyMetadatas": [
            {
                "KeyId": "23e80852-1e38-11e9-b129-5cb9019b4b01",
                "Alias": "myalias",
                "CreateTime": 1548210729,
                "Description": "test cmk",
                "KeyState": "Enabled",
                "KeyUsage": "ENCRYPT_DECRYPT",
                "Type": 1,
                "CreatorUin": 1001,
                "KeyRotationEnabled": true,
                "Owner": "user",
                "NextRotateTime": 1553151489,
                "DeletionDate": 0,
                "Origin": "TENCENT_KMS",
                "ValidTo": 0
            },
            {
                "KeyId": "23e80852-1e38-11e9-b129-5cb9019b4b02",
                "Alias": "testalias",
                "CreateTime": 1548210730,
                "Description": "test cmk",
                "KeyState": "Disabled",
                "KeyUsage": "ENCRYPT_DECRYPT",
                "Type": 1,
                "CreatorUin": 1001,
                "KeyRotationEnabled": true,
                "Owner": "user",
                "NextRotateTime": 1553151489,
                "DeletionDate": 0,
                "Origin": "TENCENT_KMS",
                "ValidTo": 0
            },
            {
                "KeyId": "23e80852-1e38-11e9-b129-5cb9019b4b03",
                "Alias": "testalias2",
                "CreateTime": 1548210730,
                "Description": "test cmk",
                "KeyState": "PendingDelete",
                "KeyUsage": "ENCRYPT_DECRYPT",
                "Type": 1,
                "CreatorUin": 1001,
                "KeyRotationEnabled": true,
                "Owner": "user",
                "NextRotateTime": 1553151489,
                "DeletionDate": 1560580015,
                "Origin": "TENCENT_KMS",
                "ValidTo": 0
            }
        ],
        "TotalCount": 100
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
InternalError Internal error.
InvalidParameter Invalid parameter.
InvalidParameterValue.InvalidHsmClusterId Invalid HSM cluster ID.
UnauthorizedOperation Unauthorized operation.