List and search files
get
https://api.imagekit.io
/v1/files
List and search file API

Advanced search queries

The searchQuery parameter can be used to apply advanced filters to your search.

Basic examples

Basic usage
Using AND/OR operator
Grouping multiple queries
You can query based on a single field. For example:
1
createdAt > "7d"
Copied!
This will return all files which are created in the last 7 days.
You can combine multiple conditions using the AND and OR operators. For example:
1
createdAt > "7d" AND name: "file-name"
Copied!
This will return all files created within the last 7 days with name starting with file-name.
You can use parenthesis ( and ) to group multiple queries and create complex search filters. For example:
1
(size < "1mb" AND width > 500) OR (tags IN ["summer-sale","banner"])
Copied!

Search based on file and folder names

For example, let's say you have uploaded two files, red-dress-summer.jpg and red-dress-winter.jpg in the media library.
The name match is case-sensitive.
Exact match
Begins with match
To find a file or folder using the exact name, use the = operator. For example:
1
name = "red-dress-summer.jpg"
Copied!
This will only return the file with the name red-dress-summer.jpg.
To find a file or folder using a prefix, you can use : operator. For example:
1
name : "red-dress"
Copied!
This will return both red-dress-summer.jpg and red-dress-winter.jpg.

Search based on upload date

You can filter using createdAt and updatedAt to search based on the first uploaded or last modified time.
createdAt and updatedAt accept ISO 8601 format string or relative unit.
ISO 8601 format
Relative units
The API supports a string in the ISO 8601 format.
  • YYYY-MM-DD - When no time is provided, it is set to 00:00:00 UTC by default.
  • YYYY-MM-DDTHH:MM:SS
For example:
1
createdAt < 2020-01-01
2
createdAt < "2020-01-01T12:12:12"
Copied!
The API supports relative time units, e.g.
  • 1h - one hour in the past
  • 2d - two days in the past
  • Similarly 3w, 4m, etc.
Example usage:
1
createdAt < 2d (createdAt should be before two days ago)
2
createdAt < 2w (createdAt should be before two weeks ago)
3
createdAt < 2m (createdAt should be before two months ago)
4
createdAt < 2y (createdAt should be before two years ago)
Copied!

Search based on custom metadata or embedded metadata values

In your search query, you can use custom metadata and embedded metadata fields.
Every embedded metadata field must be prefixed with 'embeddedMetadata' and a period, and it must be enclosed within double quotes. For example, "embeddedMetadata.Keywords" IN ["black"]
Every custom metadata field must be prefixed with 'customMetadata' and a period, and it must be enclosed within double-quotes. For example, "customMetadata.description" IN ["black"]
Refer to the supported parameters table to see which embedded metadata values are supported and the corresponding supported operators and examples. The table also specifies the supported operators and examples corresponding to each custom metadata type.

Supported parameters

Field
Supported Operators
Examples
name
  • =
  • :
  • IN
  • NOT =
  • NOT IN
Accepts a string value in quotes. For example:
name = "red-dress.jpg" will return all files & folders with the exact name red-dress.jpg.
name: "red-dress" will return all files & folders
with a name starting with red-dress.
name IN ["red-dress.jpg", "red-dress.png"] will return
all files & folders with the name either red-dress.jpg or
red-dress.png.
name NOT = "red-dress.jpg" will return all files and folders
with a name other than red-dress.jpg.
tags
  • IN
  • NOT IN
Accepts an array of string values.
tags IN ["summer-collection", "sale"] will return all files that have either summer-collection or sale inside either the tags array or the AITags array.
tags NOT IN ["big-banner"] will return all files that do not have big-banner inside neither the tags array nor the AITags array.
type
  • =
  • IN
  • NOT =
  • NOT IN
Possible values are file or folder in quotes or in the array.
type = "file" will only return files in the search result.
type = "folder" will only return folders in the search result.
type IN ["file", "folder"] will return both files and folders in the search result.
createdAt
  • =
  • <
  • <=
  • >
  • >=
  • IN
  • NOT =
  • NOT IN
