API Documentation
Integrate image compression in minutes
Base URL
URL
https://api.compressor.baidibek.kzAuthentication
Pass your API key in the X-Api-Key request header.
Header
X-Api-Key: YOUR_API_KEYPOST /compress
Compress and optionally resize/convert an image.
Parameters (multipart/form-data)
| Parameter | Description |
|---|---|
| image | The image file to compress. Required. |
| quality | Output quality (1–100). Default: 80. |
| width | Maximum output width in pixels. Optional. |
| height | Maximum output height in pixels. Optional. |
| format | Output format: jpeg, png, webp, avif. Default: jpeg. |
Response
Returns the compressed image binary. Useful headers:
- ▸
X-Original-Size — original file size in bytes - ▸
X-Compressed-Size — compressed file size in bytes - ▸
X-Width / X-Height — output dimensions
Examples
cURL
curl -X POST https://api.compressor.baidibek.kz/compress \
-H "X-Api-Key: YOUR_API_KEY" \
-F "image=@photo.jpg" \
-F "quality=80" \
-F "format=webp" \
--output compressed.webpJavaScript
const form = new FormData();
form.append('image', fileInput.files[0]);
form.append('quality', '80');
form.append('format', 'webp');
const res = await fetch('https://api.compressor.baidibek.kz/compress', {
method: 'POST',
headers: { 'X-Api-Key': 'YOUR_API_KEY' },
body: form,
});
const blob = await res.blob();
// blob contains the compressed imagePython
import requests
with open('photo.jpg', 'rb') as f:
res = requests.post(
'https://api.compressor.baidibek.kz/compress',
headers={'X-Api-Key': 'YOUR_API_KEY'},
files={'image': f},
data={'quality': '80', 'format': 'webp'},
)
with open('compressed.webp', 'wb') as out:
out.write(res.content)Error codes
- !401 — Missing or invalid API key
- !429 — Monthly limit reached
- !400 — Invalid file or parameters
Rate limits
1 000 requests per account per calendar month on the free plan.
