Invalidation API

The Invalidation API is a REST API to invalidate images from the CDN and Cloudimage resizing servers.

Step 1 - get your API key

Your API key is available in the Cloudimage admin console, under Invalidation:

Step 2 - call the Invalidation REST API

POST http://api.cloudimg.io/invalidate/

Headers:

X_CLIENT_TOKEN: your API KEY
Content-Type: application/json

Body:

The body of the request must contain the invalidation url in the form /operation/size/filter/origin_image_url.

To invalidate: https://demo.cloudimg.io/width/300/s/sample.li/now.php

Use: width/300/s/sample.li/now.php or /width/300/s/sample.li/now.php

Invalidate a single image
{
  "invalidation": {
    "scope": "url",
    "url": "/width/200/s/sample.li/paris.jpg"
  }
}
Invalidate a single image and all it's resizes
{
    "invalidation": {
        "scope": "original",
        "url": "sample.li/birds.jpg"
    }
}
Invalidate multiple images
{
    "invalidation": {
        "scope": "urls",
        "urls": ["/width/400/s/sample.li/paris.jpg",
                 "/width/400/s/sample.li/flat.jpg", ...
                ]
    }
}
Invalidate multiple images with all their resizes
{
    "invalidation": {
        "scope": "original",
        "url": "sample.li/birds.jpg"
    }
}
Invalidate all images images matching one or several wildcards
{
    "invalidation": {
        "scope": "wildcard",
        "url": "*sample.li/birds.jpg"
    }
}
Multiple URLs and wildcards are supported
{
    "invalidation": {
        "scope": "wildcard",
        "urls": ["*sample.li/birds.jpg", "*.sample2.li/*"]
    }
}

Wildcard flushes require the entire log database to be searched, hence can take longer (up to 60 seconds)

Invalidate all your images (this will trigger a re-download of all images from your origin)
{
    "invalidation": {
        "scope": "all"
    }
}

Flushing all images will result in Cloudimage downloading all your images from your origin image storage again. This will result in slower image loading times for the first times the images are downloaded. Contact us if you have more than 1 TB of monthly CDN traffic or 1 TB of storage.

Try it out with the demo token demo token

You can use our sample image showing the time it is resized the first time:

https://demo.cloudimg.io/width/300/s/sample.li/now.php

Click on 'Send' to call the Invalidation API and reload the image above (invalidation takes about 30 seconds to complete). You should see the new time. You might need to disable your browser's local cache to see the new image immediately.

host: "http://api.cloudimg.io" path: "/invalidate/" theme: light headers: X-Client-Token: client_428598e57095bb7a7637a72bc1c9b557a0723ca3 editor_theme: light method: POST body: | { "invalidation": { "scope" : "url", "url": "/width/300/s/sample.li/now.php" } }