Help Center/ CodeArts Repo/ API Reference/ APIs/ V4/ ProtectedRefs/ Creating a Protection Tag for a Project
Updated on 2026-04-28 GMT+08:00

Creating a Protection Tag for a Project

Function

This API is used to create a protected tag under a project.

Debugging

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

URI

POST https://{hostURL}/v4/projects/{project_id}/protected-tags

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition:

You can obtain the unique project identifier, 32-character UUID, by calling the API used to query the project list.

Value range:

32 characters

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

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

Constraints

Mandatory.

Range

1–100,000 characters.

Default Value

N/A.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

name

Yes

String

Definition:

Protected tag name

Value range

1–1,000 characters.

actions

No

Array of ProjectProtectedTagActionDto objects

Definition:

Event list

Table 4 ProjectProtectedTagActionDto

Parameter

Mandatory

Type

Description

action

No

String

Definition:

Event name

** Value range: read (query); create-delete (create and delete); create (create)**

1–1,000 characters.

Enumeration values:

  • read

  • create-delete

  • create

enable

No

Boolean

Definition:

Enabled or not

user_ids

No

Array of integers

Definition:

User ID list

Constraints:

N/A

Value range:

Integer

Default value:

N/A

Value range:

1~2147483647

user_names

No

Array of strings

Definition:

User name list

Constraints:

N/A

Value range:

N/A

Default value:

N/A

user_team_ids

No

Array of integers

Definition:

Member group ID list

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Value range:

1~2147483647

user_team_names

No

Array of strings

Definition:

Member group name list

Constraints:

N/A

Value range:

N/A

Default value:

N/A

related_role_ids

No

Array of strings

Definition:

Associated role ID list

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

name

String

Definition:

Protected tag name

Value range

1–1,000 characters.

actions

Array of ProjectProtectedTagActionDto objects

Definition:

Event list

Table 6 ProjectProtectedTagActionDto

Parameter

Type

Description

action

String

Definition:

Event name

** Value range: read (query); create-delete (create and delete); create (create)**

1–1,000 characters.

Enumeration values:

  • read

  • create-delete

  • create

enable

Boolean

Definition:

Enabled or not

user_ids

Array of integers

Definition:

User ID list

Constraints:

N/A

Value range:

Integer

Default value:

N/A

Value range:

1~2147483647

user_names

Array of strings

Definition:

User name list

Constraints:

N/A

Value range:

N/A

Default value:

N/A

user_team_ids

Array of integers

Definition:

Member group ID list

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Value range:

1~2147483647

user_team_names

Array of strings

Definition:

Member group name list

Constraints:

N/A

Value range:

N/A

Default value:

N/A

related_role_ids

Array of strings

Definition:

Associated role ID list

Constraints:

N/A

Value range:

N/A

Default value:

N/A

Example Requests

The protected tag created under the project

PUT https://{endpoint}/v4/projects/{project_id}/protected-tags

{
  "name" : "123",
  "actions" : [ {
    "action" : "create",
    "enable" : true,
    "user_ids" : [ 9124 ],
    "user_team_ids" : [ 247 ],
    "related_role_ids" : [ "6115a3ddd9044e288c558d1ae827a732", "8425999e92974f2980b76b08ad423aa1", "f2464b129b064a6a988734a73c3f366b", "24f72d0b611746c3a43da596ea5065f5" ]
  }, {
    "action" : "read",
    "enable" : true,
    "user_ids" : [ 9124 ],
    "user_team_ids" : [ 247 ],
    "related_role_ids" : [ "6115a3ddd9044e288c558d1ae827a732", "8425999e92974f2980b76b08ad423aa1", "f2464b129b064a6a988734a73c3f366b", "24f72d0b611746c3a43da596ea5065f5" ]
  } ]
}

Example Responses

Status code: 200

Details about the protected tag of the created project

{
  "name" : "123",
  "actions" : [ {
    "action" : "create",
    "enable" : true,
    "user_ids" : [ 9124 ],
    "user_names" : [ ],
    "user_team_ids" : [ 247 ],
    "user_team_names" : [ ],
    "related_role_ids" : [ "6115a3ddd9044e288c558d1ae827a732", "8425999e92974f2980b76b08ad423aa1", "f2464b129b064a6a988734a73c3f366b", "24f72d0b611746c3a43da596ea5065f5" ]
  } ]
}

Status Codes

Status Code

Description

200

Details about the protected tag of the created project

Error Codes

See Error Codes.