Domain name for API request: cvm.intl.tencentcloudapi.com.
This API is used to import key pairs.
SSL
tool before importing them.A maximum of 10 requests can be initiated per second for this API.
The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.
Parameter Name | Required | Type | Description |
---|---|---|---|
Action | Yes | String | Common Params. The value used for this API: ImportKeyPair. |
Version | Yes | String | Common Params. The value used for this API: 2017-03-12. |
Region | Yes | String | Common Params. For more information, please see the list of regions supported by the product. |
KeyName | Yes | String | Key pair name, which can contain numbers, letters, and underscores, with a maximum length of 25 characters. |
ProjectId | Yes | Integer | The project ID to which the key pair belongs after it is created. You can obtain the project ID in the following ways: DescribeProject API and view the projectId in the response.If you want to use the default project, specify 0 for the parameter. |
PublicKey | Yes | String | Content of the public key in the key pair in the OpenSSH RSA format. |
TagSpecification.N | No | Array of TagSpecification | Tag description list. This parameter is used to bind a tag to a key pair. |
Parameter Name | Type | Description |
---|---|---|
KeyId | String | Key pair ID |
RequestId | String | The 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. |
POST / HTTP/1.1
Host: cvm.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ImportKeyPair
<Common request parameters>
{
"ProjectId": "0",
"KeyName": "operation_key",
"PublicKey": "ssh-rsa XXXXXXXXXXXX== skey_45071"
}
{
"Response": {
"KeyId": "skey-4e5ty7i8",
"RequestId": "6EF60BEC-0242-43AF-BB20-270359FB54A7"
}
}
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
Error Code | Description |
---|---|
InternalServerError | Internal error. |
InvalidKeyPair.LimitExceeded | The number of key pairs exceeds the limit. |
InvalidKeyPairName.Duplicate | Key pair name already exists. |
InvalidKeyPairNameEmpty | The key name cannot be empty. |
InvalidKeyPairNameIncludeIllegalChar | The key name contains invalid characters. Key names can only contain letters, numbers and underscores. |
InvalidKeyPairNameTooLong | The key name cannot exceed 25 characters. |
InvalidParameterValue | Incorrect parameter value. |
InvalidProjectId.NotFound | Invalid project ID: the specified project ID does not exist. |
InvalidPublicKey.Duplicate | Invalid public key: the specified key already exists. |
InvalidPublicKey.Malformed | Invalid public key: the specified public key does not meet the OpenSSH RSA format requirements. |
LimitExceeded.TagResourceQuota | Exceeded the upper limit of resources bound to the tag. |
MissingParameter | Missing parameter. |
Was this page helpful?