Purge examples

If you need to remove content from Azion cache before it expires, use the Purge API. You can use it to expire content based on your own business rules.

Purge by URL

from azion import authorize, login

# Authorize and login
auth = authorize('myemail@mail.com', 'mysecretpassword')
azion = login(auth.token)

# Purge by URL using CNAME and Domain name
# These two URLs will be purged from Azion cache
my_urls = [


This endpoint answers with HTTP 207 (WebDAV). It is a multi-status code designed to represent an answer that was partially OK. In the result you can find that the dictionary keys are the status and the keys urls and details will exist for every status code. To filter for responses that succeed/failed, we provide two methods:

result = azion.purge_url(urls)

# URLs that were purged

# URLs that were not purged

Purge by Cache Key

You can purge using a cache key. A common example is purging an image. Purging a URL like static.yourdomain.com/images/image.jpg@@ will include all variations found after image.jpg

my_urls = [


Purge Wildcard

Use a wildcard purge to delete a list of objects from the cache. This function accepts one URL only.

url = 'www.maugzoide.com/static/img/*'