About this endpoint
What it does
Compresses an uploaded image file and returns the compressed image as binary output. You can optionally choose the output format, quality, or a target maximum size in KB.
Request Body
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| file | String | Yes | Image file to compress. Accepted input formats: JPEG, PNG, WebP, AVIF, TIFF, or GIF. Maximum size: 10 MB; maximum resolution: 40 megapixels. |
| to | ENUM | No | Output format. Allowed values: jpg, png, webp, avif. Default: same as the input format. |
| quality | Integer | No | Compression quality from 1 to 100. Default: 75. |
| target_kb | Integer | No | Largest acceptable output size in KB. Allowed range: 5 to 10240. Supported for jpg, webp, and avif. |
Response
Returns a binary file containing the compressed image.


