Caching

By default, we will cache your generated images for as long as 1 year.


Best Practice

To ensure your image gets updated to your end users, always change something on your image path every time you change a master image. Avoid replacing the image on your source. Upload a new one with a different name and remove the old one if not needed.

Most customers prefer to use for example a "updated at" timestamp on the file name to ensure that the image gets updated on the end user's browser's cache.

This is the only way to avoid the end user's browser caching your image, any ISP caching or any third-party CDNs you might be using in addition to ImageBoss' CDN.


Purging via API

If you are aware of the tradeoffs and are unable to follow the best practices, you can clean your master image from ImageBoss internal caches by doing an extra API request every time you change that specific image.

This is an asyncronous operation and it will clean up all the variants from the master image in question.

This action won't delete the image from your sources. Just from our caches and it can take up to 15 minutes to complete.


cURL

curl \
  --location \
  --request DELETE 'https://img.imageboss.me/<your-source>/path/to/master/image.jpg' \
  --header 'imageboss-api-key: <YOUR_API_KEY_HERE>'

Node.js

var axios = require('axios');

var config = {
  method: 'delete',
  url: 'https://img.imageboss.me/<your-source>/path/to/master/image.jpg',
  headers: {
    'imageboss-api-key': '<your-api-key-here>'
  }
};

axios(config)
  .then(function (response) {
    console.log(JSON.stringify(response.data));
  })
  .catch(function (error) {
    console.log(error);
  });

PHP

<?php
$client = new http\Client;
$request = new http\Client\Request;
$request->setRequestUrl('https://img.imageboss.me/<your-source>/path/to/master/image.jpg');
$request->setRequestMethod('DELETE');
$request->setOptions(array());
$request->setHeaders(array(
  'imageboss-api-key' => '<your-api-key-here>'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();

Python

import http.client
import mimetypes
conn = http.client.HTTPSConnection("img.imageboss.me")
payload = ''
headers = {
  'imageboss-api-key': '<your-api-key-here>'
}
conn.request("DELETE", "/<your-source>/path/to/master/image.jpg", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

Ruby

require "uri"
require "net/http"

url = URI("https://img.imageboss.me/<your-source>/path/to/master/image.jpg")

https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true

request = Net::HTTP::Delete.new(url)
request["imageboss-api-key"] = "<your-api-key-here>"

response = https.request(request)
puts response.read_body


Questions?

If you have any questions please don't hesitate, send us a message on support[at]imageboss.me.