# Keys ## Create **post** `/v2/account/keys` To add a new SSH public key to your DigitalOcean account, send a POST request to `/v2/account/keys`. Set the `name` attribute to the name you wish to use and the `public_key` attribute to the full public key you are adding. ### Returns - `ssh_key: optional SSHKeys` - `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 **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. ### Returns - `ssh_key: optional SSHKeys` - `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. ## Update **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. ### Returns - `ssh_key: optional SSHKeys` - `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. ## List **get** `/v2/account/keys` To list all of the keys in your account, send a GET request to `/v2/account/keys`. The response will be a JSON object with a key set to `ssh_keys`. The value of this will be an array of ssh_key objects, each of which contains the standard ssh_key attributes. ### Returns - `meta: MetaProperties` Information about the response itself. - `total: optional number` Number of objects returned by the request. - `links: optional PageLinks` - `pages: optional ForwardLinks or BackwardLinks or unknown` - `ForwardLinks = object { last, next }` - `last: optional string` URI of the last page of the results. - `next: optional string` URI of the next page of the results. - `BackwardLinks = object { first, prev }` - `first: optional string` URI of the first page of the results. - `prev: optional string` URI of the previous page of the results. - `UnionMember2 = unknown` - `ssh_keys: optional array of SSHKeys` - `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. ## Delete **delete** `/v2/account/keys/{ssh_key_identifier}` To destroy a public SSH key that you have in your account, send a DELETE request to `/v2/account/keys/$KEY_ID` or `/v2/account/keys/$KEY_FINGERPRINT`. A 204 status will be returned, indicating that the action was successful and that the response body is empty. ## Domain Types ### SSH Keys - `SSHKeys = object { 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.