purgeBucketCache

abstract suspend fun purgeBucketCache(id: String, options: PurgeCacheOptions.() -> Unit = {})(source)

Purges the CDN cache for an entire bucket.

Maps to DELETE /cdn/{bucket} on the Storage API. The server issues a CDN invalidation for the bucket.

Requires the service_role key. The underlying endpoint enforces service_role JWT — calls made with the anon key or a user JWT will be rejected by the server.

Hosted CDN feature. On self-hosted Supabase, the Storage service must have CDN_PURGE_ENDPOINT_URL configured and the purgeCache tenant feature enabled, otherwise the server returns an error.

Parameters

id

The unique identifier of the bucket you would like to purge from cache.

options

Optional purge cache options.