Search Documentation

Purging Images

If you need to remove or update an image on imgix, you can purge it from our caches. Common reasons for purging an image are:

  1. You want to update an image in your Source without renaming the file.
  2. An out-of-date or unwanted image is being served through your imgix Source. In this case, the image must be removed from your Source first before triggering a purge request. Otherwise, our servers will continue to fetch the image from the Origin and nothing will change.

Purging removes the master image (e.g. https://assets.imgix.net/dogs.png) from our caches, which then clears out all transformations as well (https://assets.imgix.net/dogs.png?w=400, etc.). The image in your Source remains untouched by the purge operation.

Purging from the Webapp

Using the Tools view in the imgix webapp is the easiest way to purge an image. Simply paste the imgix URL of the image you want to purge in the text box in the Purge Single Image section and click Purge.

Screenshot-Purging single image from webapp

Purging with CURL

If you’re comfortable using the command line, it’s the fastest way to purge an image. First, find your API Key on the Account page. Then simply plug it, and the URL of the image you want to purge, into the example below.

curl "https://api.imgix.com/v2/image/purger" \
  -u "$API_KEY:" \
  -d "url=$URL_TO_PURGE"

Purging with Python

Below is an example of purging an image with Python and the Requests library.

import requests

API_KEY = "" # REPLACE - find your API KEY @ https://webapp.imgix.com/accounts

def purge_imgix_image(url):
    purge_endpoint = "https://api.imgix.com/v2/image/purger"
    requests.post(purge_endpoint, auth=(API_KEY, ''), data={"url": url})

purge_imgix_image("http://examples.imgix.net/frog.jpg")