Programmable Media

Invalidate cached media assets on the CDN

Last updated: Oct-29-2023

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.

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 may also be able to use relevant Admin API methods to invalidate media assets if support for bulk invalidations has been enabled for your account (not supported by default).

The assets and their derived versions that will actually be invalidated during an invalidate request depend on the value set for the global Invalidate versioned URLs option in the Upload page of the Console Settings, and 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:

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

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

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:

  • 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: