Update file details such as tags, customCoordinates attributes, remove existing AITags and apply extensions using update file detail API. This operation can only be performed on the current version of the file.
Path Parameters
Name
Type
Description
fileId
string
The unique fileId of the uploaded file. fileIdis returned in list files API and upload API.
Headers
Name
Type
Description
Authorization
string
base64 encoding of your_private_api_key:
Note the colon in the end.
Request Body
Name
Type
Description
removeAITags
array
An array of AITags associated with the file that you want to remove e.g. ["car", "vehicle", "motorsports"]. If you want to remove all AITags associated with the file, send a string - "all".
Note: Remove operation forAITagsexecutes before any of the extensionsare processed.
webhookUrl
string
The final status of pending extensions will be sent to this URL. To learn more about how webhooks works, refer this.
extensions
array
Array of extensions to be processed on the asset. For reference about extensions refer this. Note: Remove.bg extension creates a new file version which will also have the updated file details.
tags
array
An array of tags associated with the file e.g. ["tag1", "tag2"]. If you want to unset it send null.
customCoordinates
string
Define an important area in the image in the format x,y,width,heighte.g. 10,10,100,100. If you want to unset this send null.
customMetadata
JSON
A key-value data to be associated with the asset. To unset a key, send null value for that key. Before setting any custom metadata on an asset you have to create the field using custom metadata fields API. Example - {brand: "Nike", color: "red"}.
// This example response is after extensions are applied in the update API.{"fileId" : "598821f949c0a938d57563bd","type": "file","name": "file1.jpg","filePath": "/images/products/file1.jpg","tags": ["t-shirt","round-neck","sale2019"],"AITags": [ {"name":"Shirt","confidence":90.12,"source":"google-auto-tagging" },/* ... more googleVision tags ... */ ],"versionInfo": {"id":"598821f949c0a938d57563bd","name":"Version 1" },"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","mime": "image/jpeg","width": 100,"height": 100,"size": 100,"hasAlpha": false,"customMetadata": { brand:"Nike", color:"red" },"extensionStatus": {"google-auto-tagging":"success","aws-auto-tagging":"pending" },"createdAt": "2019-08-24T06:14:41.313Z","updatedAt": "2019-08-24T06:14:41.313Z"}
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 file object in JSON-encoded response body.
Examples
Tags and custom coordinate update
# The unique fileId of the uploaded file. fileId is returned in response of list files API and upload API.curl-XPATCH"https://api.imagekit.io/v1/files/:fileId/details" \-H 'Content-Type: application/json' \-u your_private_key:-d'{ "tags": [ "tag1", "tag2" ], "customCoordinates": "10,10,100,100"}'
var imagekit = new ImageKit({
publicKey : "your_public_api_key",
privateKey : "your_private_api_key",
urlEndpoint : "https://ik.imagekit.io/your_imagekit_id/"
});
FileUpdateRequest updateob = new FileUpdateRequest
{
fileId = "fileId",
};
List<string> updatetags = new List<string>
{
"tag1",
"tag2"
};
updateob.tags = updatetags;
string updatecustomCoordinates = "10,10,100,100";
updateob.customCoordinates = updatecustomCoordinates;
Result updateresp = imagekit.UpdateFileDetail(updateob);
Applying extensions
Request
# The unique fileId of the uploaded file. fileId is returned in response of list files API and upload API.# Example of using the google-auto-tagging extensioncurl-XPATCH"https://api.imagekit.io/v1/files/file_id/details" \-H 'Content-Type: application/json' \-u your_private_key:-d'{ "extensions": [ { "name": "google-auto-tagging", "maxTags": 5, "minConfidence": 95 } ]}'