Quick Start
Compress an image with a single API call:
curl -X POST https://api.EasyCompress/v1/optimize \
-H "X-API-Key: YOUR_API_KEY" \
-F "image=@photo.jpg" \
-F 'settings={"mode":"smart"}'Don't have an API key? Sign up free to get started.
Authentication
All API requests require authentication using an API key. Include your key in theX-API-Key header.
X-API-Key: cmp_live_xxxxxxxxxxxxxxxxAPI keys can be created and managed in your dashboard after signing up.
Endpoints
/v1/optimizeOptimize a single image. Supports JPEG, PNG, WebP, AVIF, and HEIC formats.
Request Body (multipart/form-data)
| Parameter | Type | Description |
|---|---|---|
image | file | The image file to optimize (required) |
settings | JSON | Compression settings (optional) |
Settings Object
{
"mode": "smart", // "lossless" | "smart" | "ultra"
"outputFormat": "webp", // "original" | "webp" | "avif"
"maxWidth": 1920, // Optional max width
"maxHeight": 1080, // Optional max height
"stripMetadata": true // Remove EXIF data
}Response
{
"success": true,
"jobId": "uuid",
"original": {
"size": 1024000,
"width": 1920,
"height": 1080,
"format": "jpeg"
},
"optimized": {
"size": 256000,
"width": 1920,
"height": 1080,
"format": "webp",
"url": "https://..."
},
"savings": {
"bytes": 768000,
"percent": 75
}
}/v1/usageGet your current usage statistics for the billing period.
{
"period": {
"start": "2024-01-01",
"end": "2024-01-31"
},
"usage": {
"imagesProcessed": 1250,
"bytesProcessed": 524288000,
"bytesSaved": 393216000
},
"limits": {
"imagesPerMonth": 5000,
"remaining": 3750
}
}/v1/auth/validateValidate your API key and get account information.
{
"valid": true,
"tenant": {
"name": "Acme Inc",
"plan": "pro"
},
"limits": {
"imagesPerMonth": 5000,
"maxFileSizeMb": 50,
"rateLimitPerMin": 60
}
}Compression Modes
Lossless
No quality loss. Best for images that need pixel-perfect accuracy. Typical savings: 10-30%
Smart Recommended
Balanced compression with imperceptible quality loss. Typical savings: 50-70%
Ultra
Maximum compression for smallest file sizes. May have visible quality reduction. Typical savings: 70-85%
Output Formats
| Format | Browser Support | Best For |
|---|---|---|
| Original | All | Keep the same format as input |
| WebP | ~97% global | Best balance of size and compatibility |
| AVIF | ~93% global | Smallest files, modern browsers only |
Rate Limits
Rate limits are enforced per API key. When you exceed the limit, requests return a429 Too Many Requests error.
| Plan | Requests/min | Images/month |
|---|---|---|
| Free | 10 | 100 |
| Pro | 60 | 5,000 |
| Business | 200 | 50,000 |
Error Codes
| Code | Description |
|---|---|
400 | Bad request - invalid parameters or file |
401 | Unauthorized - invalid or missing API key |
413 | File too large - exceeds plan limit |
429 | Rate limit exceeded - try again later |
500 | Server error - please contact support |
SDKs & Integrations
Node.js SDK
Coming soon - npm package for easy integration.
Coming Soon