# 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 %}
