> For the complete documentation index, see [llms.txt](https://docs.allnodes.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.allnodes.com/endpoints/bare-metal-server/ssh-key.md).

# SSH Key

## Get all SSH Keys

<mark style="color:blue;">`GET`</mark> `https://www.allnodes.com/api/v1/ssh-key`

This endpoint allows to get list of all your ssh keys.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
  sshKeys: [
    {
      id: number;
      alias: string;
      publicKey: string;
    }
  ]
}
```

{% endtab %}
{% endtabs %}

## Add a new SSH Key

<mark style="color:green;">`POST`</mark> `https://www.allnodes.com/api/v1/ssh-key`

This endpoint allows to add a new ssh key.

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

**Body**

| Name        | Type   | Description           |
| ----------- | ------ | --------------------- |
| `alias`     | string | Alias of your SSH Key |
| `publicKey` | string | SSH Public Key        |

{% tabs %}
{% tab title="201: OK " %}

```javascript
{
  sshKey: {
    id: number;
    alias: string;
    publicKey: string;
  }
}
```

{% endtab %}

{% tab title="403: Forbidden" %}

```
{
  error: "NOT_REGISTERED";
  description?: string;
}
```

{% endtab %}
{% endtabs %}

## Remove a SSH Key

<mark style="color:red;">`DELETE`</mark> `https://www.allnodes.com/api/v1/ssh-key/{id}`

This endpoint allows you to remove a ssh key.

#### Path Parameters

| Name                                 | Type   | Description                                                                      |
| ------------------------------------ | ------ | -------------------------------------------------------------------------------- |
| id<mark style="color:red;">\*</mark> | string | SSH Key you want to remove. ID can be extracted from the “Get all SSH Keys” call |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer TOKEN |

{% tabs %}
{% tab title="204: No Content " %}

{% endtab %}

{% tab title="403: Forbidden" %}

```
{
  error: "NOT_REGISTERED";
  description?: string;
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.allnodes.com/endpoints/bare-metal-server/ssh-key.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