Accepts a string value in ISO 8601 format or relative time units e.g 1h, 2d, 3w, or 4m.
createdAt > "2020-01-01" will return all files first uploaded after 1 Jan 2020 at 00:00 hours in UTC.
createdAt > "2020-01-01T12:12:12" will return all files first uploaded after 1 Jan 2020 12:12:12 hours in UTC.
createdAt > "7d" will return all files first uploaded in the last 7 days.
updatedAt
  • =
  • <
  • <=
  • >
  • >=
  • IN
  • NOT =
  • NOT IN
Accepts a string value in ISO 8601 format or relative time units e.g 1h, 2d, 3w, or 4m.
updatedAt > "2020-01-01" will return all files last modified after 1 Jan 2020 at 00:00 hours in UTC.
updatedAt > "2020-01-01T12:12:12" will return all files last modified after 1 Jan 2020 12:12:12 hours in UTC.
updatedAt > "7d" will return all files last modified in the last 7 days.
height
  • =
  • <
  • <=
  • >
  • >=
  • IN
  • NOT =
  • NOT IN
Accepts a numeric value e.g. 500, 200 etc. This is only applicable for image-type assets.
height > 200 will return all image files with a height greater than 200px.
height <= 400 will return all image files with a height less than or equal to 400px.
width
  • =
  • <
  • <=
  • >
  • >=
  • IN
  • NOT =
  • NOT IN
Accepts a numeric value e.g. 500, 200 etc. This is only applicable for image-type assets.
width > 200 will return all image files with a width greater than 200px.
width <= 400 will return all image files with a width less than or equal to 400px.
size
  • =
  • <
  • <=
  • >
  • >=
  • IN
  • NOT =
  • NOT IN
Accepts a numeric value e.g. 500, 200 or string e.g. 1mb, 10kb etc.
size > 1024 will return all assets with a file size greater than 1024 bytes.
size <= "1mb" will return all assets with a file size less than or equal to 1MB.
format
  • =
  • IN
Accepts a string value. Allowed values are jpg, webp, png, gif, svg, avif, pdf, js, woff2, woff, ttf, otf, eot, css, txt, mp4, webm, mov, swf, ts, m3u8, ico.
format = "jpg" will return all JPG image files.
private
  • =
Accepts a boolean value i.e. true or false without quotes.
private = true will return all files marked as private during upload.
transparency
  • =
Accepts a boolean value i.e. true or false without quotes. This is only applicable to images.
transparency = true will return all image files that have an alpha layer. However, the presence of the alpha layer does not guarantee transparency if all pixels in the alpha layer have the value 1.
embeddedMetadata.LocationTaken
  • =
Accepts a location value in one of the supported types:
  • "40,100 5km" - Returns items that are within a 5 km distance from the specified coordinate
  • "40,100|50,105" - Returns items that are inside the square whose diagonal is the line made by the two specified points
  • "0,0|0,100|40,100|40,0" - Returns items that are inside the rectangle whose vertices are the four specified points.
Note: All coordinates are in the format latitude,longitude
embeddedMetadata.Keywords
  • IN
  • NOT IN
Accepts an array of string values.
"embeddedMetadata.Keywords" IN ["luxury", "dress"] will return all files that have either luxury or dress as one of the values in its Keywords field.
"embeddedMetadata.Keywords" NOT IN ["big-banner"] will return all files that do not have big-banner as one of the values in its Keywords field.
embeddedMetadata.DateTimeOriginal
  • =
  • <
  • <=
  • >
  • >=
  • IN
  • NOT =
  • NOT IN
Accepts a string value in ISO 8601 format or relative time units e.g 1h, 2d, 3w, or 4m.
"embeddedMetadata.DateTimeOriginal" > "2020-01-01" will return all files with a value later than 1 Jan 2020 at 00:00 hours in UTC.
"embeddedMetadata.DateTimeOriginal" > "2020-01-01T12:12:12" will return all files with a value later than 1 Jan 2020 12:12:12 hours in UTC.
"embeddedMetadata.DateTimeOriginal" > "7d" will return all files with a value that lies in the last 7 days.
Custom metadata Text type field
  • =
  • :
  • IN
  • NOT =
  • NOT IN
