---
title: dots.v2.account.keys.post()
description: Create a New SSH Key
product: Reference
url: https://docs.digitalocean.com/reference/dots/reference/ssh-keys/sshkeys-create/
last_updated: "2026-11-18"
---

> **For AI agents:** The documentation index is at [https://docs.digitalocean.com/llms.txt](https://docs.digitalocean.com/llms.txt). Markdown versions of pages use the same URL with `index.html.md` in place of the HTML page (for example, append `index.html.md` to the directory path instead of opening the HTML document).

# dots.v2.account.keys.post()

Generated on 18 Nov 2026 from DoTs version [`v1.25.0`](https://github.com/digitalocean/dots/releases/tag/v1.25.0)

## Usage

```typescript
client.v2.account.keys.post(body: SshKeys, requestConfiguration?: RequestConfiguration<object>): Promise<undefined | KeysPostResponse>
```

## Description

To add a new SSH public key to your DigitalOcean account, send a POST request to [`/v2/account/keys`](https://docs.digitalocean.com/reference/api/reference/ssh-keys/index.html.md#sshKeys_create). Set the `name` attribute to the name you wish to use and the `public_key` attribute to the full public key you are adding.

## Parameters

`id` integer optional read-only

Example: `512189`

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

`fingerprint` string optional read-only

Example: `3b:16:bf:e4:8b:00:8b:b8:59:8c:a9:d3:f0:19:45:fa`

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.

`publicKey` string required

Example: `ssh-rsa AEXAMPLEaC1yc2EAAAADAQABAAAAQQDDHr/jh2Jy4yALcK4JyWbVkPRaWmhck3IgCoeOO3z1e2dBowLh64QAM+Qb72pxekALga2oi4GvT+TlWNhzPH4V example`

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.

`name` string required

Example: `My SSH Public Key`

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

## Request Sample

## Show Request Sample

```typescript
import { FetchRequestAdapter } from "@microsoft/kiota-http-fetchlibrary";
import {
    createDigitalOceanClient,
    DigitalOceanApiKeyAuthenticationProvider,
} from "@digitalocean/dots";

const authProvider = new DigitalOceanApiKeyAuthenticationProvider(process.env.DIGITALOCEAN_TOKEN!);
const adapter = new FetchRequestAdapter(authProvider);
const client = createDigitalOceanClient(adapter);

const response = await client.v2.account.keys.post({
    publicKey: "ssh-rsa AEXAMPLEaC1yc2EAAAADAQABAAAAQQDDHr/jh2Jy4yALcK4JyWbVkPRaWmhck3IgCoeOO3z1e2dBowLh64QAM+Qb72pxekALga2oi4GvT+TlWNhzPH4V example",
    name: "My SSH Public Key",
});
```

## Response Example

## Show Response Example

```json
{
  "ssh_key": {
    "id": 512189,
    "fingerprint": "3b:16:bf:e4:8b:00:8b:b8:59:8c:a9:d3:f0:19:45:fa",
    "public_key": "ssh-rsa AEXAMPLEaC1yc2EAAAADAQABAAAAQQDDHr/jh2Jy4yALcK4JyWbVkPRaWmhck3IgCoeOO3z1e2dBowLh64QAM+Qb72pxekALga2oi4GvT+TlWNhzPH4V example",
    "name": "My SSH Public Key"
  }
}
```

## More Information

See [`/v2/account/keys`](https://docs.digitalocean.com/reference/api/reference/ssh-keys/index.html.md#sshKeys_create) in the API reference for additional detail on responses, headers, parameters, and more.