Help Center/ Dedicated Host/ API Reference/ API/ DeH Tag Management/ Adding Tags to a DeH in Batches
Updated on 2026-10-22 GMT+08:00

Adding Tags to a DeH in Batches

Function

  • This API is used to add tags to a specified DeH in batches.
  • Tag Management Service (TMS) uses this API to batch add tags to a DeH.

Constraint

  • Each DeH can have a maximum of 20 tags.
  • This API is idempotent.

    During tag creation, if a tag exists (both the key and value are the same as those of an existing tag), the tag is successfully processed by default.

  • A new tag will overwrite the original one if their keys are the same and values are different.

Authorization

Your account has all of the permissions required to call all APIs, but IAM users must have the required permissions specifically assigned. For the specific permissions required, see Introduction.

URI

POST /v1.0/{project_id}/dedicated-host-tags/{dedicated_host_id}/tags/action

Table 1 describes the parameters.

Table 1 Parameter description

Parameter

Type

Mandatory

Description

project_id

String

Yes

Specifies the project ID.

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

dedicated_host_id

String

Yes

Specifies the DeH ID.

You can obtain the value from the DeH console or using the API in Querying DeHs.

Request

Table 2 Request parameters

Parameter

Type

Mandatory

Description

tags

Array of objects

Yes

Specifies the tag list. For details, see Table 3.

action

String

Yes

Specifies the operation. Only lowercase letters are supported. For example, create indicates the creation operation.

Table 3 tag field description

Parameter

Type

Mandatory

Description

key

String

Yes

Specifies the tag key.

  • It can contain a maximum of 128 Unicode characters.
  • It cannot be left blank.
  • It cannot contain the following ASCII characters: =*<>\|/,
  • It cannot start or end with a space.

value

String

Yes

Specifies the tag value.

  • It can contain a maximum of 255 Unicode characters.
  • It cannot contain the following ASCII characters: =*<>\|/,
  • It cannot start or end with a space.

Response

N/A

Example Request

Add two tags to a DeH in a batch. The keys and corresponding values for these two tags are as follows: key1 and value1; key2 and value2.
POST https://{Endpoint}/v1.0/9c53a566cb3443ab910cf0daebca90c4/dedicated-host-tags/74259164-e63a-4ad9-9c77-a1bd2c9aa187/tags/action
{
    "action": "create",
    "tags": [
        {
            "key": "key1",
            "value": "value1"
        },
        {
            "key": "key2",
            "value": "value2"
        }
    ]
}

Example Response

N/A

Status Code

See Status Codes.