Help Center/ GeminiDB/ API Reference/ API v3/ Tags/ Adding or Deleting Resource Tags in Batches
Updated on 2026-09-22 GMT+08:00

Adding or Deleting Resource Tags in Batches

Function

This API is used to add tags to or delete tags from a specified DB instance in batches.

Constraints

This API supports the following instances:

  • GeminiDB Cassandra
  • GeminiDB Mongo
  • GeminiDB Influx
  • GeminiDB Redis

A maximum of 20 tags can be added to an instance. The tag key must be unique.

If the request body contains duplicated keys, an error message will be reported when the API is called.

If the key in the request body is the same as an existing key in a specified instance, the value of the value parameter that corresponds to the existing key is overwritten.

If the tag to be deleted does not exist, the operation is considered successful by default. The character set of the tag is not verified during the deletion.

Authorization Information

Each account has permissions to call all APIs, but IAM users must have the required permissions specifically assigned.

  • If you are using role/policy-based authorization, see the required permissions in Permissions and Supported Actions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    gaussdbfornosql:instance:setTags

    tagging

    instance *

    • g:ResourceTag/<tag-key>
    • g:EnterpriseProjectId

    nosql:instance:tag

    -

URI

POST /v3/{project_id}/instances/{instance_id}/tags/action

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID of a tenant in a region. To obtain this value, see Obtaining a Project ID.

Constraints

N/A

Range

The value contains 32 characters. Only letters and digits are allowed.

Default Value

N/A

instance_id

Yes

String

Definition

Instance ID. To obtain the value, call the Querying Instances and Details API. If no instance is available, call the Creating an Instance API to create one.

Constraints

N/A

Range

N/A

Default Value

N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token

You can obtain the token by calling the IAM API by following Obtaining a User Token Through Password Authentication.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

action

Yes

String

Definition

Operation identifier.

Constraints

N/A

Range

  • create: Add tags.
  • delete: Delete tags.

Default Value

N/A

tags

Yes

Array of BatchTagActionTagOption objects

Definition

Tags.

Constraints

N/A

Table 4 BatchTagActionTagOption

Parameter

Mandatory

Type

Description

key

Yes

String

Definition

Tag key.

Constraints

It can contain a maximum of 128 Unicode characters. The key value cannot be null, an empty string, or spaces. Before using key, delete spaces before and after the value. Only digits, uppercase letters, lowercase letters, underscores (_), and hyphens (-) are allowed.

Range

N/A

Default Value

N/A

value

No

String

Definition

Tag value.

Constraints

It can be left blank or contain a maximum of 255 Unicode characters. Only digits, uppercase letters, lowercase letters, underscores (_), periods (.), and hyphens (-) are allowed.

  • If action is set to create, this parameter is mandatory.
  • If action is set to delete, this parameter is optional.
NOTE:

If value is specified, tags are deleted by key and value. If value is not specified, tags are deleted by key.

Range

N/A

Default Value

N/A

Response Parameters

Status code: 200

No response parameters

Example Requests

  • Adding two tags
    POST https://{Endpoint}/v3/375d8d8fad1f43039e23d3b6c0f60a19/instances/9136fd2a9fcd405ea4674276ce36dae8in02/tags/action
    
    {
      "action" : "create",
      "tags" : [ {
        "key" : "key1",
        "value" : "value1"
      }, {
        "key" : "key2",
        "value" : "value2"
      } ]
    }
  • Deleting two tags
    POST https://{Endpoint}/v3/375d8d8fad1f43039e23d3b6c0f60a19/instances/9136fd2a9fcd405ea4674276ce36dae8in02/tags/action
    
    {
      "action" : "delete",
      "tags" : [ {
        "key" : "key1"
      }, {
        "key" : "key2",
        "value" : "value3"
      } ]
    }

Example Responses

Status code: 200

Success

{ }

Status Codes

For details, see Status Codes.

Error Codes

For details, see Error Codes.