API Documentation

Integrate Easy Image Convert's powerful image conversion capabilities into your own applications.

Introduction

The Easy Image Convert API allows developers to convert images between various formats programmatically. Our API is RESTful and returns responses in JSON format.

With our API, you can:

  • Convert images between multiple formats (JPG, PNG, GIF, WEBP, BMP, TIFF, SVG, etc.)
  • Fetch images from URLs and convert them
  • Check the status of ongoing conversions
  • Download converted images
Base URL for all API requests: https://api.easyimageconvert.com/v1

Authentication

All API requests require authentication using an API key. You can obtain an API key by registering for a developer account.

Include your API key in the request header:

X-API-Key: your_api_key_here
Keep your API key secure and never expose it in client-side code.

API Endpoints

The following endpoints are available for image conversion:

Convert Image

POST /convert

Convert an uploaded image to the specified format.

Request Parameters:

Parameter Type Required Description
image File Yes The image file to convert
format String Yes Target format (jpg, png, gif, webp, etc.)
quality Integer No Output quality (1-100, default: 85)

Response:

{
  "success": true,
  "conversion_id": "abc123xyz",
  "status": "completed",
  "result": {
    "download_url": "https://api.easyimageconvert.com/v1/download/abc123xyz",
    "format": "png",
    "size": 24580,
    "expires_at": "2023-07-01T12:00:00Z"
  }
}

Fetch from URL

POST /fetch

Fetch an image from a URL and convert it to the specified format.

Request Parameters:

Parameter Type Required Description
url String Yes URL of the image to fetch and convert
format String Yes Target format (jpg, png, gif, webp, etc.)
quality Integer No Output quality (1-100, default: 85)

Response:

{
  "success": true,
  "conversion_id": "def456uvw",
  "status": "processing",
  "estimated_time": 5
}

Conversion Status

GET /status/{conversion_id}

Check the status of a conversion process.

Path Parameters:

Parameter Type Required Description
conversion_id String Yes ID of the conversion to check

Response:

{
  "success": true,
  "conversion_id": "def456uvw",
  "status": "completed",
  "result": {
    "download_url": "https://api.easyimageconvert.com/v1/download/def456uvw",
    "format": "webp",
    "size": 15240,
    "expires_at": "2023-07-01T12:00:00Z"
  }
}

Rate Limits

To ensure fair usage of our API, we implement the following rate limits:

Plan Rate Limit Max File Size Daily Limit
Free 10 requests per minute 10 MB 100 conversions
Basic 30 requests per minute 25 MB 500 conversions
Premium 100 requests per minute 50 MB 2,000 conversions
Enterprise Custom Custom Custom

Rate limit information is included in the response headers:

X-RateLimit-Limit: 10
X-RateLimit-Remaining: 8
X-RateLimit-Reset: 1625097600

Error Handling

The API uses standard HTTP status codes to indicate the success or failure of requests:

Status Code Description
200 OK Request successful
400 Bad Request Invalid request parameters
401 Unauthorized Missing or invalid API key
403 Forbidden API key doesn't have permission
404 Not Found Resource not found
429 Too Many Requests Rate limit exceeded
500 Internal Server Error Server error

Error responses include a JSON object with details:

{
  "success": false,
  "error": {
    "code": "invalid_format",
    "message": "The specified format 'xyz' is not supported.",
    "details": "Supported formats are: jpg, jpeg, png, gif, webp, bmp, tiff, svg, heif, heic, psd, ai, eps, ico"
  }
}

Code Examples

<?php
// Convert an image using the API
$apiKey = 'your_api_key_here';
$imagePath = '/path/to/image.jpg';
$targetFormat = 'png';

$curl = curl_init();

// Create file upload
$cfile = new CURLFile($imagePath, mime_content_type($imagePath), basename($imagePath));

