CreateDeployKey

Updated at:

Creates a deploy key in a code repository.

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 /repository/{repositoryId}/keys/create HTTP/1.1

Path Parameters

Parameter

Type

Required

Description

Example

repositoryId

integer

Yes

The code repository ID.

2813489

Request parameters

Parameter

Type

Required

Description

Example

organizationId

string

Yes

The organization ID. This is a string that can be obtained from the Yunxiao URL, such as https://devops.aliyun.com/organization/[OrganizationId].

60de7a6852743a5162b5f957

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) temporary authorization.

f0b1e61db5961df5975a93f9129d2513

body

object

Yes

The request body.

title

string

Yes

The title of the deploy key.

Test key

key

string

Yes

The deploy key.

Important The deploy key cannot be the same as an SSH key. For more information, see https://help.aliyun.com/document_detail/153709.html?spm=a2cl9.codeup_devops2020_goldlog_projectSettings.0.0.50c83b53WLYIBj.

""

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.

”“

success

boolean

Indicates whether the call was successful.

true

result

object

The returned result.

id

integer

The ID of the deploy key.

502385

title

string

The title of the deploy key.

Test key

key

string

The deploy key.

""

fingerprint

string

The fingerprint of the deploy key.

xx:xx:xx:xx

createdAt

string

The creation time.

2022-03-18 14:24:54

Examples

Success response

JSON format

{
  "requestId": "ASSDS-ASSASX-XSAXSA-XSAXSAXS",
  "errorCode": "SYSTEM_UNKNOWN_ERROR",
  "errorMessage": "”“",
  "success": true,
  "result": {
    "id": 502385,
    "title": "测试密钥",
    "key": "\"\"",
    "fingerprint": "xx:xx:xx:xx",
    "createdAt": "2022-03-18 14:24:54"
  }
}

Error codes

HTTP status code

Error code

Error message

Description

403 Forbidden.AccessDenied The user is not authorized to perform the operation. The user is not authorized to perform the operation.
403 Forbidden.UserNotInCurrentOrganization The user is not in the organization and is not authorized to perform the operation.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.