PicZipper API Documentation

Optimize your images with our powerful web-based API.

Authentication

The API requires authentication using a Bearer Token. Each request must include an Authorization header:

Authorization: Bearer YOUR_API_KEY

Base URL

https://piczipper.com/api/

Upload and Compress Image

Endpoint: POST /compress

Headers:

{
  "Authorization": "Bearer YOUR_API_KEY",
  "Content-Type": "multipart/form-data"
}

Parameters:

Example Requests

PHP

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://piczipper.com/api/compress");
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Authorization: Bearer YOUR_API_KEY"]);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, [
    'image' => new CURLFile('path/to/image.jpg'),
    'quality' => 80
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
    

Node.js

const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');

const form = new FormData();
form.append('image', fs.createReadStream('path/to/image.jpg'));
form.append('quality', '80');

axios.post('https://piczipper.com/api/compress', form, {
    headers: {
        'Authorization': 'Bearer YOUR_API_KEY',
        ...form.getHeaders()
    }
}).then(response => console.log(response.data))
.catch(error => console.error(error));
    

Java

OkHttpClient client = new OkHttpClient();
RequestBody body = new MultipartBody.Builder()
    .setType(MultipartBody.FORM)
    .addFormDataPart("image", "image.jpg",
        RequestBody.create(new File("path/to/image.jpg"), MediaType.parse("image/jpeg")))
    .addFormDataPart("quality", "80")
    .build();

Request request = new Request.Builder()
    .url("https://piczipper.com/api/compress")
    .addHeader("Authorization", "Bearer YOUR_API_KEY")
    .post(body)
    .build();

Response response = client.newCall(request).execute();
System.out.println(response.body().string());
    

Python

import requests

url = "https://piczipper.com/api/compress"
headers = {"Authorization": "Bearer YOUR_API_KEY"}
files = {"image": open("path/to/image.jpg", "rb")}
data = {"quality": 80}

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

Response Format

{
  "status": "success",
  "compressed_url": "https://piczipper.com/api/compressed/image.jpg",
  "original_size": "2MB",
  "compressed_size": "500KB"
}