Developer Center

Integrate Compressify into your apps with our simple, powerful REST API.

Getting Started

Compressify allows you to upload images and automatically receive optimized versions (WebP, JPEG, PNG, or AVIF) back, significantly reducing your payload sizes.

All authenticated API requests are served from your Compressify workspace under /api/v1.

WordPress Plugin Available

We provide an official WordPress plugin that automatically intercepts uploads and optimizes them via the API without destroying your media library metadata.

Authentication

You can authenticate using your API Key. Pass it in the Authorization header as a Bearer token or use the X-API-Key header.

Authorization: Bearer cf_live_your_api_key_here

Optimize Endpoint

Endpoint: POST /images/optimize

Send a multipart/form-data request containing the file.

Video optimization is also available

Use POST /videos/optimize to compress or transcode common inputs such as MP4, MOV, AVI, MKV, and WebM into web-ready mp4 or webm. Pair it with POST /videos/analyze if you want duration, codecs, bitrate, and dimensions before converting.

Examples

cURL

curl -X POST "https://your-compressify-workspace/api/v1/images/optimize" \
  -H "Authorization: Bearer cf_live_xxxxx" \
  -F "file=@/path/to/image.jpg" \
  -F "outputFormat=webp" \
  -F "quality=80" \
  -F "returnJson=true"

cURL (Video)

curl -X POST "https://your-compressify-workspace/api/v1/videos/optimize" \
  -H "Authorization: Bearer cf_live_xxxxx" \
  -F "file=@/path/to/video.mov" \
  -F "outputFormat=mp4" \
  -F "crf=28" \
  -F "returnJson=true"

PHP

$ch = curl_init('https://your-compressify-workspace/api/v1/images/optimize');
$cFile = new CURLFile('/path/to/image.jpg', 'image/jpeg', 'image.jpg');
$data = ['file' => $cFile, 'outputFormat' => 'webp', 'returnJson' => 'true'];

curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer cf_live_xxxxx']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
curl_close($ch);

Node.js (Fetch)

const formData = new FormData();
formData.append('file', fileInput.files[0]);
formData.append('outputFormat', 'webp');
formData.append('returnJson', 'true');

const response = await fetch('https://your-compressify-workspace/api/v1/images/optimize', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer cf_live_xxxxx' },
  body: formData
});
const data = await response.json();

ASP.NET (C#)

using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "cf_live_xxxxx");

using var content = new MultipartFormDataContent();
using var fileStream = File.OpenRead("/path/to/image.jpg");
content.Add(new StreamContent(fileStream), "file", "image.jpg");
content.Add(new StringContent("webp"), "outputFormat");
content.Add(new StringContent("true"), "returnJson");

var response = await client.PostAsync("https://your-compressify-workspace/api/v1/images/optimize", content);
var result = await response.Content.ReadAsStringAsync();