Listing SSH Key Pairs
GET /v2.1/{project_id}/os-keypairs
Retrieve all SSH (or X.509) key pairs that belong to the authenticated project. Each item in the result is wrapped in a keypair object.
info
Source: list-keypairs
Request
Parameters
| Name | In | Type | Description |
|---|---|---|---|
| project_id | path | string | The UUID of the project (tenant). |
| user_id (Optional) | query | string | For administrators: list key pairs that belong to the specified user ID. New in version 2.10 |
| limit (Optional) | query | integer | Maximum number of items to return. Use with marker for pagination. New in version 2.35 |
| marker (Optional) | query | string | ID (name) of the last-seen item for pagination. New in version 2.35 |
Sample Request
Using curl
curl -ks \
-H 'Content-Type: application/json' \
-H 'X-Auth-Token: gAAAAA<...>' \
-H 'X-OpenStack-Nova-API-Version: 2.72' \
https://api.vietnix.cloud:8774/v2.1/os-keypairs
http request
GET https://api.vietnix.cloud:8774/v2.1/f5d834d636c642c7bfe8af86139c6f26/os-keypairs
Response
Response Body Fields
| Name | Type | Description |
|---|---|---|
| keypairs | array | Array of key pair wrapper objects. Each element contains a keypair object. |
| keypair | object | The key pair wrapper object. |
| keypair.name | string | Human-readable name of the key pair (unique per user). |
| keypair.public_key | string | The public key material. |
| keypair.fingerprint | string | MD5 fingerprint of the public key (colon-delimited hex). |
| keypair.type | string | The key type. Allowed: ssh or x509. New in version 2.2 |
| keypair.created_at | string | Timestamp when the key pair was created (ISO 8601). |
| keypairs_links (Optional) | array | Pagination or related links (present when pagination is used). New in version 2.35 |
Status Codes
Success
| Code | Reason |
|---|---|
| 200 - OK | Request succeeded. |
Error
| Code | Reason |
|---|---|
| 401 - Unauthorized | Authentication is required or failed. |
| 403 - Forbidden | Policy does not allow the current user to perform this action. |
Sample Response
{
"keypairs": [
{
"keypair": {
"name": "Docs Writter",
"public_key": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDAbqUDd3jvW3fA49sJWv5+iTQR8uPDCx3lt7Y6qcFT9 rumiaxolotl@gmail.com",
"fingerprint": "07:8a:eb:63:6a:4b:b4:fd:be:c9:77:c2:58:da:84:fb",
"created_at": "2025-09-03T09:50:28.194592"
}
}
]
}