Updated on 2024-08-06 GMT+08:00

Querying the List of SSH Key Pairs (V2.1)

Function

This API is used to query the list of SSH key pairs.

URI

  • URI format

    GET /v2.1/{project_id}/os-keypairs

  • Parameter description
    Table 1 Parameter description

    Parameter

    Mandatory

    Type

    Description

    project_id

    Yes

    String

    Project ID

Requests

None

Responses

Table 2 Response parameters

Parameter

Mandatory

Type

Description

keypairs

Yes

Array of objects

SSH key pair information list. For details, see Table 3.

Table 3 keypairs field description

Parameter

Mandatory

Type

Description

keypair

Yes

Object

SSH key pair information, see Table 4.

Table 4 keypair field description

Parameter

Mandatory

Type

Description

fingerprint

Yes

String

Fingerprint information about an SSH key pair

name

Yes

String

Name of an SSH key pair

public_key

Yes

String

Public key information about an SSH key pair

is_key_protection

Yes

Boolean

Whether the private key of the SSH key pair is managed and protected.

Examples

  • Example request

    None

  • Example response
    {
     "keypairs": [{
       "keypair": {
        "fingerprint": "15:b0:f8:b3:f9:48:63:71:cf:7b:5b:38:6d:44:2d:4a",
        "name": "keypair-601a2305-4f25-41ed-89c6-2a966fc8027a",
        "public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQC+Eo/RZRngaGTkFs7I62ZjsIlO79KklKbMXi8F+KITD4bVQHHn+kV+4gRgkgCRbdoDqoGfpaDFs877DYX9n4z6FrAIZ4PES8TNKhatifpn9NdQYWA+IkU8CuvlEKGuFpKRi/k7JLos/gHi2hy7QUwgtRvcefvD/vgQZOVw/mGR9Q== Generated-by-Nova\n",
        "is_key_protection": true
       }
      }
     ]
    }

    or

    {
        "error_code": "KPS.XXXX",
        "error_msg": "XXXX"
    }

Status Codes

For details, see Status Codes.