> For the complete documentation index, see [llms.txt](https://docs.console.zenlayer.com/api-reference/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.console.zenlayer.com/api-reference/security/ccs/key-pair/describekeypairs.md).

# DescribeKeyPairs

## 1. API Description

This API (DescribeKeyPairs) is used to queries the SSH key pairs in the account. You can filter results by key pair ID or name, and paginate results using page-size and page-num.

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name | Required | Type            | Description                                                                                            |
| -------------- | -------- | --------------- | ------------------------------------------------------------------------------------------------------ |
| keyIds         | No       | Array of String | Key pair ID list.                                                                                      |
| keyName        | No       | String          | <p>Key pair name.</p><p>Fuzzy search is supported.</p>                                                 |
| pageSize       | No       | Integer         | <p>Number of items in the current page result.</p><p>Default value: 20;</p><p>Maximum value: 1000.</p> |
| pageNum        | No       | Integer         | <p>Number of pages returned.</p><p>Default value: 1</p>                                                |

## 3. Output Parameters

| Parameter Name | Type                                                                     | Description                                                                                                           |
| -------------- | ------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------- |
| requestId      | String                                                                   | <p>The unique request ID, which is returned for each request.</p><p>RequestId is required for locating a problem.</p> |
| totalCount     | Integer                                                                  | Number of key pairs meeting the filtering conditions.                                                                 |
| dataSet        | Array of [KeyPair](/api-reference/security/ccs/datastructure.md#keypair) | Information on key pairs.                                                                                             |

## 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](/api-reference/api-introduction/toolkit/api-sdk.md)，to make it easier for you to call APIs. More programming languages will be supported.

## 6. Error Codes

The following only lists the error codes related to the API business logic. For other error codes, see [Common Error Codes](/api-reference/api-introduction/instruction/commonerrorcode.md).

| HTTP Status Code | Error Code | Description |
| ---------------- | ---------- | ----------- |
