Beta Compressor

API Documentation

Integrate image compression in minutes

Base URL

URL
https://api.compressor.baidibek.kz

Authentication

Pass your API key in the X-Api-Key request header.

Header
X-Api-Key: YOUR_API_KEY

POST /compress

Compress and optionally resize/convert an image.

Parameters (multipart/form-data)

ParameterDescription
imageThe image file to compress. Required.
qualityOutput quality (1–100). Default: 80.
widthMaximum output width in pixels. Optional.
heightMaximum output height in pixels. Optional.
formatOutput 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.webp
JavaScript
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 image
Python
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.