Updated on 2026-01-05 GMT+08:00

Tag Management

Function

This API is used to tag a resource.

URI

POST /v1/{project_id}/{resource_type}/{resource_id}/tags/action

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain a project ID, see Obtaining the Project ID, Account ID, Log Group ID, and Log Stream ID.

Minimum: 32

Maximum: 32

resource_type

Yes

String

Resource type. The value can be groups (log group) or topics (log stream).

If the resource type is groups, the tag is added to all log streams in the log group by default.

resource_id

Yes

String

Resource ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token obtained from IAM. For details about how to obtain a user token, see Obtaining a User Token.

Minimum: 1

Maximum: 10000

Content-Type

Yes

String

Set this parameter to application/json;charset=UTF-8.

Minimum: 30

Maximum: 30

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

action

Yes

String

Method of adding tags.

Range

  • create

  • delete

is_open

Yes

Boolean

Whether to call external APIs.

tags

Yes

Array of tagsBody objects

Tag field information. Up to 20 tag fields are allowed.

Table 4 tagsBody

Parameter

Mandatory

Type

Description

key

Yes

String

Tag key. Use only UTF-8 letters, digits, spaces, and the following characters: .:=+-@. Do not start with an underscore (). Max 128 characters are allowed.

value

Yes

String

Tag value. Use only UTF-8 letters, digits, spaces, and the following characters: _.:/=+-@. Max 255 characters are allowed.

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 201

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 500

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Requests

  • Create tags.

    POST /v1/2a473356cca5487f8373be891bffc1cf/groups/0933a172-379e-44d0-9ed9-f491b1c528ea/tags/action
    
    {
      "action" : "create",
      "is_open" : true,
      "tags" : [ {
        "key" : "zzz",
        "value" : "zzz"
      }, {
        "key" : "sgq",
        "value" : "123"
      } ]
    }
  • Delete tags.

    POST /v1/2a473356cca5487f8373be891bffc1cf/groups/0933a172-379e-44d0-9ed9-f491b1c528ea/tags/action
    
    {
      "action" : "delete",
      "is_open" : true,
      "tags" : [ {
        "key" : "zzz",
        "value" : "zzz"
      }, {
        "key" : "sgq",
        "value" : "123"
      } ]
    }

Example Responses

Status code: 200

Succeeded.

none

Status code: 201

Succeeded.

none

Status code: 400

Invalid request. Modify the request based on the description in error_msg before a retry.

{
  "error_code" : "LTS.1836",
  "error_msg" : "action is create or delete"
}

Status code: 500

The server has received the request but encountered an internal error.

{
  "error_code" : "LTS.0203",
  "error_msg" : "Internal Server Error"
}

Status Codes

Status Code

Description

200

Succeeded.

201

Succeeded.

400

Invalid request. Modify the request based on the description in error_msg before a retry.

500

The server has received the request but encountered an internal error.

Error Codes

See Error Codes.