Help Center/ AI DataLake/ API Reference/ TMS Management/ Batch Adding Resource Tags
Updated on 2026-11-06 GMT+08:00

Batch Adding Resource Tags

Function

This API is used to batch add tags to a resource. This API is synchronous and has no matching APIs. Duplicate keys are not allowed in the same request. If a key already exists in the database, its value will be overwritten.

Calling Method

For details, see Calling APIs.

URI

POST /v2/{project_id}/{resource_type}/{resource_id}/tags/create

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition: Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

Constraints: N/A

Range: 1 to 36 characters. Only letters, digits, and hyphens (-) are allowed.

Default Value: N/A

resource_type

Yes

String

Definition: Resource type, used to specify the type of resource to be tagged.

Constraints: Cannot be empty.

Range

  • aidatalake-workspace: Workspace.

  • aidatalake-endpoint-ray: Ray engine endpoint.

  • aidatalake-endpoint-aura: Aura engine endpoint.

  • aidatalake-endpoint-spark: Spark engine endpoint.

  • aidatalake-endpoint-flink: Flink engine endpoint.

  • aidatalake-compute: Compute resources.

Default Value: N/A

resource_id

Yes

String

Definition: ID of the resource associated with the tag.

Constraints: Cannot be empty.

Range: 32 to 36 characters. Only letters, digits, and hyphens (-) are allowed.

Default Value: N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition: User token. It is obtained by calling the Obtaining an IAM User Token API.

Constraints: N/A

Range: Up to 65,534 characters. Only letters, digits, and special characters are allowed. The token format is defined by IAM. For details about the character set, see the IAM documentation.

Default Value: N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

tags

No

Array of V2ResourceTag objects

Definition: Tag list in the batch creation request body, where each element is a V2ResourceTag object containing the key (tag key) and value (tag value) fields.

Constraints: Up to 20 tags.

Default Value: N/A

sys_tags

No

Array of SystemTag objects

Definition: System tag list, where each element is a SystemTag object containing the key (system tag key) and value (system tag value) fields.

Constraints: N/A

Table 4 V2ResourceTag

Parameter

Mandatory

Type

Description

key

Yes

String

Definition: Resource tag key.

Constraints: N/A

Range: 1 to 128 characters. Only letters, spaces, digits, underscores (_), periods (.), colons (:), backslashes (), equal signs (=), plus signs (+), minus signs (-), and at signs (@) are allowed.

Default Value: N/A

value

No

String

Definition: Resource tag value.

Constraints: N/A

Range: 0 to 255 characters. Only letters, spaces, digits, underscores (_), periods (.), colons (:), backslashes (), equal signs (=), plus signs (+), minus signs (-), and at signs (@) are allowed.

Default Value: N/A

Table 5 SystemTag

Parameter

Mandatory

Type

Description

key

Yes

String

Definition: System tag key.

Constraints: N/A

Range: _sys_enterprise_project_id

Default Value: N/A

value

Yes

String

Definition: System tag value. Enterprise project ID. For details about how to obtain the enterprise project ID, see Obtaining an Enterprise Project ID.

Constraints: N/A

Range: 1 to 64 characters. Only letters, digits, and hyphens (-) are allowed.

Default Value: N/A

Response Parameters

Status code: 204

Table 6 Response body parameters

Parameter

Type

Description

-

AnyType

Request succeeded.

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Range: 8 to 36 characters.

error_msg

String

Definition: Error description.

Range: 2 to 512 characters.

solution_msg

String

Definition: Solution.

Range: 0 to 4,096 characters.

Status code: 401

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Range: 8 to 36 characters.

error_msg

String

Definition: Error description.

Range: 2 to 512 characters.

solution_msg

String

Definition: Solution.

Range: 0 to 4,096 characters.

Status code: 403

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Range: 8 to 36 characters.

error_msg

String

Definition: Error description.

Range: 2 to 512 characters.

solution_msg

String

Definition: Solution.

Range: 0 to 4,096 characters.

Status code: 404

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Range: 8 to 36 characters.

error_msg

String

Definition: Error description.

Range: 2 to 512 characters.

solution_msg

String

Definition: Solution.

Range: 0 to 4,096 characters.

Status code: 408

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Range: 8 to 36 characters.

error_msg

String

Definition: Error description.

Range: 2 to 512 characters.

solution_msg

String

Definition: Solution.

Range: 0 to 4,096 characters.

Status code: 500

Table 12 Response body parameters

Parameter

Type

Description

error_code

String

Definition: Error code.

Range: 8 to 36 characters.

error_msg

String

Definition: Error description.

Range: 2 to 512 characters.

solution_msg

String

Definition: Solution.

Range: 0 to 4,096 characters.

Example Requests

Batch add tags to resources. The following is an example request.

POST /v2/{project_id}/{resource_type}/{resource_id}/tags/create

{
  "tags" : [ {
    "key" : "key1",
    "value" : "value1"
  } ],
  "sys_tags" : [ {
    "key" : "_sys_enterprise_project_id",
    "value" : "01049549-82cd-4a3e-9f7b-ddb94350c125"
  } ]
}

Example Responses

Status code: 204

None

Status code: 400

{
  "error_code" : "AIDataLake.00010151",
  "error_msg" : "Parameter value is invalid.",
  "solution_msg" : "Please input valid parameter value."
}

Status code: 401

{
  "error_code" : "APIGW.0301",
  "error_msg" : "Incorrect IAM authentication information: decrypt token fail.",
  "solution_msg" : "Check whether the IAM authentication information is correct."
}

Status code: 403

{
  "error_code" : "AIDataLake.00010150",
  "error_msg" : "The operation is not allowed.",
  "solution_msg" : "Check whether the operation is allowed in the current status."
}

Status code: 404

{
  "error_code" : "AIDataLake.00010009",
  "error_msg" : "No resources found.",
  "solution_msg" : "Ensure the requested resource exists and the parameters are correct."
}

Status code: 408

{
  "error_code" : "common.00000408",
  "error_msg" : "timeout exception occurred",
  "solution_msg" : "Try again later. If the problem persists, contact technical support."
}

Status code: 500

{
  "error_code" : "AIDataLake.00011001",
  "error_msg" : "Internal error.",
  "solution_msg" : "Contact technical support or try again later."
}

Status Codes

Status Code

Description

204

Request succeeded.

400

Invalid request parameters.

401

Unauthorized.

403

Access denied.

404

Resource not found.

408

Request timeout.

500

Internal server error.