Skip to content
  • Auto
  • Light
  • Dark

Update

Update an SSH Key's Name
gpu_droplets.account.keys.update(Union[int, str]ssh_key_identifier, KeyUpdateParams**kwargs) -> KeyUpdateResponse
put/v2/account/keys/{ssh_key_identifier}

To update the name of an SSH key, send a PUT request to either /v2/account/keys/$SSH_KEY_ID or /v2/account/keys/$SSH_KEY_FINGERPRINT. Set the name attribute to the new name you want to use.

ParametersExpand Collapse
ssh_key_identifier: Union[int, str]

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

Accepts one of the following:
SSHKeyIdentifierSSHKeyID = int

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

SSHKeyIdentifierSSHKeyFingerprint = str

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.

name: Optional[str]

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

ReturnsExpand Collapse
class KeyUpdateResponse:
ssh_key: Optional[SSHKeys]
name: str

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

public_key: str

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[int]

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

fingerprint: Optional[str]

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.

Update an SSH Key's Name
from gradient import Gradient

client = Gradient()
key = client.gpu_droplets.account.keys.update(
    ssh_key_identifier=512189,
)
print(key.ssh_key)
{
  "ssh_key": {
    "name": "My SSH Public Key",
    "public_key": "ssh-rsa AEXAMPLEaC1yc2EAAAADAQABAAAAQQDDHr/jh2Jy4yALcK4JyWbVkPRaWmhck3IgCoeOO3z1e2dBowLh64QAM+Qb72pxekALga2oi4GvT+TlWNhzPH4V example"
  }
}
Returns Examples
{
  "ssh_key": {
    "name": "My SSH Public Key",
    "public_key": "ssh-rsa AEXAMPLEaC1yc2EAAAADAQABAAAAQQDDHr/jh2Jy4yALcK4JyWbVkPRaWmhck3IgCoeOO3z1e2dBowLh64QAM+Qb72pxekALga2oi4GvT+TlWNhzPH4V example"
  }
}