Help Center/ CodeArts Repo/ API Reference/ APIs/ SSH Key/ Obtaining the SSH Key List
Updated on 2025-01-14 GMT+08:00

Obtaining the SSH Key List

Function

This API is used to obtain the public key list of CodeArts Repo.

Debugging

You can debug this API in API Explorer. Automatic authentication is supported. API Explorer automatically generates sample SDK code and provides the debug function.

URI

GET /v1/users/sshkey

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Explanation:

User token. It can be obtained by calling the corresponding IAM API. The value of X-Subject-Token in the response header is the user token.

Constraints:

Mandatory

Range:

1–100,000 characters.

Default value:

None

Response Parameters

Table 2 Response body parameters

Parameter

Type

Description

error

Error object

Explanation:

Response error.

Range:

None

result

PublicKeyList object

Explanation:

SSH key list.

status

String

Explanation:

Response status of the API.

Range:

  • success: The API call is successful.
  • failed: The API call failed.
Table 3 PublicKeyList

Parameter

Type

Description

sshkey

Array of PublicKey objects

Explanation:

SSH key list.

total

Integer

Explanation:

Total number of SSH keys.

Range:

0–2147483647

Table 4 Error

Parameter

Type

Description

code

String

Explanation:

Error code returned when the API fails to be called.

Range:

  • CH.10000. The system is busy. Try again later.

message

String

Explanation:

Error message returned when the API fails to be called.

Range:

  • The system is busy. Try again later.
Table 5 PublicKey

Parameter

Type

Description

id

String

Explanation:

Key ID.

Range:

1–40 digits.

key

String

Explanation:

Key, which is uploaded by a user.

Range:

Max. 2,048 digits.

title

String

Explanation:

A custom title set when the SSH key is added.

Range:

Max. 255 characters.

Example Requests

GET https://{endpoint}/v1/users/sshkey

Example Responses

Status code: 200

OK

{
  "result" : {
    "total" : 2,
    "sshkey" : [ {
      "id" : "1015292",
      "title" : "reop1@test.com",
      "key" : "ssh-rsa AAAAB3NzaC1yc2EAAAADAQA*********************************************************Bqa/pE8buOrxri6AWqAky0bmtjSuVf reop1@test.com"
    }, {
      "id" : "1031709",
      "title" : "reop@test.com",
      "key" : "ssh-rsa AAAAB3NzaC1yc2EA*********************************************************U7xcma6HU8nj1E0i46VObWyOONl3gh142BV repo@test.com"
    } ]
  },
  "status" : "success"
}

Error Codes

See Error Codes.