You need to enable JavaScript to run this app.
Torch Object Storage

Torch Object Storage

Copy page
Download PDF
Working with objects
Managing object tags
Copy page
Download PDF
Managing object tags
TOS allows you to tag objects for classified management. You can use tags to filter objects when configuring lifecycle rules or replicating objects. This topic provides information about object tags and explains how to use them to manage objects.​
Constraints and limitations​
Each tag is a key-value pair. The following are the tag restrictions:​
​
Category​
Description​
Billing​
The object tagging feature is currently offered free of charge. We will notify you of the charging schedule and billing standards. Please stay tuned.​
Number of tags​
Each object can have up to ten tags, and the key cannot be duplicated for the same object.​
Key-value pair​
  • The key length cannot exceed 128 characters.​
  • The value length cannot exceed 256 characters.​
  • Both the key and the value are case-sensitive. Valid characters include uppercase and lowercase letters, numbers, spaces, and special symbols (_ .: / = + -).​
Others​
  • If you want to set object tags via an HTTP header and the tags contain special characters, both the key and the value must be URL-encoded.​
  • Modifying an object's tags does not update its last modified time.​
  • Object tags are not replicated during cross-region replication or same-region replication.​
​
Use cases​
  • Configuring lifecycle rules with object tags​
  • Example: The latest version of any object tagged with data:image will be deleted if it has not been modified for 120 days.​
  • ​
    {​
    "Rules": [{​
    "ID": "id",​
    "Tags": {​
    "Key": "data",​
    "Value": "image"​
    },​
    "Status": "Enabled",​
    "Expiration": {​
    "Days": "120"​
    }​
    }]​
    }​
    ​
  • Replicating objects with tags​
  • Example: The latest and historical versions of objects tagged with data:image in the source bucket will be replicated to the bucket "Target Bucket Name".​
  • ​
    {​
    "Role": "ServiceRoleforReplicationAccessTOS",​
    "Rules": [{​
    "ID": "1",​
    "Status": "Enabled",​
    "Tags": {​
    "Key": "data",​
    "Value": "image"​
    },​
    "Destination": {​
    "Bucket": "Target Bucket Name",​
    "Location": "cn-beijing",​
    "StorageClass": "STANDARD"​
    },​
    "HistoricalObjectReplication": "Enabled",​
    "AccessControlTranslation": {​
    "Owner": "BucketOwnerEntrusted"​
    }​
    }]​
    }​
    ​
Permissions required​
Before setting object tags, make sure that you have the necessary permissions for object tagging. Only the bucket creator and users with read-write permissions can read or write tags. You can grant these permissions to users through bucket policies. For more information, see Bucket policies. The relevant operations are described as follows:​
  • GetObjectTagging: Retrieves object tags.​
  • PutObjectTagging: Sets object tags.​
  • DeleteObjectTagging: Deletes object tags.​
Adding object tags​
You can add tags to existing objects via the TOS console, or add tags when uploading objects via APIs or SDKs. Follow the steps below to add a tag.​
​
Add tags when uploading objects
Add tags to existing objects
​
You can specify object tags when uploading objects by using the x‑tos‑tagging request header. The supported APIs are as follows:​
​
Editing or deleting object tags​
  1. Log in to the TOS console.​
  1. In the left navigation pane, click Buckets.​
  1. In the top menu bar, select the project of the bucket you want to manage.​
  1. On the Buckets page, click the name of the bucket.​
  1. On the Objects page, select ··· > Edit tags in the Actions column of the object you want to manage.​
  1. In the pop-up window:​
  • Modify the tag information based on your needs.​
  • Or click Delete to remove a tag from the object.​
  1. Save your settings by clicking Save.​
​
​
Last updated: 2026.08.05 10:40:58