Get file details
get
https://api.imagekit.io
/v1/files/:fileId/details
Get file details API

Response structure and status code (application/JSON)

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

Understanding response

The JSON-encoded response details of the file can have the following properties:
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

Examples

Here is the example request to understand the 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 GET "https://api.imagekit.io/v1/files/fileId/details" \
3
-u your_private_api_key:
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.getFileDetails("fileId", function(error, result) {
10
if(error) console.log(error);
11
else console.log(result);
12
});
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
details = imagekit.get_file_details(file_id)
10
11
print("File detail-", details, 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
$getFileDetails = $imageKit->getDetails($fileId);
14
15
echo("File details : " . json_encode($getFileDetails));
Copied!
1
Result result=ImageKit.getInstance().getFileDetail("fileId");
Copied!
1
imagekitio = ImageKitIo::Client.new("your_private_key", "your_public_key", "your_url_endpoint")
2
imagekitio.get_file_deltails(file_id: 'file_id_xyz')
Copied!
Last modified 1mo ago