API Documentation

Everything you need to integrate EasyCompress into your applications.

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_xxxxxxxxxxxxxxxx

API keys can be created and managed in your dashboard after signing up.

Endpoints

POST/v1/optimize

Optimize a single image. Supports JPEG, PNG, WebP, AVIF, and HEIC formats.

Request Body (multipart/form-data)

ParameterTypeDescription
imagefileThe image file to optimize (required)
settingsJSONCompression 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
  }
}
GET/v1/usage

Get 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
  }
}
GET/v1/auth/validate

Validate 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

FormatBrowser SupportBest For
OriginalAllKeep the same format as input
WebP~97% globalBest balance of size and compatibility
AVIF~93% globalSmallest 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.

PlanRequests/minImages/month
Free10100
Pro605,000
Business20050,000

Error Codes

CodeDescription
400Bad request - invalid parameters or file
401Unauthorized - invalid or missing API key
413File too large - exceeds plan limit
429Rate limit exceeded - try again later
500Server error - please contact support

SDKs & Integrations

WordPress Plugin

Auto-optimize images on upload. Bulk optimization for existing media.

Get Plugin →

Node.js SDK

Coming soon - npm package for easy integration.

Coming Soon