Get file details

get
Get file details API

https://api.imagekit.io/v1/files/:fileId/details
Get the file details such as tags, customCoordinates, and isPrivate properties using get file detail API.
Request
Response
Request
Path Parameters
fileId
required
string
The unique fileId of the uploaded file. fileId is returned in list files API and upload API.
Headers
Authorization
required
string
base64 encoding of your_private_api_key: Note the colon in the end.
Response
200: OK
On success, you will get file details in JSON-encoded response body.
{
"fileId" : "598821f949c0a938d57563bd",
"type": "file",
"name": "file1.jpg",
"filePath": "/images/products/file1.jpg",
"tags": ["t-shirt","round-neck","sale2019"],
"isPrivateFile" : false,
"customCoordinates" : null,
"url": "https://ik.imagekit.io/your_imagekit_id/images/products/file1.jpg",
"thumbnail": "https://ik.imagekit.io/your_imagekit_id/tr:n-media_library_thumbnail/images/products/file1.jpg",
"fileType": "image"
}

Response structure and status code (application/JSON)

In case of 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 which 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 case of image, you can use this  path to construct different transformations.

tags

Array of tags associated with the image. If no tags are set, it will be null.

isPrivateFile

Is the file marked as private. It can be either true or false.

customCoordinates

Value of custom coordinates associated with the image in format x,y,width,height. If customCoordinates are not defined then it is null.

url

A publicly accessible URL of the file.

thumbnail

In case of an image, a small thumbnail URL.

fileType

The type of file, it could be either image or non-image.

Examples

Here is the example request to understand the API usage.

cURL
Node.js
Python
PHP
cURL
# The unique fileId of the uploaded file. fileId is returned in response of list files API and upload API.
curl -X GET "https://api.imagekit.io/v1/files/fileId/details" \
-u your_private_api_key:
Node.js
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/"
});
​
imagekit.getFileDetails("fileId", function(error, result) {
if(error) console.log(error);
else console.log(result);
});
Python
from imagekitio import ImageKit
​
imagekit = ImageKit(
private_key='your_public_api_key',
public_key='your_private_api_key',
url_endpoint = 'https://ik.imagekit.io/your_imagekit_id/'
)
​
details = imagekit.get_file_details(file_id)
​
print("File detail-", details, end="\n\n")
PHP
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
);
​
$getFileDetails = $imageKit->getDetails($fileId);
​
echo("File details : " . json_encode($getFileDetails));