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 updated file details in JSON-encoded response body.

Understanding response

Property name
Description
fileId
The unique fileId of the uploaded file.
type
Type of item. It can be either file or folder.
name
Name of the file or folder.
filePath
The relative path of the file. In the case of an image, you can use this path to construct different transformations.
tags
The array of tags associated with the image. If no tags are set, it will be null.
AITags
Array of AITags associated with the image. If no AITags are set, it will be null. These tags can be added using the google-auto-tagging or aws-auto-tagging extensions.
isPrivateFile
Is the file marked as private. It can be either true or false.
customCoordinates
Value of custom coordinates associated with the image in the format x,y,width,height. If customCoordinates are not defined, then it is null.
url
A publicly accessible URL of the file.
thumbnail
In the case of an image, a small thumbnail URL.
fileType
The type of file could be either image or non-image.
mime
MIME Type of the file. For example - image/jpeg
height
Height of the image in pixels (Only for images)
width
Width of the image in pixels (Only for Images)
size
Size of the image file in Bytes
hasAlpha
A boolean indicating if the image has an alpha layer or not.
customMetadata
A key-value data associated with the asset. Before setting any custom metadata on an asset, you have to create the field using custom metadata fields API.
createdAt
The date and time when the file was first uploaded. The format is YYYY-MM-DDTHH:mm:ss.sssZ
updatedAt
The date and time when the file was last updated. The format is YYYY-MM-DDTHH:mm:ss.sssZ
extensionStatus
Extension names with their processing status at the time of completion of the request. It could have one of the following status values:
  • success: The extension has been successfully applied.
  • failed: The extension has failed and will not be retried.
  • pending: The extension will finish processing in some time. On completion, the final status (success / failed) will be sent to the webhookUrl provided.
If no extension was requested, then this parameter is not returned.

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 = ImageKit::ImageKitClient.new("your_private_key", "your_public_key", "your_url_endpoint")
2
updated_detail = imagekitio.update_file_details(
3
"file_id",
4
{
5
"extensions": [
6
{
7
"name": "google-auto-tagging",
8
"maxTags": 5,
9
"minConfidence": 95
10
}
11
]
12
}
13
)
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!
Last modified 27d ago