Docs | imagemash.io
DashboardSign up for Free
  • 🎉imagemash.io
  • 🚀Getting Started
    • Simple CDN Link Usage
  • 💽Sources
    • IM Cloud Storage
    • Image URL
    • Storage Providers
      • Amazon S3
      • Google Cloud
      • S3 Compatible Storage
    • Web Folder
  • 🖼️Image Transform
    • Transform Options
      • Quality
      • Width
      • Height
      • Scale
      • Crop
      • Gravity
      • Background
      • Border
      • Round
      • Output Format
      • Angle (Rotate)
      • Flip
      • Helpers
        • x, y
      • Filters
        • Tint
        • Flatten
        • Grayscale
        • Blur
        • Sharpen
        • Median
        • Threshold
        • Negative
    • Transform Cheat Sheet
    • Named Transforms
  • 🛠️API
    • API - Good to knows
    • API Methods
      • Account
        • Named Transforms
          • Get named transforms
          • Add named transform
          • Remove named transform
        • Image URL Restriction
          • Get keyword list
          • Add keyword to list
          • Remove keyword from list
          • Change keyword list usage
      • Storage
        • Upload file
        • Get and search files
        • Delete files
        • Add new tags to files
        • Set tags of files
        • Remove tags from files
        • Purge Cache
      • Optimize / Transform
  • ❓How it works?
    • Custom Domain
    • Bandwidth
    • Cloud Storage
    • Caching
    • Purge Cache
    • Limits
  • Contact Us
Powered by GitBook
On this page
  • Purges files from Global Caches & Internal Caches
  • Get list of your Purge requests
  1. API
  2. API Methods
  3. Storage

Purge Cache

PreviousRemove tags from filesNextOptimize / Transform

Last updated 2 years ago

Please refer to page to have a better understanding of cache purging.

Purges files from Global Caches & Internal Caches

POST https://api.imagemash.io/v1/storage/purgeCache

Headers

Name
Type
Description

apikey*

String

Your API Key

Request Body

Name
Type
Description

paths*

Array

Array of paths. Could be a complete path or a incomplete path. Consider as a search string. Please refer to

domain

String

Domain name. Eg. john.imagemash.io

I26JPCNTSVM8DB
{
    msg: "error details"
    details: "..."
}   // Explanation of error
Unauthorized
{
    // Please contact support if you are getting this error constantly.
}

Example Codes

curl --location 'https://api.imagemash.io/v1/storage/purgeCache' \
--header 'apikey: your_api_key' \
--header 'Content-Type: application/json' \
--data '{
    "domain": "john.imagemash.io",
    "paths": [
        "/logo.png",
        "/img/big/my_"
    ]
}'
var axios = require('axios');
var data = JSON.stringify({
  "domain": "john.imagemash.io",
  "paths": [
    "/logo.png",
    "/img/big/my_"
  ]
});

var config = {
  method: 'post',
maxBodyLength: Infinity,
  url: 'https://api.imagemash.io/v1/storage/purgeCache',
  headers: { 
    'apikey': 'your_api_key', 
    'Content-Type': 'application/json'
  },
  data : data
};

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

url = "https://api.imagemash.io/v1/storage/purgeCache"

payload = json.dumps({
  "domain": "john.imagemash.io",
  "paths": [
    "/logo.png",
    "/img/big/my_"
  ]
})
headers = {
  'apikey': 'your_api_key',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "json"
require "net/http"

url = URI("https://api.imagemash.io/v1/storage/purgeCache")

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

request = Net::HTTP::Post.new(url)
request["apikey"] = "your_api_key"
request["Content-Type"] = "application/json"
request.body = JSON.dump({
  "domain": "john.imagemash.io",
  "paths": [
    "/logo.png",
    "/img/big/my_"
  ]
})

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

Get list of your Purge requests

POST https://api.imagemash.io/v1/storage/purgeCache

Headers

Name
Type
Description

apikey*

Your API Key

[
    {
        "createdAt": "2022-09-22T14:25:30.995Z",
        "requestId": "I26JPCNTSVM8DB",
        "status": "InProgress",
        "paths": [
            "/eg1.png",
            "/img/big/my_",
            "/my_image_repository/"
        ]
    },
    {
        "createdAt": "2022-08-22T14:22:05.877Z",
        "requestId": "IVSU919KZECQH",
        "status": "Completed",
        "paths": [
            "/companies/my_company"
        ]
    }
]
{
    msg: "error details"
    details: "..."
}   // Explanation of error
Unauthorized
{
    // Please contact support if you are getting this error constantly.
}

Example Codes

curl --location --request POST 'https://api.imagemash.io/v1/storage/getPurgeList' \
--header 'apikey: your_api_key'
var axios = require('axios');

var config = {
  method: 'post',
maxBodyLength: Infinity,
  url: 'https://api.imagemash.io/v1/storage/getPurgeList',
  headers: { 
    'apikey': 'your_api_key'
  }
};

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

url = "https://api.imagemash.io/v1/storage/getPurgeList"

payload={}
headers = {
  'apikey': 'your_api_key'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
require "uri"
require "net/http"

url = URI("https://api.imagemash.io/v1/storage/getPurgeList")

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

request = Net::HTTP::Post.new(url)
request["apikey"] = "your_api_key"

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

to understand requirements of paths.

🛠️
Purge Cache
Purge Cache