# SSH Keys

### Create a SSH Key

Use this endpoint to add new SSH keys, especially when integrating new developers or setting up new instances that require secure access.

{% hint style="info" %}
Use descriptive names for your keys to easily manage multiple SSH credentials.
{% endhint %}

## POST /gpu-cloud/ssh-keys

>

```json
{"openapi":"3.0.0","info":{"title":"Cloud Sesterce API","version":"1.0"},"paths":{"/gpu-cloud/ssh-keys":{"post":{"operationId":"GPUCloudSSHKeysController_create","parameters":[{"name":"x-api-key","in":"header","description":"The API Key secret should be sent through this header to authenticate the request.","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSSHKeyDto"}}}},"responses":{"201":{"description":"Return the created ssh key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SSHKeyDto"}}}},"403":{"description":"API key invalid","content":{"application/json":{"schema":{"type":"object","properties":{"statusCode":{"type":"number"},"timestamp":{"type":"string"},"path":{"type":"string"},"message":{"type":"string"}}}}}},"404":{"description":"API key not found","content":{"application/json":{"schema":{"type":"object","properties":{"statusCode":{"type":"number"},"timestamp":{"type":"string"},"path":{"type":"string"},"message":{"type":"string"}}}}}}},"tags":["GPUCloudSSHKeys"]}}},"components":{"schemas":{"CreateSSHKeyDto":{"type":"object","properties":{"name":{"type":"string"},"publicKey":{"type":"string"}},"required":["name","publicKey"]},"SSHKeyDto":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"publicKey":{"type":"string"},"isDefault":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["_id","name","publicKey","isDefault","createdAt","updatedAt"]}}}}
```

### Retrieve the list of SSH Keys created

Access this endpoint to manage your SSH keys, which is essential for securing access to your instances and maintaining a safe environment.

## GET /gpu-cloud/ssh-keys

>

```json
{"openapi":"3.0.0","info":{"title":"Cloud Sesterce API","version":"1.0"},"paths":{"/gpu-cloud/ssh-keys":{"get":{"operationId":"GPUCloudSSHKeysController_getUserSSHKeys","parameters":[{"name":"x-api-key","in":"header","description":"The API Key secret should be sent through this header to authenticate the request.","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Returns the list of user ssh keys","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SSHKeyDto"}}}}},"403":{"description":"API key invalid","content":{"application/json":{"schema":{"type":"object","properties":{"statusCode":{"type":"number"},"timestamp":{"type":"string"},"path":{"type":"string"},"message":{"type":"string"}}}}}},"404":{"description":"API key not found","content":{"application/json":{"schema":{"type":"object","properties":{"statusCode":{"type":"number"},"timestamp":{"type":"string"},"path":{"type":"string"},"message":{"type":"string"}}}}}}},"tags":["GPUCloudSSHKeys"]}}},"components":{"schemas":{"SSHKeyDto":{"type":"object","properties":{"_id":{"type":"string"},"name":{"type":"string"},"publicKey":{"type":"string"},"isDefault":{"type":"boolean"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["_id","name","publicKey","isDefault","createdAt","updatedAt"]}}}}
```

### Mark a SSH Key as default

This endpoint is handy when you want to change the default SSH key for your connections, for example, during regular key rotation for security reasons.

## PATCH /gpu-cloud/ssh-keys/{id}/makedefault

>

```json
{"openapi":"3.0.0","info":{"title":"Cloud Sesterce API","version":"1.0"},"paths":{"/gpu-cloud/ssh-keys/{id}/makedefault":{"patch":{"operationId":"GPUCloudSSHKeysController_makeDefault","parameters":[{"name":"x-api-key","in":"header","description":"The API Key secret should be sent through this header to authenticate the request.","required":true,"schema":{"type":"string"}},{"name":"id","required":true,"in":"path","schema":{"type":"string"}}],"responses":{"204":{"description":"SSH key marked as default"},"403":{"description":"API key invalid","content":{"application/json":{"schema":{"type":"object","properties":{"statusCode":{"type":"number"},"timestamp":{"type":"string"},"path":{"type":"string"},"message":{"type":"string"}}}}}},"404":{"description":"Not found","content":{"application/json":{"schema":{"type":"object","properties":{"statusCode":{"type":"number"},"message":{"type":"string"}}}}}}},"tags":["GPUCloudSSHKeys"]}}}}
```

### Delete a SSH Key

Use this endpoint to clean up and remove obsolete or compromised SSH keys to maintain the security of your environment.

{% hint style="info" %}
Regularly review and clean up unused SSH keys to maintain security.
{% endhint %}

{% openapi src="<https://3376774032-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoExYATuECEyEKGJ4cD8X%2Fuploads%2FpzcBuompwnhSyFJWnZ0Q%2FV2_docAPI.json?alt=media&token=8e494e06-cadb-419f-b509-08f84b8f3c10>" path="/gpu-cloud/ssh-keys/{id}" method="delete" %}
[V2\_docAPI.json](https://3376774032-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoExYATuECEyEKGJ4cD8X%2Fuploads%2FpzcBuompwnhSyFJWnZ0Q%2FV2_docAPI.json?alt=media\&token=8e494e06-cadb-419f-b509-08f84b8f3c10)
{% endopenapi %}
