Update file details
patch
https://api.imagekit.io
/v1/files/:fileId/details
Update file details 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 the file object in JSON-encoded response body.

Examples

cURL
Node.js
Python
PHP
Java
Ruby
1
# The unique fileId of the uploaded file. fileId is returned in response of list files API and upload API.
2
curl -X PATCH "https://api.imagekit.io/v1/files/fileId/details" \
3
-H 'Content-Type: application/json' \
4
-u your_private_key: -d'
5
{
6
"tags": [
7
"image_tag"
8
],
9
"customCoordinates": "10,10,100,100"
10
}
11
'
Copied!
1
var ImageKit = require("imagekit");
2
3
var imagekit = new ImageKit({
4
publicKey : "your_public_api_key",
5
privateKey : "your_private_api_key",
6
urlEndpoint : "https://ik.imagekit.io/your_imagekit_id/"
7
});
8
9
imagekit.updateFileDetails("file_id", {
10
tags : ['image_tag'],
11
customCoordinates : "10,10,100,100"
12
}, function(error, result) {
13
if(error) console.log(error);
14
else console.log(result);
15
});
Copied!
1
from imagekitio import ImageKit
2
3
imagekit = ImageKit(
4
public_key='your_public_api_key',
5
private_key='your_private_api_key',
6
url_endpoint = 'https://ik.imagekit.io/your_imagekit_id/'
7
)
8
9
updated_detail = imagekit.update_file_details(
10
"file_id",
11
{"tags": ["image_tag"], "custom_coordinates": "10,10,100,100"},
12
)
13
14
print("Updated detail-", updated_detail, end="\n\n")
Copied!
1
use ImageKit\ImageKit;
2
3
$public_key = "your_public_api_key";
4
$your_private_key = "your_private_api_key";
5
$url_end_point = "https://ik.imagekit.io/your_imagekit_id";
6
7
$imageKit = new ImageKit(
8
$public_key,
9
$your_private_key,
10
$url_end_point
11
);
12
13
$updateFileDetails = $imageKit->updateFileDetails("file_id", array("tags" => ['image_tag'], "customCoordinates" => "10,10,100,100"));
14
15
echo("Updated detail : " . json_encode($updateFileDetails));
Copied!
1
FileUpdateRequest fileUpdateRequest =new FileUpdateRequest("file_id");
2
List<String> tags=new ArrayList<>();
3
tags.add("image_tag");
4
fileUpdateRequest.setTags(tags);
5
fileUpdateRequest.setCustomCoordinates("10,10,100,100");
6
Result result=ImageKit.getInstance().updateFileDetail(fileUpdateRequest);
Copied!
1
imagekitio = ImageKit::ImageKitClient.new("your_private_key", "your_public_key", "your_url_endpoint")
2
updated_detail = imagekitio.update_file_details(
3
"file_id",
4
{
5
"tags": ['image_tag'],
6
"custom_coordinates": "10,10,100,100"
7
}
8
)
Copied!

Understanding API usage

cURL
Node.js
Python
PHP
Java
Ruby
1
# The unique fileId of the uploaded file. fileId is returned in response of list files API and upload API.
2
curl -X PATCH "https://api.imagekit.io/v1/files/:fileId/details" \
3
-H 'Content-Type: application/json' \
4
-u your_private_key: -d'
5
{
6
"tags": [
7
"image_tag"
8
],
9
"customCoordinates": "10,10,100,100"
10
}
11
'
Copied!
1
var ImageKit = require("imagekit");
2
3
var imagekit = new ImageKit({
4
publicKey : "your_public_api_key",
5
privateKey : "your_private_api_key",
6
urlEndpoint : "https://ik.imagekit.io/your_imagekit_id/"
7
});
8
9
imagekit.updateFileDetails("file_id", {
10
tags : ['image_tag'],
11
customCoordinates : "10,10,100,100"
12
}, function(error, result) {
13
if(error) console.log(error);
14
else console.log(result);
15
});
Copied!
1
from imagekitio import ImageKit
2
3
imagekit = ImageKit(
4
public_key='your_public_api_key',
5
private_key='your_private_api_key',
6
url_endpoint = 'https://ik.imagekit.io/your_imagekit_id/'
7
)
8
9
updated_detail = imagekit.update_file_details(
10
"file_id",
11
{"tags": ["image_tag"], "custom_coordinates": "10,10,100,100"},
12
)
13
14
print("Updated detail-", updated_detail, end="\n\n")
Copied!
1
use ImageKit\ImageKit;
2
3
$public_key = "your_public_api_key";
4
$your_private_key = "your_private_api_key";
5
$url_end_point = "https://ik.imagekit.io/your_imagekit_id";
6
7
$imageKit = new ImageKit(
8
$public_key,
9
$your_private_key,
10
$url_end_point
11
);
12
13
$updateFileDetails = $imageKit->updateFileDetails("file_id", array("tags" => ['image_tag'], "customCoordinates" => "10,10,100,100"));
14
15
echo("Updated detail : " . json_encode($updateFileDetails));
Copied!
1
FileUpdateRequest fileUpdateRequest =new FileUpdateRequest("file_id");
2
List<String> tags=new ArrayList<>();
3
tags.add("image_tag");
4
fileUpdateRequest.setTags(tags);
5
fileUpdateRequest.setCustomCoordinates("10,10,100,100");
6
Result result=ImageKit.getInstance().updateFileDetail(fileUpdateRequest);
Copied!
1
imagekitio = ImageKit::ImageKitClient.new("your_private_key", "your_public_key", "your_url_endpoint")
2
updated_detail = imagekitio.update_file_details(
3
"file_id",
4
{
5
"tags": ['image_tag'],
6
"custom_coordinates": "10,10,100,100"
7
}
8
)
Copied!