Accepts a string value in quotes. For example:
"customMetadata.description" = "black cars" will return all files & folders with the description custom field exactly equal to black cars.
"customMetadata.description": "red" will return all files & folders with the description custom field starting with red.
"customMetadata.description" IN ["red cars", "black cars"] will return all files & folders with the description custom field either red cars or
black cars.
"customMetadata.description" NOT = "red dress" will return all files and folders
with the description custom field other than red dress.
Custom metadata Textarea type field
  • =
  • :
  • IN
  • NOT =
  • NOT IN
Accepts a string value in quotes. For example:
"customMetadata.longDescription": "luxury" will return all files & folders with the longDescription custom field starting with luxury.
Custom metadata Date type field
  • =
  • <
  • <=
  • >
  • >=
  • IN
  • NOT =
  • NOT IN
Accepts a string value in ISO 8601 format or relative time units e.g 1h, 2d, 3w, or 4m.
"customMetadata.purchaseDate" > "2020-01-01" will return all files with a purchaseDate value later than 1 Jan 2020 at 00:00 hours in UTC.
"customMetadata.purchaseDate" > "2020-01-01T12:12:12" will return all files with a purchaseDate value later than 1 Jan 2020 12:12:12 hours in UTC.
"customMetadata.purchaseDate" > "7d" will return all files with a purchaseDate value that lies in the last 7 days.
Custom metadata Number type field
  • =
  • <
  • <=
  • >
  • >=
  • IN
  • NOT =
  • NOT IN
Accepts a numeric value e.g. 500, 200.125 , etc.
"customMetadata.quantitySold" > 200 will return all items with a quantitySold value greater than 200.
"customMetadata.quantitySold" <= 400 will return all items with a quantitySold value less than or equal to 400.
Custom metadata Boolean type field
  • =
Accepts a boolean value i.e. true or false without quotes.
"customMetadata.active" = true will return all items with an active value equal to true.
Custom metadata SingleSelect type
  • =
  • :
  • IN
  • NOT =
  • NOT IN
  • >
  • >=
  • <
  • <=
Accepts boolean, numeric, or string values.
"customMetadata.rating" = "excellent" will return all files with a rating value equal to excellent
"customMetadata.rating" > 4.3 will return all files that have a numeric rating value that is greater than 4.3
Note: certain operators will be valid only for certain types of values. For example, the >= operator will be valid only for numeric values.
Custom metadata MultiSelect type
  • IN
  • NOT IN
Accepts an array of boolean, numeric, or string values.
"customMetadata.tuple" IN ["luxury", 500, true] will return all files that have either luxury or 500 or true as one of the values in its tuples field.
"customMetadata.tuples" NOT IN ["big-banner"] will return all files that do not have big-banner as one of the values in its tuples field.

Understanding response

In case of an error, you will get an error code along with the error message. You will receive a 200 status code with the list of files in the JSON-encoded response body on success.
The JSON-encoded response has an array of items. Each item 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 are some example requests to understand the API usage.

Fetch 10 files uploaded in the media library

