# DescribeKeyPairs

## 1. API Description

This API is used to query SSH key pair list.

## 2. Input Parameters

The following request parameter list only provides API request parameters.

<table><thead><tr><th width="196.1069182389937">Parameter Name</th><th width="122">Required</th><th width="160">Type</th><th>Description</th></tr></thead><tbody><tr><td>keyIds</td><td>No</td><td>Array of String</td><td>Key pair ID list.</td></tr><tr><td>keyName</td><td>No</td><td>String</td><td>Key pair name.<br>Fuzzy search is supported.</td></tr><tr><td>pageNum</td><td>No</td><td>Integer</td><td><p>Number of pages returned.</p><p>Default value: 1.</p></td></tr><tr><td>pageSize</td><td>No</td><td>Integer</td><td><p>Number of items in the current page result.</p><p>Default value: 20;</p><p>Maximum value: 1000.</p></td></tr></tbody></table>

## 3. Output Parameters

<table><thead><tr><th width="208.33333333333331">Parameter Name</th><th width="183">Type</th><th>Description</th></tr></thead><tbody><tr><td>requestId</td><td>String</td><td>The unique request ID, which is returned for each request. RequestId is required for locating a problem.</td></tr><tr><td>totalCount</td><td>Integer</td><td>Number of key pairs meeting the filtering conditions.</td></tr><tr><td>dataSet</td><td>Array of <a href="../../../../compute/zvm/datastructure#keypair">KeyPair</a></td><td>Information on key pairs.</td></tr></tbody></table>

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**Query SSH key pair list without any parameters.**

```json
POST /api/v2/vm HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: DescribeKeyPairs
<Common Request Params>

Request:
{
}

Response:
{
  "requestId": "T6818FFFC-B917-4E46-8BEC-D8BBD8FA2AA5",
  "response": {
    "requestId": "T6818FFFC-B917-4E46-8BEC-D8BBD8FA2AA5",
    "dataSet": [
      {
        "keyId": "key-xxxxxxx",
        "keyName": "my-key",
        "keyDescription": "",
        "publicKey": "ssh-rsa xxxxxxxxxx exmaple-key",
        "createTime": "2023-01-01T08:00:00Z"
      }
    ],
    "totalCount": 1
  }
}
```

{% endtab %}
{% endtabs %}

## 5. Developer Resources

Zenlayer Cloud API 2.0 integrates [SDKs](https://docs.console.zenlayer.com/test/ci-develop-en/api-introduction/software-toolkit/sdk) to make it easier for you to call APIs. More programming languages will be supported.

## 6. Error Codes

No error codes related to the API business logic. For other error codes, see [Common Error Codes](https://docs.console.zenlayer.com/test/ci-develop-en/api-introduction/instruction/commonerrorcode).​
