---
title: "Create SSH key"
method: POST
path: "/v1/ssh-keys"
tags: ["SSH Keys"]
---

# Create SSH key

`POST /v1/ssh-keys`

Create a new SSH key. If only a name is provided, a new RSA key pair is generated.
If publicKey and privateKey fields are also provided, the key pair is imported.

## Request body

- SshKeyCreate
  - `name` string, required — SSH key name
  - `publicKey` string — Public key to import (omit to generate a new key pair)
  - `privateKey` string — Private key to import (required if publicKey is provided)

## Response `201`

SSH key created successfully

- SshKey
  - `id` integer — SSH key ID
  - `name` string — SSH key name
  - `publicKey` string — Public key in OpenSSH format (included in details and when includePublicKey=true)

## Other responses

- `400` — Invalid request
- `401` — Unauthorized
- `403` — User does not have SSH key configuration access rights

---

[API](https://skmtc.net/netxms/apis/netxms-api.md) · [All operations](https://skmtc.net/netxms/apis/netxms-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/netxms/netxms-api/versions/14d93e5115dd/schema)
