CreateUserKey

Updated at:

Creates an SSH key for the current user.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request syntax

POST /api/v3/user/keys/create HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

organizationId

string

Yes

The enterprise identifier, also known as the enterprise ID. It is a string value that can be obtained from the Yunxiao URL, such as https://devops.aliyun.com/organization/[OrganizationId].

5ebbc0228123212b59xxxxx

accessToken

string

No

The personal access token. This parameter is not required if you use an Alibaba Cloud AccessKey pair or Security Token Service (STS) for temporary authorization.

f0b1e61db5961df5975a93f9129d2513

body

object

No

The request body.

publicKey

string

Yes

The public key string of the SSH key.

ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFhmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm doc-example

title

string

Yes

The title of the SSH key.

SSH Title

keyScope

string

Yes

Required. The scope of the key. Valid values:

  • ALL: All permissions, including read and write operations such as clone, pull, and push.

  • READ: Read-only permissions, which only support clone and pull operations.

ALL

expireTime

string

No

The expiration time. The format is YYYY-MM-DD HH:mm:ss.

2022-03-12 12:00:00

Response elements

Element

Type

Description

Example

object

Schema of Response

requestId

string

The request ID.

ASSDS-ASSASX-XSAXSA-XSAXSAXS

errorCode

string

The error code.

SYSTEM_UNKNOWN_ERROR

errorMessage

string

The error message.

SYSTEM_UNKNOWN_ERROR

success

boolean

Indicates whether the call was successful.

true

result

object

The returned result.

id

integer

The primary key ID of the key.

11072

title

string

The title of the SSH key.

My Title

publicKey

string

The public key string of the SSH key.

ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFhmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm doc-example

fingerPrint

string

The fingerprint information.

85:3c:55:fe:09:95:ff:93:7c:8a:22:21:43:06:25:97

keyScope

string

The scope of the key. Valid values:

  • ALL: All permissions, including read and write operations such as clone, pull, and push.

  • READ: Read-only permissions, which only support clone and pull operations.

ALL

createdAt

string

The creation time. The format is YYYY-MM-DD HH:mm:ss.

2022-03-12 12:00:00

expireTime

string

The expiration time. The format is YYYY-MM-DD HH:mm:ss.

2022-03-12 12:00:00

lastUsedTime

string

The last used time. The format is YYYY-MM-DD HH:mm:ss.

2022-03-12 12:00:00

Examples

Success response

JSON format

{
  "requestId": "ASSDS-ASSASX-XSAXSA-XSAXSAXS",
  "errorCode": "SYSTEM_UNKNOWN_ERROR",
  "errorMessage": "SYSTEM_UNKNOWN_ERROR",
  "success": true,
  "result": {
    "id": 11072,
    "title": "My Title",
    "publicKey": "xxx",
    "fingerPrint": "xxx",
    "keyScope": "ALL",
    "createdAt": "2022-03-12 12:00:00",
    "expireTime": "2022-03-12 12:00:00",
    "lastUsedTime": "2022-03-12 12:00:00"
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.