Over the past few months, we have added quite a few features to the Media Library that allow you to organize your assets better. You can now
- Use AI-powered extensions to tag images basis their content automatically
- Read and store the embedded metadata of an asset like its Location, Lens information, Copyright, etc.
- Create custom metadata fields to use your own vocabulary and taxonomy to organize your assets.
We have now updated the Media List and Search API to search assets using the information provided by the three features above. The update is seamless and doesn't break any existing integration of the API.
To search using the new parameters, you just need to pass them along with all the other existing search parameters in the field
Using the new search parameters
- The AI-generated tags can be passed in the
tagsparameter of the search query string. For example, if you have used an AI extension like Google Cloud Vision or AWS Rekognition to tag your images, you can search for these assets as shown below.
curl -X GET 'https://api.imagekit.io/v1/files' \ -G --data-urlencode "searchQuery=\"tags\" IN [\"football\", \"stadium\"]" \ -u your_private_api_key:
- ImageKit now allows you to search only on the following embedded metadata fields -
For example, you can search for assets originally created in the last year using the
DateTimeOriginal field of the asset's embedded metadata, as shown below.
curl -X GET 'https://api.imagekit.io/v1/files' \ -G --data-urlencode \ "searchQuery=\"embeddedMetadata.DateTimeOriginal\" > \"1y\"" \ -u your_private_api_key:
You can find more details about values for other embedded metadata fields in our documentation. More embedded metadata fields for search will be made available in the future.
- Custom metadata fields of different types have their method of writing the query string. You can find the details about querying each field type in our documentation. For example, to query on a multi-select field like 'brands', that associates a clothing company's brand with the asset, the search query will be as shown below -
curl -X GET 'https://api.imagekit.io/v1/files' \ -G --data-urlencode \ "searchQuery=\"customMetadata.brands\" IN [\"nike\", \"adidas\"]" \ -u your_private_api_key:
Our Media List and search API documentation gives more examples and information about each of the new search parameters.
If you face any issues while using this feature or have a question or suggestion, please reach out to us at email@example.com.
Note: The new search parameters are available only via the API as of now. This additional functionality will soon be made available in the Media Library in the Imagekit dashboard UI.