Help Center/ CodeArts Repo/ API Reference/ APIs/ V4/ User/ Obtaining the gpg_key List of the Current User
Updated on 2026-01-27 GMT+08:00

Obtaining the gpg_key List of the Current User

Function

This API is used to obtain the gpg_key list of the current user.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

Authorization Information

Each account root user has all the permissions required to call all APIs, but IAM users must be assigned the following required identity policy-based permissions. For details about the required permissions, see Permissions Policies and Supported Actions.

Action

Access Level

Resource Type (*: required)

Condition Key

Alias

Dependencies

codeartsrepo::getUserSetting

Read

-

-

-

-

URI

GET https://{hostURL}/v4/user/gpg-keys

Table 1 Query Parameters

Parameter

Mandatory

Type

Description

query

No

String

Definition

Title of the key.

Range

1–2,000 characters.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token. Obtain one by calling the IAM API Obtaining a User Token. The value of X-Subject-Token in the response header is a token.

Constraints

N/A

Range

1–100,000 characters.

Default Value

N/A

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

id

Integer

Definition

Record ID.

Value range:

1~2147483647

created_at

String

Definition

Creation time.

Range

1–1,000 characters.

emails_with_verified_status

Map<String,Boolean>

Definition

Parsed email address list and whether it takes effect.

fingerprint

String

Definition

Fingerprint format of the primary private/public key.

Range

1–1,000 characters.

key

String

Definition

GPG public key.

Range

1–1,000 characters.

description

String

Definition

Description.

Range

1–1,000 characters.

title

String

Definition

Title of the GPG key.

Range

1–1,000 characters.

primary_keyid

String

Definition

ID of the primary key or public key.

Range

1–1,000 characters.

active

Boolean

Definition

Whether this function takes effect.

subkeys

Array of GpgSubKeyDto objects

Definition

Subkey list.

Range

0–1,000 characters.

Table 4 GpgSubKeyDto

Parameter

Type

Description

id

Integer

Definition

ID of the sub-public key.

Value range:

1~2147483647

fingerprint

String

Definition

Fingerprint format of the sub-public key.

Range

1–1,000 characters.

gpg_key_id

Integer

Definition

gpg_key ID.

Value range:

1~2147483647

keyid

String

Definition:

Subkey ID

Value range:

1–1,000 characters.

Status code: 401

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code.

error_msg

String

Definition

Error message.

Status code: 403

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code.

error_msg

String

Definition

Error message.

Status code: 404

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code.

error_msg

String

Definition

Error message.

Example Requests

GET https://{endpoint}/v4/user/gpg-keys

Example Responses

Status code: 200

Obtain the gpg_key list of the current user.

{
  "id" : 116,
  "created_at" : "2025-04-09T17:37:49.000+08:00",
  "emails_with_verified_status" : {
    "1@email.com" : false
  },
  "fingerprint" : "---",
  "key" : "-----",
  "description" : "---",
  "title" : "test_gpg",
  "primary_keyid" : "---",
  "active" : true,
  "subkeys" : [ {
    "id" : 159,
    "fingerprint" : "---",
    "gpg_key_id" : 116,
    "keyid" : "---"
  } ]
}

Status code: 401

Unauthorized

{
  "error_code" : "DEV.00000003",
  "error_msg" : "Authentication information expired."
}

Status code: 403

Bad Request

{
  "error_code" : "CH.004403",
  "error_msg" : "Insufficient permissions. Apply for the required permissions and try again."
}

Status code: 404

Not Found

{
  "error_code" : "CH.004404",
  "error_msg" : "Group Not Found. Group Not Found"
}

Status Codes

Status Code

Description

200

Obtain the gpg_key list of the current user.

401

Unauthorized

403

Bad Request

404

Not Found

Error Codes

See Error Codes.