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
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.

Action String No DescribeKeyPairs

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

KeyPairFingerPrint String No XXXXXXXXXX

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

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 contain SshKey, including the SshKey key pair.
  • SshKey: queries SshKey by exact match.
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.

ResourceGroupId String No rg-resourcegroupid1

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

Tag.N.Key String No FinanceDept

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

Tag.N.Value String No FinanceDept.Joshua

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

Response parameters

Parameter Type Example Description
KeyPairs Array

The collection of key pairs.

KeyPair

The key pair.

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

The time when the key pair was created.

KeyPairFingerPrint String xxxxxxxxxx

The fingerprint of the key pair.

KeyPairName String FinanceJoshuaV27

The name of the key pair.

ResourceGroupId String rg-resourcegroupid1

The ID of the resource group.

Tags Array

The tags of the key pair.

Tag

The tag of the key pair.

TagKey String FinanceDept

The tag key of the key pair.

TagValue String FinanceDept.Joshua

The tag value of the key pair.

PageNumber Integer 1

The page number of the returned page.

PageSize Integer 10

The number of entries returned per page.

RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

TotalCount Integer 1

The total number of key pairs.

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>
                  <KeyPairName>test</KeyPairName>
                  <KeyPairFingerPrint>xxxxxxxxxx</KeyPairFingerPrint>
            </KeyPair>
      </KeyPairs>
      <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
</DescribeKeyPairsResponse>

JSON format

{
	"PageNumber":1,
	"TotalCount":1,
	"KeyPairs":{
		"KeyPair":[
			{
				"KeyPairFingerPrint":"xxxxxxxxxx",
				"KeyPairName":"test"
			}
		]
	},
	"PageSize":2,
	"RequestId":"473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

Error codes

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