Help Center/ Cloud Backup and Recovery/ API Reference/ CBR APIs/ Tags/ Adding a Tag to an Associated Resource
Updated on 2025-09-10 GMT+08:00

Adding a Tag to an Associated Resource

Function

A resource can have a maximum of 10 tags. (A maximum of 20 tags can be added to a resource in the region that supports Landing Zone.)

This API is idempotent. If a to-be-added tag has the same key as an existing tag, the tag will be added and will overwrite the existing tag.

URI

POST /v3/{project_id}/vault/{vault_id}/tags

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID

vault_id

Yes

String

Resource ID

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

tag

No

Tag object

Tags

Table 3 Tag

Parameter

Mandatory

Type

Description

key

Yes

String

Key

It can contain a maximum of 36 characters.

It cannot be an empty string.

Spaces before and after a key will be discarded.

It cannot contain non-printable ASCII characters (0–31) and the following characters: =*<>,|/

It can contain only letters, digits, hyphens (-), and underscores (_).

value

Yes

String

Value

It is mandatory when a tag is added and optional when a tag is deleted.

It can contain a maximum of 43 characters.

It can be an empty string.

Spaces before and after a value will be discarded.

It cannot contain non-printable ASCII characters (0–31) and the following characters: =*<>,|/

It can contain only letters, digits, hyphens (-), underscores (_), and periods (.).

Response Parameters

Status code: 204

No Content

Status code: 400

Table 4 Response body parameters

Parameter

Type

Description

error_code

String

For details, see Error Codes.

error_msg

String

Error message

Example Requests

Example request

POST https://{endpoint}/v3/{project_id}/vault/{vault_id}/tags

{
  "tag" : {
    "key" : "key1",
    "value" : "key2"
  }
}

Example Responses

None

Status Codes

Status Code

Description

204

No Content

400

Bad Request

Error Codes

See Error Codes.