cvm — Cloud Virtual Machine
cvm · 2017-03-12

CreateKeyPair

POST

Create an `OpenSSH RSA` key pair, which you can use to log in to a `Linux` instance.

Wire call

Converge Cloud is RPC over HTTP. There is one path — / — and the action travels in the X-TC-Action header. The /cvm/CreateKeyPair path used in the OpenAPI document is a documentation convenience so each action is addressable; it is not a route on the server.

curl
curl -sS https://cvm.api3.convergecloud.com/ \
  -H 'Authorization: TC3-HMAC-SHA256 Credential=<SecretId>/<YYYY-MM-DD>/cvm/tc3_request, SignedHeaders=content-type;host;x-tc-action, Signature=<sig>' \
  -H 'Content-Type: application/json; charset=utf-8' \
  -H 'Host: cvm.api3.convergecloud.com' \
  -H 'X-TC-Action: CreateKeyPair' \
  -H 'X-TC-Version: 2017-03-12' \
  -H 'X-TC-Timestamp: <unix-seconds>' \
  -H 'X-TC-Region: luzon' \
  -d '{"KeyName":"<KeyName>","ProjectId":"<ProjectId>"}'

Request parameters

FieldTypeRequiredDescription
KeyNamestringYesName of the key pair, which can contain numbers, letters, and underscores, with a maximum length of 25 characters.
ProjectIdintegerYesID of the project to which the created key pair belongs.
TagSpecificationTagSpecification[]NoTag description list. This parameter is used to bind a tag to a key pair.

Response

Fields are returned inside the Response envelope. Converge Cloud answers HTTP 200 for errors as well as successes, so read Response.Error rather than the status code — and test for the presence of that object, because Code is occasionally the empty string.

FieldTypeDescription
KeyPairKeyPairKey pair information.
RequestIdstringThe unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.
Success
{
  "Response": {
    "KeyPair": …,
    "RequestId": "…"
  }
}
Error
{
  "Response": {
    "Error": { "Code": "…", "Message": "…" },
    "RequestId": "…"
  }
}

Try it

CredentialThe key never leaves this tab — it signs the request here. The signed request goes to /api-relay/cvm.
Request bodyvalid JSONPOST cvm.api3.convergecloud.com · CreateKeyPair
Recorded example response — captured 2026-09-16
{
  "Response": {
    "KeyPair": {
      "KeyId": "skey-fmrp3we4",
      "KeyName": "example_key",
      "ProjectId": 0,
      "PublicKey": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDnr6cJPDQtO7rGCp9YTOhM3ih7ObatFN7NETAvKaE0J/uRPLyIpAZUn/GKCxiVd3H7x1q7BR2G6GFBXAumonhBAkE3CmYwzxBcdl+PeH5eskDqs9GizmBSRL95SdiDob+zAuutSqPcnAQgyPq6uEll5o5cJGPNJBfv+v1NVX9Nz5xNiaRjOYfRXHj72+VXD1kpoj8Er/y1ylS6Pvi+Xmx27mUyIizMY73xst7cVGfGIUcljYzvV45A5svHQD2d1M3TU9r1ooEZny5JTaWO5sRyk7nOEVKHcywgDaEk6dHHrOwQ/6iSaUA8TA/M0uxUq8oAq+SqHRfU1LaIIZWFXY8j skey-fmrp3we4",
      "PrivateKey": "[redacted]",
      "AssociatedInstanceCount": 0,
      "AssociatedImageCount": 0
    },
    "RequestId": "6d2f6565-3df8-e684-5544-7d6cb5a64c3d"
  }
}

What failure looks like

Example error responses for this action. Match on Code.

Recorded error 1
{
  "Response": {
    "Error": {
      "Code": "InvalidParameterValue",
      "Message": "The specified key pair name `example-instance` is include illegal character `-`."
    },
    "RequestId": "3bc14f3b-f7c0-8a5f-f446-c247680f5473"
  }
}
Recorded error 2
{
  "Response": {
    "Error": {
      "Code": "InvalidParameterValue",
      "Message": "The specified key pair name `example-instance` is include illegal character `-`."
    },
    "RequestId": "4035ca6c-3564-917e-a41b-366a91bafdb3"
  }
}

Behaviour

Key pair names accept letters, digits and underscores; a hyphen is rejected. The private key is returned once in this response and cannot be retrieved afterwards.