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

# Add SSH key

`POST /api/v1/user/ssh-keys`

Validates and stores an SSH public key. Minimum RSA 2048-bit, Ed25519 recommended.

## Request body

- SshKeyCreateRequest — Request model for creating an SSH key.
  - `name` string, required — Human-readable name for the key
  - `public_key` string, required — OpenSSH format public key

## Response `201`

Key created

- SshKeyResponse — SSH key details returned by API.
  - `id` string, required — Key hashid
  - `user_id` string, required — Owner user hashid
  - `name` string, required — Human-readable name
  - `public_key` string, required — OpenSSH format public key
  - `fingerprint` string, required — SHA256 fingerprint
  - `key_type` string, required — Algorithm (ed25519, rsa, etc)
  - `source` string, required — Origin: manual or github
  - `key_metadata` object, nullable — Extra data like bit length
  - `last_synced_at` string, nullable — Last GitHub sync timestamp
  - `created_at` string, required — Creation timestamp
  - `updated_at` string, required — Last update timestamp

## Other responses

- `400` — Invalid key format or key too weak
- `401` — Not authenticated
- `422` — Validation Error

---

[API](https://skmtc.net/phala/apis/phala-cloud-api.md) · [All operations](https://skmtc.net/phala/apis/phala-cloud-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/phala/phala-cloud-api/revisions/83c6ae62e860/schema)
