Image optimization API documentation

To start using the CheetahO image optimization API you need to sign up for CheetahO API services and obtain your unique API key. 

Calling methodParameters

URL to call:

{“key“: “your api key”,  “lossy“:1, “url“: “”}

JSON Encoded parameters, as follows

  • key – Your API key.
  • url – image URL to optimize.
  • lossy – image compression type.
  • quality – custom image quality

API Parameters


Your API key, as provided in your CheetahO control panel.


The URL where the original image is located. This needs to be a valid URL and urlencoded.


Controls whether the image compression will use a lossy or lossless algorithm.

0 – Lossless compression. Choose this option when you do not want to lose any of the original image’s details. The new image will be identical to the original but smaller in size. 

1 – Lossy compression.  The compressed  image is not 100% identical to the original. If you want to have a better compression rate, use this settings.


This works only if lossy = 1  For the JPEG image format, specifying a quality level of 1 will produce the lowest image quality (highest compression level), whereas a quality of 100 will give you the best quality but the least compression.

API Return

errorContains the status message for the call. The status itself is an object with two fields:

  • Code – This is a numeric code identifying the outcome of the call. Can be:
    • 200 – No errors, image processed, download URL available.
    • 304 – Not Found. The file is no longer available.
    • 400 – Bad request. Invalid image URL. Please make sure the URL is properly urlencoded or points to a valid image file.
    • 401 – Unauthorized. Invalid API key. Check it in CheetahO panel.
    • 403 – Account has been temporarily suspended. Check your quota. Maybe you’ll need to subscribe to a higher plan to increase your quota.
    • 413 – Requested file size too large. The maximum file size is limited by you plan.
    • 415 – Bad file type.
    • 500 – Encountered an unexpected error and we can not finish your request.
  • Message – A text message explaining what the code stands for.
  • destURL – Download URL for optimized image.
  • originalSize – Size of the original image 
  • newSize – Size of compressed image 
  • savedBytes – Size of saved data. 
  • validTill – Timestamp how long the file is valid.

If you have any questions, feel free to contact us.