Links

Add tags (bulk)

post
https://api.imagekit.io
/v1/files/addTags
Add tags in bulk API

Response structure and status code

In case of an error, you will get an error code along with the error message. On success, you will receive a 200 status code with an array of successfully updated fileIds.

Examples

Here is the example request to understand the API usage.
cURL
Node.js
Python
PHP
Java
Ruby
Go
.Net
curl -X POST "https://api.imagekit.io/v1/files/addTags" \
-H 'Content-Type: application/json' \
-u your_private_key: -d '
{
"fileIds" : [
"file_id_1",
"file_id_2"
],
"tags" : [
"tag1",
"tag2"
]
}
'
var ImageKit = require("imagekit");
​
var imagekit = new ImageKit({
publicKey : "your_public_api_key",
privateKey : "your_private_api_key",
urlEndpoint : "https://ik.imagekit.io/your_imagekit_id/"
});
​
var fileIds = ["file_id_1", "file_id_2"];
var tags = ["tag1", "tag2"];
​
imagekit.bulkAddTags(fileIds, tags, function(error, result) {
if(error) console.log(error);
else console.log(result);
});
from imagekitio import ImageKit
​
imagekit = ImageKit(
public_key='your_public_api_key',
private_key='your_private_api_key',
url_endpoint = 'https://ik.imagekit.io/your_imagekit_id/'
)
​
tags = imagekit.add_tags(file_ids=['file-id-1', 'file-id-2'], tags=['tag1', 'tag2'])
​
print("Add tags-", tags, end="\n\n")
​
# Raw Response
print(tags.response_metadata.raw)
​
# list successfully updated file ids
print(tags.successfully_updated_file_ids)
​
# print the first file's id
print(tags.successfully_updated_file_ids[0])
use ImageKit\ImageKit;
​
$public_key = "your_public_api_key";
$your_private_key = "your_private_api_key";
$url_end_point = "https://ik.imagekit.io/your_imagekit_id";
​
$imageKit = new ImageKit(
$public_key,
$your_private_key,
$url_end_point
);
​
$fileIds = [
"file_id_1",
"file_id_2"
];
​
$tags = [
"tag1",
"tag2"
];
​
$bulkAddTags = $imageKit->bulkAddTags($fileIds, $tags);
​
echo("Add Tags (Bulk) : " . json_encode($bulkAddTags));
List<String> fileIds = new ArrayList<>();
fileIds.add("file_id_1");
fileIds.add("file_id_2");
List<String> tags = new ArrayList<>();
tags.add("tag1");
tags.add("tag2");
TagsRequest tagsRequest =new TagsRequest();
tagsRequest.setFileIds(fileIds);
tagsRequest.setTags(tags);
ResultTags resultTags = ImageKit.getInstance().addTags(tagsRequest);
imagekitio = ImageKitIo::Client.new("your_private_key", "your_public_key", "your_url_endpoint")
imagekitio.add_bulk_tags(
file_ids: [
"file_id_1",
"file_id_2"
],
tags: [
"tag1",
"tag2"
]
)
resp, err := ik.Media.AddTags(ctx, media.TagsParam{
FileIds: []string{"file_id_1", "file_id_2"},
Tags: []string{"tag1", "tag2"},
})
var imagekit = new ImageKit({
publicKey : "your_public_api_key",
privateKey : "your_private_api_key",
urlEndpoint : "https://ik.imagekit.io/your_imagekit_id/"
});
TagsRequest tagsRequest = new TagsRequest
{
tags = new List<string>
{
"tag1",
"tag2"
},
fileIds = new List<string>
{
"file_id_1","file_id_2"
},
};
ResultTags resultTags = imagekit.AddTags(tagsRequest);