Listing SSH keys

GET /os-keypairs

List key pairs that are associated with the account.

Source: https://docs.openstack.org/api-ref/compute/index.html?expanded=list-keypairs-detail#list-keypairs

Request

Parameters

Name In Type Description
user_id (Optional) query string

This allows administrative users to operate key pairs of specified user ID.

New in version 2.10

limit (Optional) query integer

Requests a page size of items. Returns a number of items up to a limit value. Use the limit parameter to make an initial limited request and use the last-seen item from the response as the marker parameter value in a subsequent limited request.

New in version 2.35

marker (Optional) query string

The last seen item. Use the limit parameter to make an initial limited request and use the last seen item from the response as the marker parameter value in a subsequent limited request.

New in version 2.35

Example

# curl -ks -H 'Content-Type: application/json' -H 'X-Auth-Token: gAAAAA<...>' \
-H 'X-OpenStack-Nova-API-Version: 2.72' \
https://<node_IP_addr>:8774/v2.1/f5d834d636c642c7bfe8af86139c6f26/os-keypairs

Response

Parameters

Name In Type Description
keypairs body array Array of keypair objects
keypair body object The keypair object.
created_at body string

The date and time when the resource was created.

The date and time stamp format is ISO 8601:

CCYY-MM-DDThh:mm:ss±hh:mm

For example, 2015-08-27T09:49:58-05:00.

The ±hh:mm value, if included, is the time zone as an offset from UTC. In this example, the offset value is -05:00.

name body string A name for the key pair which will be used to reference it later.
public_key body string The key pair public key.
fingerprint body string The fingerprint for the key pair.
type body string

The type of the key pair. Allowed values are ssh or x509.

New in version 2.2

keypairs_links (Optional) body array

Links pertaining to key pair. See API Guide / Links and References for more info.

New in version 2.35

Status codes

Success

Code Reason
200 - OK Request was successful.

Error

Code Reason
401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Example

{
  "keypairs": [
    {
      "keypair": {
        "public_key": "ssh-rsa AAAA<...> VSTOR-KEY-DESC:Key description",
        "created_at": "2021-02-08T19:07:30.441615",
        "type": "ssh",
        "name": "key1",
        "fingerprint": "c9:6c:cc:ea:9f:f2:d4:0b:6e:1b:57:12:27:4e:1f:a5"
      }
    }
  ]
}