You can call this operation to query one or more key pairs.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request Parameters

Parameter Type Required Example Description
Action String Yes DescribeKeyPairs

The operation that you want to perform. Set the value to DescribeKeyPairs.

RegionId String Yes cn-hangzhou

The region ID of the key pair. You can call the DescribeRegions operation to query the most recent region list.

KeyPairName String No *Finance*

The name of the key pair. The asterisk (*) symbol can be used as a wild card in regular expressions to query key pairs by fuzzy match. Sample patterns:

  • *SshKey: queries key pair names ending with SshKey, including the SshKey key pair.
  • SshKey*: queries key pair names starting with SshKey, including the SshKey key pair.
  • *SshKey*: queries key pair names that have SshKey in the middle, including the SshKey key pair.
  • SshKey: queries SshKey key pair by exact match.
KeyPairFingerPrint String No XXXXXXXXXX

The fingerprint of the key pair. The fingerprint uses the message-digest algorithm 5 (MD5) based on the public key fingerprint format defined in RFC 4716. For more information, see RFC 4716.

PageNumber Integer No 1

The number of the page to return. Pages start from page 1.

Default value: 1.

PageSize Integer No 10

The number of entries to return on each page. Maximum value: 50.

Default value: 10.

Tag.N.Key String No FinanceDept

The key of tag N of the key pair. Valid values of N: 1 to 20.

Tag.N.Value String No FinanceDept.Joshua

The value of tag N of the key pair. Valid values of N: 1 to 20.

ResourceGroupId String No rg-resourcegroupid1

The ID of the enterprise resource group to which the key pair belongs.

Response parameters

Parameter Type Example Description
RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

TotalCount Integer 1

The total number of key pairs.

PageNumber Integer 1

The page number of the returned page.

PageSize Integer 10

The number of entries returned per page.

KeyPairs Array

An array consisting of key pair data.

KeyPairName String FinanceJoshuaV27

The name of the key pair.

KeyPairFingerPrint String xxxxxxxxxx

The fingerprint of the key pair.

CreationTime String 2019-12-04T13:35:00Z

The time when the key pair was created.

ResourceGroupId String rg-resourcegroupid1

The ID of the resource group.

Tags Array

An array consisting of tag data.

TagKey String FinanceDept

The tag key of the key pair.

TagValue String FinanceDept.Joshua

The tag value of the key pair.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=DescribeKeyPairs
&RegionId=cn-qingdao
&KeyPairFingerPrint=xxxxxxxxxx
&KeyPairName=test
&PageNumber=1
&PageSize=20
&<Common request parameters>

Sample success responses

XML format

<DescribeKeyPairsResponse>
      <PageNumber>1</PageNumber>
      <PageSize>2</PageSize>
      <TotalCount>1</TotalCount>
      <KeyPairs>
            <KeyPair>
                  <CreationTime>2018-10-10T01:00Z</CreationTime>
                  <ResourceGroupId></ResourceGroupId>
                  <KeyPairName>test</KeyPairName>
                  <KeyPairFingerPrint>xxxxxxxxxx</KeyPairFingerPrint>
            </KeyPair>
      </KeyPairs>
      <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
</DescribeKeyPairsResponse>

JSON format

{
    "PageNumber": 1,
    "PageSize": 2,
    "TotalCount": 1,
    "KeyPairs": {
        "KeyPair": [{
            "CreationTime": "2018-10-10T01:00Z",
            "ResourceGroupId": "",
            "KeyPairName": "test",
            "KeyPairFingerPrint": "xxxxxxxxxx"
        }]
    },
    "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

Error code

For a list of error codes, visit the API Error Center.