Last updated: Apr-18-2024
Tags are used to categorize and organize your assets, and can also be used to bulk delete assets, create sprites, ZIP files, JSON lists, and generate PDFs and animated GIFs. A tag is a short name (up to 255 characters) that you can dynamically use (no need to predefine tags). Each asset can be assigned up to 1000 tags.
Adding tags while uploading
You can assign tags to assets while uploading them by also specifying the tags
parameter in the upload method.
For example, uploading the image boots.jpg
and adding the tag shoes
to the image:
Automatically tagging assets
Cloudinary provides various add-ons to help you automatically tag your assets. By providing the auto_tagging
parameter to an upload
or update
call, assets are automatically assigned resource tags based on the detected scene categories. You also set the categorization
parameter to one or more of the following values:
Categorization parameter | Add-on |
---|---|
google_tagging |
Google Auto Tagging |
google_video_tagging |
Google Automatic Video Tagging |
imagga_tagging |
Imagga Auto Tagging |
aws_rek_tagging |
Amazon Rekognition Auto Tagging |
For example, using Google Auto Tagging to automatically tag an uploaded image with all detected categories that have a confidence score higher than 0.6.
The tags method
The tags
method can be used to manage asset tags by setting the value of the command parameter to either add, remove, remove_all, or replace tags. This method accepts two parameters (use an array for multiple values): the tag(s) to add and the public ID(s) of the asset(s) to be tagged. The Cloudinary SDKs wrap the tags method and offer four separate methods:
For example, adding the tag "shoes" to the assets with the public IDs of "slippers" and "boots":
Viewing tags
Assigning tags to assets allows you to create group actions on assets that share the same tag. The resources_by_tag
method of the Admin API returns a list of all assets that share a given tag.
For example, to list all assets that share the tag "shoes":
Monitoring tag changes using a notification URL
You can use Cloudinary notifications to monitor for changes to tags on your media assets, including tags that have been added or removed via API or the Cloudinary Console UI.
To capture these changes, add a Notification URL triggered by the 'Resource tags changed' Notification Type in the Webhook Notifications page of your Console Settings. The notification sent will specify resource_tags_changed
as the notification_type
, and include information about which resource was changed, the source of the change (UI or API), and whether tags were added, removed, or updated. For example:
See the documentation on Notifications for more information.