curl_setopt_array($curl, [
    CURLOPT_URL => 'https://api.easyimageconvert.com/v1/convert',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => [
        'image' => $cfile,
        'format' => $targetFormat,
        'quality' => 90
    ],
    CURLOPT_HTTPHEADER => [
        'X-API-Key: ' . $apiKey,
        'Accept: application/json'
    ]
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
    echo "Error: " . $err;
} else {
    $result = json_decode($response, true);
    
    if ($result['success']) {
        echo "Conversion successful! Download URL: " . $result['result']['download_url'];
    } else {
        echo "Conversion failed: " . $result['error']['message'];
    }
}
?>
// Convert an image using the API
const apiKey = 'your_api_key_here';
const imageFile = document.getElementById('imageInput').files[0];
const targetFormat = 'webp';

const formData = new FormData();
formData.append('image', imageFile);
formData.append('format', targetFormat);
formData.append('quality', 85);

fetch('https://api.easyimageconvert.com/v1/convert', {
    method: 'POST',
    headers: {
        'X-API-Key': apiKey
    },
    body: formData
})
.then(response => response.json())
.then(data => {
    if (data.success) {
        console.log('Conversion successful!');
        console.log('Download URL:', data.result.download_url);
        
        // Create download link
        const downloadLink = document.createElement('a');
        downloadLink.href = data.result.download_url;
        downloadLink.textContent = 'Download Converted Image';
        document.body.appendChild(downloadLink);
    } else {
        console.error('Conversion failed:', data.error.message);
    }
})
.catch(error => {
    console.error('Error:', error);
});
import requests

# Convert an image using the API
api_key = 'your_api_key_here'
image_path = '/path/to/image.jpg'
target_format = 'png'

url = 'https://api.easyimageconvert.com/v1/convert'
headers = {
    'X-API-Key': api_key
}

files = {
    'image': open(image_path, 'rb')
}

data = {
    'format': target_format,
    'quality': 90
}

response = requests.post(url, headers=headers, files=files, data=data)

if response.status_code == 200:
    result = response.json()
    
    if result['success']:
        print(f"Conversion successful! Download URL: {result['result']['download_url']}")
        
        # Download the converted image
        download_url = result['result']['download_url']
        output_path = f"converted_image.{target_format}"
        
        with open(output_path, 'wb') as f:
            download_response = requests.get(download_url)
            f.write(download_response.content)
            
        print(f"Image saved to {output_path}")
    else:
        print(f"Conversion failed: {result['error']['message']}")
else:
    print(f"Error: {response.status_code} - {response.text}")
# Convert an image using the API
curl -X POST https://api.easyimageconvert.com/v1/convert \
  -H "X-API-Key: your_api_key_here" \
  -F "image=@/path/to/image.jpg" \
  -F "format=png" \
  -F "quality=90"

# Fetch and convert an image from URL
curl -X POST https://api.easyimageconvert.com/v1/fetch \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/image.jpg",
    "format": "webp",
    "quality": 85
  }'

# Check conversion status
curl -X GET https://api.easyimageconvert.com/v1/status/abc123xyz \
  -H "X-API-Key: your_api_key_here"

SDK Libraries

We provide official SDK libraries for popular programming languages to make integration even easier:

PHP SDK

Our PHP SDK provides a simple interface for integrating with the API.

composer require easyimageconvert/php-sdk
View on GitHub

JavaScript SDK

Our JavaScript SDK works in both browser and Node.js environments.

npm install easyimageconvert-js
View on GitHub

Python SDK

Our Python SDK makes it easy to integrate with Python applications.

pip install easyimageconvert
View on GitHub

Java SDK

Our Java SDK provides a robust interface for Java applications.

<dependency>
    <groupId>com.easyimageconvert</groupId>
    <artifactId>easyimageconvert-java</artifactId>
    <version>1.0.0</version>
</dependency>
View on GitHub

Get Your API Key

Ready to integrate Easy Image Convert into your application? Sign up for a developer account to get your API key:

Sign Up for API Access

Already have an account? Log in to your developer dashboard to manage your API keys and view usage statistics.