Fetch the first 10 files uploaded in the media library. To change the order, you can use sort option.
cURL
Node.js
Python
PHP
Java
Ruby
1
curl -X GET 'https://api.imagekit.io/v1/files?skip=0&limit=10' \
2
-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.listFiles({
10
skip : 0,
11
limit : 10
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
list_files = imagekit.list_files({"skip": 0, "limit": 10})
10
​
11
print("List files-", "\n", list_files)
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
$listFiles = $imageKit->listFiles(array(
14
"skip" => 0,
15
"limit" => 10,
16
));
17
​
18
echo ("List files : " . json_encode($listFiles));
Copied!
1
Map<String , String> options=new HashMap<>();
2
options.put("skip","0");
3
options.put("limit", "10");
4
ResultList resultList=ImageKit.getInstance().getFileList(options);
Copied!
1
imagekitio = ImageKitIo::Client.new("your_private_key", "your_public_key", "your_url_endpoint")
2
list_files = imagekitio.list_files({skip: 0, limit: 5})
Copied!

Advance search using searchQuery

List all files uploaded in the last 7 days with a file size greater than 2MB. We will use the following value for searchQuery parameter.
createdAt >= "7d" AND size > "2mb"
cURL
Node.js
Python
PHP
Java
Ruby
1
curl -X GET 'https://api.imagekit.io/v1/files' \
2
-G --data-urlencode "searchQuery=createdAt >= \"7d\" AND size > \"2mb\"" \
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.listFiles({
10
searchQuery : 'createdAt >= "7d" AND size > "2mb"'
11
}, function(error, result) {
12
if(error) console.log(error);
13
else console.log(result);
14
});
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
list_files = imagekit.list_files({'searchQuery': 'createdAt >= "7d" AND size > "2mb"'})
10
​
11
print("List files-", "\n", list_files)
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
$listFiles = $imageKit->listFiles(array(
14
"searchQuery" => 'createdAt >= "7d" AND size > "2mb"',
15
));
16
​
17
echo ("List files : " . json_encode($listFiles));
Copied!
1
Map<String , String> options=new HashMap<>();
2
options.put("searchQquery",'createdAt >= "7d" AND size > "2mb"');
3
ResultList resultList=ImageKit.getInstance().getFileList(options);
Copied!
1
imagekitio = ImageKitIo::Client.new("your_private_key", "your_public_key", "your_url_endpoint")
2
list_files = imagekitio.list_files({search_query: 'createdAt >= "7d" AND size > "2mb"'})
Copied!
List all files belonging to the clothing or accessories categories using a custom metadata field called category. The custom metadata schema for this field must have been defined first.
"customMetadata.category IN ["clothing", "accessories"]"
cURL
Node.js
Python
PHP
Java
Ruby
1
curl -X GET 'https://api.imagekit.io/v1/files' \
2
-G --data-urlencode "searchQuery=\"customMetadata.category\" IN [\"clothing\", \"accessories\"]" \
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.listFiles({
10
searchQuery : '"customMetadata.category" IN ["clothing", "accessories"]"'
11
}, function(error, result) {
12
if(error) console.log(error);
13
else console.log(result);
14
});
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
list_files = imagekit.list_files({'searchQuery': '"customMetadata.category" IN ["clothing", "accessories"]"'})
10
​
11
print("List files-", "\n", list_files)
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
$listFiles = $imageKit->listFiles(array(
14
"searchQuery" => '"customMetadata.category" IN ["clothing", "accessories"]"',
15
));
16
​
17
echo ("List files : " . json_encode($listFiles));
Copied!
1
Map<String , String> options=new HashMap<>();
2
options.put("searchQquery",'"customMetadata.category" IN ["clothing", "accessories"]"');
3
ResultList resultList=ImageKit.getInstance().getFileList(options);
Copied!
1
imagekitio = ImageKitIo::Client.new("your_private_key", "your_public_key", "your_url_endpoint")
2
list_files = imagekitio.list_files({search_query: '"customMetadata.category" IN ["clothing", "accessories"]"'})
Copied!
List all files with a DateTimeOriginal value later than one year ago by using the embeddedMetadata.DateTimeOriginal field. i.e. all files that were originally created within the last one year.
"embeddedMetadata.DateTimeOriginal" > "1y"
cURL
Node.js
Python
PHP
Java
Ruby
1
curl -X GET 'https://api.imagekit.io/v1/files' \
2
-G --data-urlencode "searchQuery=\"embeddedMetadata.DateTimeOriginal\" > \"1y\"" \
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.listFiles({
10
searchQuery : '"embeddedMetadata.DateTimeOriginal" > "1y"'
11
}, function(error, result) {
12
if(error) console.log(error);
13
else console.log(result);
14
});
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
list_files = imagekit.list_files({'searchQuery': '"embeddedMetadata.DateTimeOriginal" > "1y"'})
10
​
11
print("List files-", "\n", list_files)
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
$listFiles = $imageKit->listFiles(array(
14
"searchQuery" => '"embeddedMetadata.DateTimeOriginal" > "1y"',
15
));
16
​
17
echo ("List files : " . json_encode($listFiles));
Copied!
1
Map<String , String> options=new HashMap<>();
2
options.put("searchQquery",'"embeddedMetadata.DateTimeOriginal" > "1y"');
3
ResultList resultList=ImageKit.getInstance().getFileList(options);
Copied!
1
imagekitio = ImageKitIo::Client.new("your_private_key", "your_public_key", "your_url_endpoint")
2
list_files = imagekitio.list_files({search_query: '"embeddedMetadata.DateTimeOriginal" > "1y"'})
Copied!

Search media library files by name

List all files with filename file-name.jpg. We will use the following value of thesearchQuery parameter. The match is always case-sensitive.
name="file-name.jpg"
cURL
Node.js
Python
PHP
Java
Ruby
1
curl -X GET 'https://api.imagekit.io/v1/files' \
2
-G --data-urlencode "searchQuery=name=\"file-name.jpg\"" \
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.listFiles({
10
searchQuery : 'name="file-name.jpg"'
11
}, function(error, result) {
12
if(error) console.log(error);
13
else console.log(result);
14
});
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
list_files = imagekit.list_files({'searchQuery': 'name="file-name.jpg"'})
10
​
11
print("List files-", "\n", list_files)
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
$listFiles = $imageKit->listFiles(array(
14
"searchQuery" => 'name="file-name.jpg"',
15
));
16
​
17
echo ("List files : " . json_encode($listFiles));
Copied!
1
Map<String , String> options=new HashMap<>();
2
options.put("searchQquery",'name="file-name.jpg"');
3
ResultList resultList=ImageKit.getInstance().getFileList(options);
Copied!
1
imagekitio = ImageKitIo::Client.new("your_private_key", "your_public_key", "your_url_endpoint")
2
list_files = imagekitio.list_files({search_query: 'name="file-name.jpg"'})
Copied!

List files within a specific folder

List all files at a specific location.
When using path parameter, the search is limited to only one level. The files within nested folders are not returned.
cURL
Node.js
Python
PHP
Java
Ruby
1
curl -X GET "https://api.imagekit.io/v1/files?path=products" \
2
-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.listFiles({
10
path : "products"
11
}, function(error, result) {
12
if(error) console.log(error);
13
else console.log(result);
14
});
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
list_files = imagekit.list_files({"path": "products"})
10
​
11
print("List files-", "\n", list_files)
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
$listFiles = $imageKit->listFiles(array(
14
"path" => "products",
15
));
16
​
17
echo ("List files : " . json_encode($listFiles));
Copied!
1
Map<String , String> options=new HashMap<>();
2
options.put("path","products");
3
ResultList resultList=ImageKit.getInstance().getFileList(options);
Copied!
1
imagekitio = ImageKitIo::Client.new("your_private_key", "your_public_key", "your_url_endpoint")
2
list_files = imagekitio.list_files({path: "products"})
Copied!

Simple search files by tags without using searchQuery

This will list all the files which have either sale or summer tag.
cURL
Node.js
Python
PHP
Java
Ruby
1
curl -X GET 'https://api.imagekit.io/v1/files?tags=sale,summer' \
2
-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.listFiles({
10
tags : ["sale","summer"]
11
}, function(error, result) {
12
if(error) console.log(error);
13
else console.log(result);
14
});
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
list_files = imagekit.list_files({"tags": ["sale","summer"]})
10
​
11
print("List files-", "\n", list_files)
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
$listFiles = $imageKit->listFiles(array(
14
"tags" => implode(",", array("sale", "summer")),
15
));
16
​
17
echo ("List files : " . json_encode($listFiles));
Copied!
1
Map<String , String> options=new HashMap<>();
2
options.put("tags","sale,summer");
3
ResultList resultList=ImageKit.getInstance().getFileList(options);
Copied!
1
imagekitio = ImageKitIo::Client.new("your_private_key", "your_public_key", "your_url_endpoint")
2
list_files = imagekitio.list_files({tags : "sale,summer"})
Copied!

Search all PNG files

This will list all PNG type files. We will use the following value of searchQuery
format="png"
cURL
Node.js
Python
PHP
Java
Ruby
1
curl -X GET 'https://api.imagekit.io/v1/files' \
2
-G --data-urlencode "searchQuery=format=\"png\"" \
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.listFiles({
10
searchQuery : 'format="png"'
11