There are few ways to delete derived resources via the UI and API.
- Delete derived resources by public id
- Delete derived resources by transformation
- Delete derived resources by derived id
- Delete all derived resources in the account
Delete derived resources by public id
In order to bulk delete derived resource using the Admin API we should set the parameter
true, this ensures that only derived resources are deleted. For example, (in Rails):
Cloudinary::Api.delete_resources(['image1', 'image2'], :keep_original => true)
You can choose to delete only derived resources of a certain type, for example - Facebook fetched profile images:
Cloudinary::Api.delete_all_resources(:type => :facebook, :keep_original => true)
Delete derived resources by transformation1
You can choose to delete derived resources that use a particular transformation, for example - `w_200,c_limit`:
Cloudinary::Api.delete_resources(:public_ids => ['sample1','sample2'], :transformations => "w_200,c_limit")
Delete derived resources by derived id
Delete assets by their derived id. The derived ids can be retrieved by getting the details of a single resource.
Delete all derived resources in the account1
You can also use the
delete_all_resources method to bulk delete all derived images of your uploaded resources in batches of 1000 resources per call. For example:
Cloudinary::Api.delete_all_resources(:keep_original => true)
1 When there are still more resources to go through, the
next_cursor value is returned as part of the response. You can then specify this value as the
next_cursor parameter of the following call. This way you can go through the full list of your resources.
For more information, see: http://support.cloudinary.com/hc/en-us/articles/205714121-How-do-I-browse-through-all-resources-in-my-account-using-the-API-
You'll need to be logged to your Cloudinary account to perform the following actions:
Delete derived resources individually
- Click on the Media Library tab
- Select the asset and click on the "Edit" icon
- Click on the View derived images button that's right above the image
- In the left-hand side, there will be options to delete the derived versions
Bulk delete derived
- Click on the gear icon in the top right-hand corner which will take you to a new view
- In the right-hand panel, there is a heading called "Support Activities" and under it, there should be a link labeled Bulk delete.
Does delete_all_resources() can be used with a tag filter (delete_all_resources_by_tag() ?)
Deleting all resources sharing a certain tag can be performed with the
delete_resources_by_tagAdmin API method, e.g., in PHP:
For more information:
Note that each call deleted up to 1000 resources.
I deleted the resource (containing an incorrect image) before I realized that it wouldn't automatically delete the derived images. Is there any way to delete the derived resources of that now deleted resource? I deleted and recreated the resource, assuming all derived resources would be deleted. Obviously, it doesn't list the derived resources under the new resource, though the URLs are still live and showing an incorrect image.
It seems like I now have no way to delete those "orphaned" resources.
Indeed deleting an image also deletes all its derivatives as well. However, note that both the original and the derived images might be still cached in the CDN.
For more information:
If you want the purge the CDN as well, you should set the
truewhile deleting, for example in Rails:
Cloudinary::Uploader.destroy('my_image', :invalidate => true)
Deleting via the Media library automatically invalidates the image. Note that it may take up to an hour for the invalidation to fully propagate through the CDN.
Thank you Itay-
Does the API call purge the CDN any faster than doing it through the Media Library?
Invalidating either through the Admin API or the Media library may both take up to an hour. Note that this requests to propagate through Akamai's entire CDN network (100K+ servers in less than 1 hour).
We warmly recommend to include the version component as part of the URL. Cloudinary's 'version' is a simple "cache busting" solution that acts as a unique name for each uploaded image. Unlike invalidation, 'versions' instantly bypasses all cached versions and force the delivery of the latest version of the image.
For more information:
Hi I have already set invalidate to "yes" under advanced settings. However, I am still getting the cache of the previous photo when i upload a new image with the same image name. I do not wish to keep track the version in the url and I would like to get the latest image just with the same URL. Could you help me with this? By the way I am using .Net.
Thank you very much.
I managed to resolve this issue by storing the version as I realized that no matter what version I provide in the URL e.g. "/v1" or "/v1486331234", it will return the latest image. Thanks
By default URLs that contain version components aren't invalidated.
More information about the default invalidation policy is available here: https://support.cloudinary.com/hc/en-us/articles/209048985-Why-wasn-t-my-URL-properly-invalidated-
If you're still encountering issues, please open a support ticket so we can look deeper into your use case.
Please sign in to leave a comment.