Skip to main content

SSH Keys

Genesis Cloud allows you to add SSH public keys to the interface so that you can embed your public key into an instance at the time of creation.

SSH Key Schema

  • id String - A unique identifier for each SSH key. This is automatically generated.
  • name String - The human-readable name for the SSH key.
  • value String - SSH public key.
  • fingerprint String - The fingerprint of the SSH key.
  • type String - The encryption algorithm type of the SSH key.
  • size String - The length of the SSH key.
  • created_at String - A time value given in ISO8601 combined date and time format that represents when the SSH key was created.

Create an SSH Key

To create a new SSH key, send a request to:

POST /compute/v1/ssh-keys  (HTTP 201 - Created)

The attribute values that must be set to successfully create an SSH key are:

Body parameters

  • name String Required - The human-readable name for your ssh key.
  • value String Required - SSH public key
{
"id": "592f3575-e0cd-4d20-974c-6c853bfaa0f0",
"name": "name",
"value": "ssh-public-key",
"fingerprint": "13:ac:e1:88:e7:b9:13:12:6b:13:0b:ee:bc:bb:e0:41",
"type": "rsa",
"size": 3072,
"created_at": "2022-07-15T10:38:39.746Z"
}

Response body

An SSH key will be created using the provided information. The response body will contain a JSON object with standard attributes for your new SSH key, see SSH Key Schema:

{
"id": "592f3575-e0cd-4d20-974c-6c853bfaa0f0",
"name": "name",
"value": "ssh-public-key",
"fingerprint": "13:ac:e1:88:e7:b9:13:12:6b:13:0b:ee:bc:bb:e0:41",
"type": "rsa",
"size": 3072,
"created_at": "2022-07-15T10:38:39.746Z"
}

List SSH Keys

To list all of the keys in your account, send a GET request to /compute/v1/ssh-keys.

The response will be a JSON object with a key set to ssh_keys. The value of this will be an array of key objects, each containing the standard key attributes.

GET /compute/v1/ssh-keys (HTTP 200 - OK)

Query parameters

  • per_page Integer Optional - A positive integer lower than or equal to 100 to select the number of items to return (default: 50).
  • page Integer Optional - A positive integer to choose the page to return.

Response body

The response will be a JSON object with pagination details and a key called ssh_keys. This will be set to an array of ssh key objects, each of which will contain the standard ssh key attributes, see SSH Key Schema:

{
"ssh_keys": [
{
"id": "592f3575-e0cd-4d20-974c-6c853bfaa0f0",
"name": "name",
"value": "ssh-public-key",
"fingerprint": "13:ac:e1:88:e7:b9:13:12:6b:13:0b:ee:bc:bb:e0:41",
"type": "rsa",
"size": 3072,
"created_at": "2022-07-15T10:38:39.746Z"
}
],
"total_count": 1,
"page": 1,
"per_page": 10
}

Get an SSH Key

Get details of one ssh key with a given ID.

GET /compute/v1/ssh-keys/<ssh_key_id> (HTTP 200 - OK)

Path parameters:

  • ssh_key_id String - SSH Key id

Response body

The response will be a JSON object that contains the ssh_key attributes, see SSH Key Schema:

{
"id": "592f3575-e0cd-4d20-974c-6c853bfaa0f0",
"name": "name",
"value": "ssh-public-key",
"fingerprint": "13:ac:e1:88:e7:b9:13:12:6b:13:0b:ee:bc:bb:e0:41",
"type": "rsa",
"size": 3072,
"created_at": "2022-07-15T10:38:39.746Z"
}

Delete an SSH Key

Delete an ssh key with the given ID.

DELETE /compute/v1/ssh-keys/<ssh_key_id>  (HTTP 204 - No content)

Path parameters:

  • ssh_key_id String - SSH Key id

Edit an SSH key

Edit the name of an existing SSH key.

PUT /compute/v1/ssh-keys/<ssh_key_id>  (HTTP 200 - OK)

Path parameters:

  • ssh_key_id String - SSH Key id

Body parameters

  • name String Required - The new human-readable name for your ssh key.
{
"name": "new_name"
}

Response body

The response will be a JSON object that contains the new ssh_key attributes, see SSH Key Schema:

{
"id": "string",
"name": "string",
"value": "string",
"created_at": "2020-03-20T18:06:32.767Z"
}

Examples (cURL)

# Create an SSH key
curl -H "Authorization: Bearer $TOKEN" \
-X POST "https://api.genesiscloud.com/compute/v1/ssh-keys" \
-H "Content-Type: application/json" \
--data-raw '{
"name": "ssh-key-name",
"value": "ssh-public-key"
}'
# List all ssh keys
curl -H "Authorization: Bearer $TOKEN" \
"https://api.genesiscloud.com/compute/v1/ssh-keys"
# Get an ssh key by id
curl -H "Authorization: Bearer $TOKEN" \
"https://api.genesiscloud.com/compute/v1/ssh-keys/<ssh_key_id>"
# Delete an ssh key by id
curl -H "Authorization: Bearer $TOKEN" \
-X DELETE "https://api.genesiscloud.com/compute/v1/ssh-keys/<ssh_key_id>"
# Edit an ssh key by id
curl -H "Authorization: Bearer $TOKEN" \
-X PUT "https://api.genesiscloud.com/compute/v1/ssh-keys/<ssh_key_id>" \
-H "Content-Type: application/json" \
--data-raw '{
"name": "new_name"
}'