API - Good to knows

Postman Collection

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.

Run in Postman

Authentication

You must provide your apikey in the header for all API requests.

Content Type

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:

  • application/x-www-form-urlencoded
  • application/json

Upload file and Optimize / Transform endpoints also support extra

  • multipart/form-data

Handling Rate Limits

  • 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.

Some API Calls may have reduced limits for free accounts depending on the load in servers and may have less process priority.

Last updated