12.1. Listing SSH keys

GET /os-keypairs

List keypairs that are associated with the account.

Source: https://docs.openstack.org/api-ref/compute/#list-keypairs

12.1.1. Request

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

12.1.1.1. 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

12.1.2. Response

Name In Type Description
keypairs body array Array of Keypair objects
keypair body object 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 the previous example, the offset value is -05:00.

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

The type of the keypair. Allowed values are ssh or x509.

New in version 2.2

keypairs_links (Optional) body array

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

New in version 2.35

12.1.2.1. Status codes

12.1.2.1.1. Success

Code Reason
200 - OK Request was successful.

12.1.2.1.2. Error

Code Reason
401 - Unauthorized User must authenticate before making a request.
403 - Forbidden Policy does not allow current user to do this operation.

12.1.2.2. 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"
      }
    }
  ]
}