# Import the public part of the key pair - ImportUHostKeyPairs

## Overview

After importing the key pair, only the public key part is kept. You need to properly save the private key part of the key pair yourself.






## Definition

### Public Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Action**     | string  | Corresponding API command name, the current API is `ImportUHostKeyPairs`.                      | **Yes** |
| **PublicKey**  | string  | The user's public key can be obtained from [Console](https://console.dezai.com/uaccount/api_manage)                                             | **Yes** |
| **Signature**  | string  | User signature generated based on public key and API command, see [Signature Algorithm](/docs/api/summary/signature.md)  | **Yes** |

### Request Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Region** | string | Region. See [List of Regions and Availability Zones](/docs/api/summary/regionlist) |No|
| **Zone** | string | Availability Zone. See [Availability Zone List](/docs/api/summary/regionlist) |No|
| **ProjectId** | string | Project ID. If not filled in, the default project is used, sub-accounts must be filled in. Please refer to the [GetProjectList interface](/docs/api/summary/get_project_list). |No|
| **KeyPairName** | string | Key pair name. Composed of letters, numbers, and symbols, the length is 1-63 characters. |**Yes**|
| **PublicKeyBody** | string | The content of the public key in the key pair. |**Yes**|

### Response Field

| Field Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **RetCode** | int | Return status code. If it is 0, it means successful return. If it is not 0, it means failure. |**Yes**|
| **Action** | string | Operation command name. |**Yes**|
| **Message** | string | Returns an error message, providing detailed description when `RetCode` is non-zero. |No|
| **KeyPairName** | string | Key Pair Name |**Yes**|
| **KeyPairId** | string | Key Pair Identifier |No|
| **KeyPairFingerPrint** | string | Key Pair Fingerprint. According to the public key fingerprint format defined by RFC4716, the MD5 message digest algorithm is used. The specific information format processed by the algorithm: `ProjectIdKeyPairId\|PublicKeyBody`. |No|




## Example

### Request Example
    
```
https://api.dezai.com/?Action=ImportUHostKeyPairs
&Region=cn-zj
&Zone=cn-zj-01
&ProjectId=SbUkIcDH
&KeyPairName=AvMxnTFF
&KeyPairFingerPrint=CrRMVFAh
&Offset=4
&Limit=2
```

### Response Example
    
```json
{
  "Action": "ImportUHostKeyPairsResponse",
  "KeyPairFingerPrint": "dcEwwOjw",
  "KeyPairId": "fAfiTLeG",
  "KeyPairs": [
    {
      "CreateTime": "ioZVoqOy",
      "KeyPairFingerPrint": "WGLwoysy",
      "KeyPairId": "rVMtzwbR",
      "KeyPairName": "ffBMnglwJxnXLpczybVcYxXcLecyHPGTwNRkGkWSeLjEnehGNXfXEGFeJBSdUVDNVKhCNAyykNTEaZwYRadRXPZxMZDErhqHMVTyUeUbkIbipLUrSeWpYkdADUxIZxBzVvIMtiHJHGVHcQmOEpTrBhWNeMJsQmTabwMyZeOjUovZZpemahAtnEGqljWAUdgYGrWnaMMRUZzutJyDxUuJbTGbHyMhfnzfbaKGIulWCBfEuBDhTXbZjSYxVUCwVzTXSoDdSyXtVXkircmRcrStCBgJuiOnbkauLyfvvFspMCEjnIYgnVarveyDvDkQakayndkfPnHfbxFXXFdGZHNdrpCNVuqARtyAmXrJgCLuyjcbmiujuuhVSmkPgIFZdoBzAGhtuMDgOgcWKqJpYuKQRRWtINJkUzRSLmbhGCWPVTjjYvgQPDnQvNRehTffgJRUkMdJoygAUObKakcrLnZNEnKueavdWlCKlMejUZSZtJgcjzVsvDBuOLvtsCuLLNTUBBHHaMKOXIQqCsEplgMZWwGDQZDBOIhOUksYuEjkbQKRepTGTSWSSxnUFsfqxlIUgHblbYlcdjnwWeSNvMZPRvyUXeGcMhbJzPUbPtmEKGPwGnvMrTrfRHLuKXYtsTPnowalTwxErqTyGksVQBfylcHZsChsUAXuREhhoNohaLWRUfuVeZhTRLQGcHjrjSGFVslNWZMgdCPevMoeVmeOdmKoxbgUmggKflZTKBzXrwpbAAGKGWPrTzuybxDHquKNkjMVigcoGBKuhLaRlkISeolwEXMwNsfDGPKmclVawxvmgsryaLMXyCSqFkEgeZCNCvYMRAlDtCnalcRAjXDehFndRwcIQQRSgMOydiVKJgpvvPTnZnxDcwxqLJKvVbpDfkhwwkYFmLJMmdDqjbmTRStcWMfBTcrLSOhqJAbKtLhmmkxLOuCbYMskyLFcJzWPwLswEOiQUYULRyjjQogdTEtAQApNBeCFKjxALtuslyMGUPmjcrPFgHRegCfwKuhGGLzZWrREtyAVInRsOJerxwrxvKICcGdrYFwWHzHv",
      "ProjectId": "dZOrNBWV"
    }
  ],
  "RetCode": 0,
  "TotalCount": 2
}
```





