Programmable Media

Invalidate cached assets

Last updated: Jul-19-2024

Even after you delete, rename, or overwrite an image or video asset in your Cloudinary storage, any delivered versions of the asset, with or without transformations, can remain cached on CDN servers for up to 30 days.

Invalidate assets

To prevent the old asset being delivered, you can send an invalidation request instructing the CDN to remove cached copies of the old asset, so that the next request for the asset will pull the newest copy from your Cloudinary storage, or will return an error if the asset no longer exists.

You can send an invalidation request by setting the invalidate parameter to true in relevant methods of the Upload API. From within the Media Library, an invalidate request is automatically included whenever you delete, rename, or overwrite media assets. You can also use relevant Admin API methods to invalidate media assets if support for bulk invalidations has been enabled for your account (not supported by default).

URL-based invalidation for legacy workflows and configurations

For a small number of legacy customers with custom configurations or using less common workflows with our CDN layer, global invalidation isn't supported. The assets and their derived versions that will actually be invalidated during an invalidate request will depend on whether the public ID of a particular URL includes slashes. The table below summarizes these considerations.

Invalidate versioned URLs Disabled (default) Enabled
Public ID does not include slashes Only URLs without a version are invalidated. For example:

https://res.cloudinary.com/cloud_name/image/upload/sample.jpg

Only URLs with the most recent version are invalidated. For example:

https://res.cloudinary.com/cloud_name/image/upload/v14858684/sample.jpg

Public ID includes slashes Only URLs delivered with the /v1/ component are invalidated. For example:

https://res.cloudinary.com/cloud_name/image/upload/v1/path1/path2/sample.jpg

When using SDKs to generate URLs, the SDK automatically adds the /v1/ component for assets whose public IDs have slashes.

If you need to invalidate images or videos whose public IDs have slashes and were delivered without the /v1/ component, submit a service request.

Only URLs with the most recent version are invalidated. For example:

https://res.cloudinary.com/cloud_name/image/upload/v14858684/path1/path2/sample.jpg

Notes
  • By default, signed URLs (with or without versions) are not invalidated. If you need to invalidate signed URLs submit a service request.
  • It usually takes between a few seconds and a few minutes for the invalidation to fully propagate through the CDN. To bypass the CDN cached version and force immediate delivery of the newest image or video, include versions in your delivery URLs.
  • If you continue to see an invalidated image or video in your browser, it may be saved in your browser cache. Try opening an incognito window or clearing your browser cache.

✔️ Feedback sent!

Rate this page: