CreateDeployKey - Create a deployment key

Updated at:

Creates a deployment key for a repository by calling an OpenAPI operation.

Applicable editions

Central edition, Region edition

Service endpoint and authorization information

Product

Resource

Required permission

Code Management

Deployment key

Read and write

Request syntax

Central edition

POST https://{domain}/oapi/v1/codeup/organizations/{organizationId}/repositories/{repositoryId}/keys

Region edition

POST https://{domain}/oapi/v1/codeup/repositories/{repositoryId}/keys

Request headers

Parameter

Type

Required

Description

Example value

x-yunxiao-token

string

Yes

Your personal access token.

pt-0fh3****0fbG_35af****0484

Request parameters

Parameter

Type

Location

Required

Description

Example value

organizationId

string

path

  • Yes: Central edition

  • No: Region edition

The organization ID.

60d54f3daccf2bbd6659f3ad

repositoryId

string

path

Yes

The repository ID or URL-encoded full path.

2813489 or 60de7a6852743a5162b5f957%2FDemoRepo

-

object

body

No

key

string

body

Yes

The deployment key.

xxx

title

string

body

Yes

The title of the deployment key.

SSH Title

Request examples

Central edition

curl -X 'POST' \
  'https://{domain}/oapi/v1/codeup/organizations/60d54f3daccf2bbd6659f3ad/repositories/2813489 or 60de7a6852743a5162b5f957%2FDemoRepo/keys' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "key": "xxx",
        "title": "SSH Title"
    }'

Region edition

curl -X 'POST' \
  'https://{domain}/oapi/v1/codeup/repositories/2813489 or 60de7a6852743a5162b5f957%2FDemoRepo/keys' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "key": "xxx",
        "title": "SSH Title"
    }'

Response parameters

Parameter

Type

Description

Example value

-

object

createdAt

string

The time when the key was created.

2024-10-05T15:30:45Z

fingerPrint

string

The fingerprint of the key.

xxx

id

integer

The key ID.

1

key

string

The deployment key.

xxx

title

string

The title of the deployment key.

username@example

Response example

{
    "createdAt": "2024-10-05T15:30:45Z",
    "fingerPrint": "xxx",
    "id": 1,
    "key": "xxx",
    "title": "username@example"
}

Error codes

For more information, see Error code center.