ByCloud Docs
GuidesCLIAPISDK
post/v1/keypairs

Create keypair

Create a new SSH keypair. If `public_key` is provided, it will be imported. If not provided, a new keypair will be generated and the private key returned.

Request Body

required

Content-Type: application/json

name

stringrequired

public_key

stringoptional

SSH public key (if not provided, a new keypair will be generated)

type

stringoptional

Enum: "ssh", "x509"

Default: "ssh"

Responses

201

Keypair created

Content-Type: application/json

keypair

objectoptional
400

Invalid request parameters

Content-Type: application/json

error

objectrequired
401

Authentication required or token invalid

Content-Type: application/json

error

objectrequired
409

Resource conflict (e.g., already exists, invalid state)

Content-Type: application/json

error

objectrequired
500

Internal server error

Content-Type: application/json

error

objectrequired
curl -X POST "https://api.spo1.mycloud.com/v1/keypairs" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "my-keypair",
"public_key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAB...",
"type": "ssh"
}'