Quickstart
You need:
- An account at pixozip.pretzl.dev.
- An API key created at Dashboard → API keys (the plaintext is shown once).
cURL
curl -X POST https://api.pixozip.pretzl.dev/v1/shrink \
-H "Authorization: Bearer img_live_..." \
-H "Content-Type: image/jpeg" \
-H 'X-Options: {"output":"webp","quality":80,"qualityTier":"balanced"}' \
--data-binary @photo.jpgResponse:
{
"jobId": "f5012a57-9bd7-47b9-9eaf-6f9c00356872",
"status": "completed",
"outputBytes": 8465,
"ratio": 0.74,
"width": 600,
"height": 360,
"outputFormat": "webp",
"downloadUrl": "https://storage.pixozip.pretzl.dev/pixozip/out/.../?X-Amz-..."
}Download the optimized bytes from downloadUrl (valid 1 h).
Node.js
npm install @pixozip/sdkimport { Pixozip } from "@pixozip/sdk";
import { readFile, writeFile } from "node:fs/promises";
const client = new Pixozip({ apiKey: process.env.PIXOZIP_API_KEY! });
const bytes = await readFile("photo.jpg");
const res = await client.shrink(bytes, { contentType: "image/jpeg", qualityTier: "max" });
await writeFile("photo.opt.jpg", await res.download());
console.log(`saved ${Math.round(res.ratio! * 100)}%`);PHP
require __DIR__ . '/Pixozip.php';
$c = new \Pixozip\Pixozip(['apiKey' => getenv('PIXOZIP_API_KEY')]);
$res = $c->shrink(file_get_contents('photo.jpg'), [
'contentType' => 'image/jpeg',
'qualityTier' => 'balanced',
]);
file_put_contents('photo.opt.jpg', $c->download($res['downloadUrl']));Idempotency
Pass Idempotency-Key: <random> to make the request safe to retry — the same
key always resolves to the same job (no double charge).