Applying extensions

Request

cURL
Node.js
Python
PHP
Ruby
1
# The unique fileId of the uploaded file. fileId is returned in response of list files API and upload API.
2
# Example of using the google-auto-tagging extension
3
curl -X PATCH "https://api.imagekit.io/v1/files/fileId/details" \
4
-H 'Content-Type: application/json' \
5
-u your_private_key: -d'
6
{
7
"extensions": [
8
{
9
"name": "google-auto-tagging",
10
"maxTags": 5,
11
"minConfidence": 95
12
}
13
]
14
}
15
'
Copied!
1
var ImageKit = require("imagekit");
2
3
var imagekit = new ImageKit({
4
publicKey : "your_public_api_key",
5
privateKey : "your_private_api_key",
6
urlEndpoint : "https://ik.imagekit.io/your_imagekit_id/"
7
});
8
9
imagekit.updateFileDetails("file_id", {
10
extensions: [
11
{
12
name: "google-auto-tagging",
13
maxTags: 5,
14
minConfidence: 95
15
}
16
]
17
}, function(error, result) {
18
if(error) console.log(error);
19
else console.log(result);
20
});
Copied!
1
from imagekitio import ImageKit
2
3
imagekit = ImageKit(
4
public_key='your_public_api_key',
5
private_key='your_private_api_key',
6
url_endpoint = 'https://ik.imagekit.io/your_imagekit_id/'
7
)
8
9
updated_detail = imagekit.update_file_details(
10
"file_id",
11
"extensions": [
12
{
13
"name": "google-auto-tagging",
14
"maxTags": 5,
15
"minConfidence": 95
16
}
17
]
18
)
19
20
print("Updated detail-", updated_detail, end="\n\n")
Copied!
1
use ImageKit\ImageKit;
2
3
$public_key = "your_public_api_key";
4
$your_private_key = "your_private_api_key";
5
$url_end_point = "https://ik.imagekit.io/your_imagekit_id";
6
7
$imageKit = new ImageKit(
8
$public_key,
9
$your_private_key,
10
$url_end_point
11
);
12
13
$updateFileDetails = $imageKit->updateFileDetails("file_id", array("extensions" => [array("name" => "google-auto-tagging", "maxTags" => 5, "minConfidence" => 95)]));
14
15
echo("Updated detail : " . json_encode($updateFileDetails));
Copied!
1
imagekitio = ImageKitIo::Client.new("your_private_key", "your_public_key", "your_url_endpoint")
2
updated_detail = imagekitio.update_file_details(
3
file_id: "598821f949c0a938d57563bd", #required
4
extension: [
5
{
6
name: 'google-auto-tagging',
7
maxTags: 5,
8
minConfidence: 95
9
}
10
],
11
custom_coordinates: '10,10,100,200'
12
)
Copied!

Response

1
/*
2
"success" status for google-auto-tagging extension having
3
AITags field synchronously populated.
4
*/
5
{
6
"fileId" : "598821f949c0a938d57563bd",
7
"type": "file",
8
"name": "file1.jpg",
9
"filePath": "/images/products/file1.jpg",
10
"tags": null,
11
"AITags" [
12
{
13
"name": "saree",
14
"confidence": 96.2837328,
15
"source": "google-auto-tagging"
16
},
17
{
18
"name": "traditional clothing",
19
"confidence": 98.3732228,
20
"source": "google-auto-tagging"
21
},
22
{
23
"name": "women's wear",
24
"confidence": 97.7233283,
25
"source": "google-auto-tagging"
26
},
27
{
28
"name": "ethnic",
29
"confidence": 99.9928828,
30
"source": "google-auto-tagging"
31
}
32
]
33
"isPrivateFile" : false,
34
"customCoordinates" : null,
35
"url": "https://ik.imagekit.io/your_imagekit_id/images/products/file1.jpg",
36
"thumbnail": "https://ik.imagekit.io/your_imagekit_id/tr:n-media_library_thumbnail/images/products/file1.jpg",
37
"fileType": "image",
38
"mime": "image/jpeg",
39
"width": 100,
40
"height": 100,
41
"size": 100,
42
"hasAlpha": false,
43
"createdAt": "2019-08-24T06:14:41.313Z",
44
"updatedAt": "2019-08-24T06:14:41.313Z",
45
"extensionStatus": {
46
"google-auto-tagging": "success"
47
}
48
}
Copied!