Restore file version

Restore file version API

PUT https://api.imagekit.io/v1/files/:fileId/versions/:versionId/restore

Restore file version to a different version of a file.

Path Parameters

NameTypeDescription

fileId*

string

The unique fileId of the uploaded file. fileId is returned in list files API and upload API.

versionId*

string

The unique versionId of the uploaded file's version. This is returned in list files API and upload API as id within the versionInfo parameter.

Headers

NameTypeDescription

Authorization*

string

base64 encoding of your_private_api_key:

Note the colon in the end.

{
    "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": "697821f849c0a938d57563ce",
            "name": "Version 2"
    },
    "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"
    },
    "createdAt": "2019-08-24T06:14:41.313Z",
    "updatedAt": "2019-09-24T06:14:41.313Z"
}

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

Examples

Here is the example request to understand the API usage.

# The unique fileId and versionId of the uploaded file. fileId and versionId (versionInfo.id) is returned in response of list files API and upload API.
curl -X PUT "https://api.imagekit.io/v1/files/file_id/versions/version_id/restore" \
-u your_private_api_key:

Last updated