ListSSHKeys - Query the list of SSH keys

Updated at:

Retrieves the list of SSH keys via OpenAPI.

Applicable editions

Central edition, Region edition

Endpoint and authorization information

  • Obtain the endpoint: Replace {domain} in the API request syntax.
  • Obtain a personal access token.
  • Obtain the organization ID: Required only for the Central edition. You can go to the Basic Information page in the Organization Management console to obtain the organization ID.

Product

Resource

Required permission

Code Management

SSH key

read-only

Request syntax

Central edition

GET https://{domain}/oapi/v1/codeup/organizations/{organizationId}/keys

Region edition

GET https://{domain}/oapi/v1/codeup/keys

Request headers

Parameter

Type

Required

Description

Example

x-yunxiao-token

string

Yes

Personal access token.

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

Request parameters

Parameter

Type

Location

Required

Description

Example

organizationId

string

path

  • Yes: Central edition

  • No: Region edition

The organization ID.

60d54f3daccf2bbd6659f3ad

page

integer

query

No

The page number. Default: 1. Maximum: 150.

1

perPage

integer

query

No

The number of entries per page. Default: 20. Valid range: 1 to 100.

20

orderBy

string

query

No

The sort field. Valid values: created_at, updated_at. Default: created_at.

created_at

sort

string

query

No

The sort order. Valid values: asc, desc. Default: desc.

desc

Request examples

Central edition

curl -X 'GET' \
  'https://{domain}/oapi/v1/codeup/organizations/60d54f3daccf2bbd6659f3ad/keys?page=1&perPage=20&orderBy=created_at&sort=desc' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'

Region edition

curl -X 'GET' \
  'https://{domain}/oapi/v1/codeup/keys?page=1&perPage=20&orderBy=created_at&sort=desc' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484'

Response parameters

Parameter

Type

Description

Example

-

object

createdAt

string

The time when the key was created.

2024-10-05T15:30:45Z

expireTime

string

The time when the key expires.

2024-10-05T15:30:45Z

fingerPrint

string

The device fingerprint.

xxx

id

integer

The primary key ID of the SSH key.

1

key

string

The public key string of the SSH key.

xxx

keyScope

string

The applicable scope. ALL: read and write operations, including clone, pull, and push. READ: read-only operations, including clone and pull only.

ALL

lastUsedTime

string

The time when the key was last used.

2024-10-05T15:30:45Z

title

string

The title of the SSH key.

username@example

updatedAt

string

The time when the key was last updated.

2024-10-05T15:30:45Z

Response example

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

Response headers

Parameter

Description

Example

x-next-page

The next page number.

3

x-page

The current page number.

2

x-per-page

The number of entries per page.

20

x-prev-page

The previous page number.

1

x-request-id

The request ID.

37294673-00CA-5B8B-914F-A8B35511E90A

x-total

The total number of entries.

50

x-total-pages

The total number of pages.

3

Error codes

For API error codes, see Error Code Center.