> ## Documentation Index
> Fetch the complete documentation index at: https://cloudinary.com/documentation/llms.txt
> Use this file to discover all available pages before exploring further.

# Tags


You can use **tags** to categorize and organize your assets, bulk delete assets, create ZIP files and 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](image_upload_api_reference#upload_method) 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:

```multi
|ruby
Cloudinary::Uploader.upload("boots.jpg", 
  tags: "shoes")

|php_2
$cloudinary->uploadApi()->upload("boots.jpg", 
  ["tags" => "shoes"]);

|python
cloudinary.uploader.upload("boots.jpg", 
  tags = "shoes")

|nodejs
cloudinary.v2.uploader
.upload("boots.jpg", 
  { tags: "shoes" })
.then(result=>console.log(result)); 
                           
|java
cloudinary.uploader().upload(new File("boots.jpg"),
  ObjectUtils.asMap("tags", "shoes"));

|csharp
var uploadParams = new UploadParams(){
  File = new FileDescription(@"boots.jpg"),
  Tags = "shoes"};
var uploadResult = cloudinary.Upload(uploadParams); 

|swift
let params = CLDUploadRequestParams()
  .setTags("shoes")
var mySig = MyFunction(params)  // your own function that returns a signature generated on your backend
params.setSignature(CLDSignature(signature: mySig.signature, timestamp: mySig.timestamp))
let request = cloudinary.createUploader().signedUpload(
  url: "boots.jpg", params: params) 

|go
resp, err := cld.Upload.Upload(ctx, "boots.jpg", uploader.UploadParams{
		Tags: []string{"shoes"}})

|cli
cld uploader upload "boots.jpg" tags="shoes"
```
> **INFO**: The default resource type for most API requests is `image`. When working with videos, remember to explicitly set the `resource_type` to `video`.
> **TIP**:
>
> You can open the asset in your **Media Library** and check the **Metadata** tab in the Preview pane to confirm that the tags you applied during upload appear as expected. For more information, see [Managing assets](media_library_for_developers#managing_assets) on the _Media Library for developers_ page.

## 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` | &nbsp;[Google Auto Tagging](google_auto_tagging_addon) 
`google_video_tagging` | &nbsp;[Google Automatic Video Tagging](google_automatic_video_tagging_addon) 	
`imagga_tagging` | &nbsp;[Imagga Auto Tagging](imagga_auto_tagging_addon) 
`aws_rek_tagging` | &nbsp;[Amazon Rekognition Auto Tagging](aws_rekognition_auto_tagging_addon)  

For example, using [Google Auto Tagging](google_auto_tagging_addon) to automatically tag an uploaded image with all detected categories that have a confidence score higher than 0.6. For videos, you can use the [Google Automatic Video Tagging](google_automatic_video_tagging_addon) add-on in the same way, or [auto-generate tags from dialogue](#auto_generating_tags_for_videos) without an add-on.

```multi
|ruby
Cloudinary::Uploader.upload("ice_skating.jpg", 
  categorization: "google_tagging", auto_tagging: 0.6)

|php_2
$cloudinary->uploadApi()->upload("ice_skating.jpg", 
  ["categorization" => "google_tagging", "auto_tagging" => 0.6]);

|python
cloudinary.uploader.upload("ice_skating.jpg",
  categorization = "google_tagging", auto_tagging = 0.6)

|nodejs
cloudinary.v2.uploader
.upload("ice_skating.jpg", 
  { categorization: "google_tagging", 
    auto_tagging: 0.6 })
.then(result=>console.log(result)); 

|java
cloudinary.uploader().upload("ice_skating.jpg", ObjectUtils.asMap(
  "categorization", "google_tagging", "auto_tagging", "0.6"));

|csharp
var uploadParams = new ImageUploadParams() 
{
  File = new FileDescription(@"ice_skating.jpg"),
  Categorization = "google_tagging",
  AutoTagging = 0.6
};
var uploadResult = cloudinary.Upload(uploadParams);  

|go
resp, err := cld.Upload.Upload(ctx, "ice_skating.jpg", uploader.UploadParams{
		Categorization: "google_tagging",
		AutoTagging:    0.6})

|android
MediaManager.get().upload("ice_skating.jpg")
  .option("categorization", "google_tagging")
  .option("auto_tagging", "0.6").dispatch();

|swift
let params = CLDUploadRequestParams()
  .setCategorization("google_tagging")
  .setAutoTagging(0.6)
var mySig = MyFunction(params)  // your own function that returns a signature generated on your backend
params.setSignature(CLDSignature(signature: mySig.signature, timestamp: mySig.timestamp))
let request = cloudinary.createUploader().signedUpload(
  url: "ice_skating.jpg", params: params) 

|curl
curl https://api.cloudinary.com/v1_1/demo/image/upload -X POST -F 'file=@/path/to/ice_skating.jpg' -F 'categorization=google_tagging' -F 'auto_tagging=0.6' -F 'timestamp=173719931' -F 'api_key=436464676' -F 'signature=a781d61f86a6f818af'

|cli
cld uploader upload "ice_skating.jpg" categorization="google_tagging" auto_tagging=0.6
```

### Auto-generating tags for videos

As an alternative to using a video tagging add-on, you can use the [auto_video_details](image_upload_api_reference#auto_video_details) parameter to automatically generate tags for videos that contain dialogue. This parameter analyzes the video's dialogue and generates relevant tags without requiring an add-on.

For example, uploading a video with `auto_video_details` enabled:

```curl
curl https://api.cloudinary.com/v1_1/demo/video/upload -X POST -F 'file=@/path/to/video.mp4' -F 'auto_video_details=true' -F 'timestamp=173719931' -F 'api_key=436464676' -F 'signature=a781d61f86a6f818af'
```

> **NOTE**: The `auto_video_details` parameter generates tags only for videos with dialogue. It also generates a `Video Title` and `Video Description` as contextual metadata. See [Video titles and descriptions](video_player_customization#ai_generated_titles_and_descriptions) for more information.

## 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: 

* [Add tags](image_upload_api_reference#adding_tags_syntax)
* [Remove tags](image_upload_api_reference#removing_tags_syntax)
* [Remove all tags](image_upload_api_reference#removing_all_tags_syntax)
* [Replace tags](image_upload_api_reference#replacing_tags_syntax)

For example, adding the tags "shoes" and "feet" to the assets with the public IDs of "slippers" and "boots":

```multi
|ruby
Cloudinary::Uploader.add_tag(['shoes', 'feet'], 
  ['slippers', 'boots'])

|php_2
$cloudinary->uploadApi()->addTag(['shoes', 'feet'], 
  ['slippers', 'boots']);

|python
cloudinary.uploader.add_tag(["shoes", "feet"], 
  ["slippers", "boots"])

|nodejs
cloudinary.v2.uploader
.add_tag([ 'shoes', 'feet' ] 
  [ 'slippers', 'boots' ])
.then(result=>console.log(result)); 

|java
cloudinary.uploader().addTag(["shoes", "feet"],
  ["slippers", "boots"], 
  ObjectUtils.emptyMap());

|csharp
var tagParams = new TagParams(){
  PublicIds = new List<string>(){"slippers","boots"},
  Tag = new List<string>(){"shoes","feet"},
  Command = TagCommand.Add};
var tagResult = cloudinary.Tag(tagParams); 

|go
resp, err := cld.Upload.AddTag(ctx, uploader.AddTagParams{
    PublicIDs: []string{"slippers", "boots"}, 
    Tag: []string{"shoes", "feet"})

|cli
cld uploader add_tag 'shoes,feet' 'slippers' 'boots'

|curl
curl https://api.cloudinary.com/v1_1/demo/image/tags -X POST --data 'tag[]=shoes&tag[]=feet&public_ids[]=slippers&public_ids[]=boots&command=add&timestamp=173719931&api_key=436464676&signature=a788d68f86a6f868af'
```

## Viewing tags

Assigning tags to assets allows you to create group actions on assets that share the same tag. The [`resources_by_tag`](admin_api#get_resources_by_tag) method of the [Admin API](admin_api) returns a list of all assets that share a given tag.

For example, to list all assets that share the tag "shoes":

```multi
|ruby
Cloudinary::Api.resources_by_tag("shoes")

|php_2
$api->assetsByTag("shoes");

|python
cloudinary.api.resources_by_tag("shoes")

|nodejs
cloudinary.api
.resources_by_tag("shoes")
.then(result=>console.log(result)); 

|java
api.resourcesByTag("shoes", 
  ObjectUtils.emptyMap());

|csharp
var listResult = cloudinary.ListResourcesByTag("shoes"); 

|go
resp, err := cld.Admin.AssetsByTag(ctx, admin.AssetsByTagParams{
    Tag: "shoes"})

|cli
cld admin resources_by_tag "shoes"
```

> **TIP**: Use the [tags](admin_api#tags) method of the Admin API to retrieve a list of all the tags currently used by all assets in your product environment

## Monitoring tag changes using a notification URL

You can use [Cloudinary notifications](notifications#global_notification_urls) 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](notifications#global_notification_urls) triggered by the 'Resource tags changed' Notification Type in the [Webhook Notifications](https://console.cloudinary.com/app/settings/webhooks) 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:

```json
{
  "notification_type": "resource_tags_changed",
  "source": "ui",
  "resources": [
    {
      "asset_id": "c1ba6db0044a3d5778353080e838f616",
      "public_id": "sample",
      "resource_type": "image",
      "type": "upload",
      "added": [
        "flower"
      ]
    }
  ],
  "notification_context": {
    "triggered_at": "2022-11-17T09:07:50.766353Z",
    "triggered_by": {
      "source": "ui",
      "id": "john@doe.com"
    }
  }
}
```

See the documentation on [Notifications](notifications) for more information.

