How to delete derived resources?

You can use the interactive Media Library to delete derived resources one by one. This is done by choosing the original image, click on 'View derived images' and delete the derived resource.

In order to bulk delete derived resource, use one of our Admin API delete methods while setting the keep_original parameter to true, this ensures that only derived resources are deleted. For example, (in Rails):

Cloudinary::Api.delete_resources(['image1', 'image2'], :keep_original => true)

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)

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)

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-

Note that the Admin API is rate limited.

 

UPDATE: It's now possible to delete derived resources using the new UI bulk delete tool. Access it by going to your Account's Settings page in the console - 

Bulk_delete_screen.png

Have more questions? Submit a request

Comments

  • Avatar
    Julien Bornstein

    Does delete_all_resources() can be used with a tag filter (delete_all_resources_by_tag() ?)

  • Avatar
    Itay Taragano

    Deleting all resources sharing a certain tag can be performed with the  delete_resources_by_tag Admin API method, e.g., in PHP:

    $api->delete_resources_by_tag("mytag");

    For more information:

    http://cloudinary.com/documentation/admin_api#delete_resources_by_tags

    Note that each call deleted up to 1000 resources.

  • Avatar
    Forrest Maready

    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.

     

    Thanks

  • Avatar
    Itay Taragano

    Hi Forrest.

    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:

    http://support.cloudinary.com/entries/23310776-I-have-deleted-an-image-and-though-it-has-been-removed-from-the-media-library-it-is-still-available-

    If you want the purge the CDN as well, you should set the  invalidate  parameter to  true  while 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.

  • Avatar
    Forrest Maready

    Thank you Itay-

    Does the API call purge the CDN any faster than doing it through the Media Library?

     

    Many thanks

  • Avatar
    Itay Taragano

    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:

    http://support.cloudinary.com/entries/23663103-What-are-image-versions-

  • Avatar
    aster

    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.

    [UPDATE] 
    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

    Edited by aster
  • Avatar
    Nadav Ofir

    Hi Aster,

    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.

Powered by Zendesk