API - Good to knows
Last updated
Last updated
All current API methods are collected in a Postman Collection. You can import them via the button below. apikey
is assigned to a collection variable so you don't need to write your API key to the header in every request. Don't forget to write your own apikey
in the collection variables section by clicking the header of our collection.
You must provide your apikey
in the header for all API requests.
In most request libraries, you won't need to add a content-type
header. In case of need, you can find supported content types below.
All API endpoints support both:
Upload file and Optimize / Transform endpoints also support extra
CDN Link has no rate limit when fetching files from caches. Both from the global cache and internal cache.
API calls are rate limited.
Rate limits are different for each endpoint. Imagemash.io sends 2 rate-limit headers for every API call response.
rl-remain
: x
(x
requests/points left to stay below the rate limit)
rl-ttl
: y
(After y
seconds your rate limit will be reset)
The logic is fairly simple; when your x
is 0
, sleep for y
seconds.
If you continue sending requests after your rl-remain
is 0
, you will get (429) Too Many Requests
response.
It is recommended to implement a simple middleware function that checks response headers for your API calls. Otherwise, your requests may be blocked for a couple of minutes.