Skip to content
  • Auto
  • Light
  • Dark

Retrieve

Retrieve an Existing SSH Key
get/v2/account/keys/{ssh_key_identifier}

To get information about a key, send a GET request to /v2/account/keys/$KEY_ID or /v2/account/keys/$KEY_FINGERPRINT. The response will be a JSON object with the key ssh_key and value an ssh_key object which contains the standard ssh_key attributes.

Path ParametersExpand Collapse
ssh_key_identifier: number or string

A unique identification number for this key. Can be used to embed a specific SSH key into a Droplet.

Accepts one of the following:
SSHKeyID = number

A unique identification number for this key. Can be used to embed a specific SSH key into a Droplet.

SSHKeyFingerprint = string

A unique identifier that differentiates this key from other keys using a format that SSH recognizes. The fingerprint is created when the key is added to your account.

ReturnsExpand Collapse
ssh_key: optional SSHKeys { name, public_key, id, fingerprint }
name: string

A human-readable display name for this key, used to easily identify the SSH keys when they are displayed.

public_key: string

The entire public key string that was uploaded. Embedded into the root user's authorized_keys file if you include this key during Droplet creation.

id: optional number

A unique identification number for this key. Can be used to embed a specific SSH key into a Droplet.

fingerprint: optional string

A unique identifier that differentiates this key from other keys using a format that SSH recognizes. The fingerprint is created when the key is added to your account.

Retrieve an Existing SSH Key
curl https://api.digitalocean.com/v2/account/keys/$SSH_KEY_IDENTIFIER \
    -H "Authorization: Bearer $DIGITALOCEAN_ACCESS_TOKEN"
{
  "ssh_key": {
    "name": "My SSH Public Key",
    "public_key": "ssh-rsa AEXAMPLEaC1yc2EAAAADAQABAAAAQQDDHr/jh2Jy4yALcK4JyWbVkPRaWmhck3IgCoeOO3z1e2dBowLh64QAM+Qb72pxekALga2oi4GvT+TlWNhzPH4V example",
    "id": 512189,
    "fingerprint": "3b:16:bf:e4:8b:00:8b:b8:59:8c:a9:d3:f0:19:45:fa"
  }
}
Returns Examples
{
  "ssh_key": {
    "name": "My SSH Public Key",
    "public_key": "ssh-rsa AEXAMPLEaC1yc2EAAAADAQABAAAAQQDDHr/jh2Jy4yALcK4JyWbVkPRaWmhck3IgCoeOO3z1e2dBowLh64QAM+Qb72pxekALga2oi4GvT+TlWNhzPH4V example",
    "id": 512189,
    "fingerprint": "3b:16:bf:e4:8b:00:8b:b8:59:8c:a9:d3:f0:19:45:fa"
  }
}