API & WordPress Plugin
Integrate SmartPNG compression into your applications and WordPress sites.
WordPress Plugin
Seamlessly compress images directly within your WordPress dashboard.
Automatic image compression
Bulk compression for existing images
WordPress media library integration
Backup original images
Easy installation and setup
Calculate Your Price
1 Γ 1000 compressionsUS$9.00 each
Total Price$9.00 USD
Get Api Key
$9.00
for 1,000 compressions
Developer API Documentation
Integrate SmartPNG compression into your applications with our REST API
Base URL
https://integration.smartpng.com/apiAuthentication
All API requests require an API key. Include your API key in the request body or as a form parameter.
Get your API key from the Dashboard
1. Validate API Key
Check if your API key is valid and get remaining credits.
Endpoint
POST /validateRequest Body
{
"api_key": "your_api_key_here"
}Response
{
"valid": true,
"user_id": "user_id",
"credits_remaining": 1000,
"can_compress": true,
"max_image_size": 52428800
}2. Compress Image (Immediate)
Upload and compress an image immediately. Best for small to medium images.
Endpoint
POST /compressContent-Type
multipart/form-dataForm Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
api_key | string | Yes | Your API key |
file | file | Yes | Image file (PNG, JPEG, WebP) |
compression_level | float | No | Compression quality (0.0-1.0, default: 0.7) |
background_processing | boolean | No | Use background queue (default: false) |
Response (Immediate Processing)
{
"success": true,
"job_id": "unique_job_id",
"status": "completed",
"message": "Image compressed successfully",
"compressed_data": "base64_encoded_image",
"original_size": 1048576,
"compressed_size": 524288,
"compression_ratio": 50.0
}Response (Background Processing)
{
"success": true,
"job_id": "unique_job_id",
"status": "queued",
"message": "Image uploaded and queued for background processing"
}3. Check Job Status
Check the status of a background compression job and retrieve the result.
Endpoint
GET /job-status/{job_id}?api_key=your_api_keyResponse (Completed)
{
"job_id": "unique_job_id",
"status": "completed",
"filename": "image.png",
"original_size": 1048576,
"compressed_size": 524288,
"compression_ratio": 50.0,
"compressed_url": "blob_storage_url",
"compressed_data": "base64_encoded_image",
"created_at": "2025-01-15T10:30:00Z"
}Response (Failed)
{
"job_id": "unique_job_id",
"status": "failed",
"filename": "image.png",
"error_message": "Compression failed: Invalid image format",
"created_at": "2025-01-15T10:30:00Z"
}Error Codes
| Status Code | Description |
|---|---|
200 | Success |
400 | Bad Request - Invalid parameters |
401 | Unauthorized - Invalid API key |
413 | Payload Too Large - Image exceeds 50MB |
429 | Too Many Requests - Insufficient credits |
500 | Internal Server Error |
Example: cURL Request
curl -X POST https://integration.smartpng.com/api/compress \
-F "api_key=your_api_key_here" \
-F "file=@/path/to/image.png" \
-F "compression_level=0.8" \
-F "background_processing=false"Limits
- Maximum file size: 50 MB
- Supported formats: PNG, JPEG, WebP
- Credit cost: 1 credit per compression
- Compression quality range: 0.0 - 1.0 (higher = better quality)
