API Documentation

Everything you need to integrate the PixSqueeze batch compression API. All endpoints live under https://pixsqueeze-api-production.up.railway.app.

Authentication

Create an account to get an API key, then pass it as a Bearer token in every request: Authorization: Bearer psx_.... You can also sign up on this site and find your key in the dashboard.

POST /auth/register

curl -X POST https://pixsqueeze-api-production.up.railway.app/auth/register \
  -H "Content-Type: application/json" \
  -d '{"email":"you@example.com"}'

Response:

{
  "apiKey": "psx_...",
  "plan": "FREE",
  "monthlyLimit": 100,
  "message": "Account created. Keep your API key safe — it will not be shown again."
}

Your key is shown only once. Registering an existing email returns 409 — it never reveals the existing key.

POST /auth/rotate-key

Lost or leaked your key? Rotate it using your current key. The old key is revoked immediately.

curl -X POST https://pixsqueeze-api-production.up.railway.app/auth/rotate-key \
  -H "Authorization: Bearer psx_YOUR_CURRENT_KEY"

Compress images

POST /compress/batch

Send images as multipart form data. Compressed results are returned as base64-encoded files in a single JSON response.

curl -X POST https://pixsqueeze-api-production.up.railway.app/compress/batch \
  -H "Authorization: Bearer psx_YOUR_API_KEY" \
  -F "files[]=@photo1.jpg" \
  -F "files[]=@photo2.heic" \
  -F "quality=0.7" \
  -F "maxWidth=1280"

Form fields

files[]file · requiredOne or more image files (multipart). Repeat the field for each file.
qualitynumberCompression quality between 0 and 1. Default 0.8.
maxWidthnumberResize images wider than this to fit. Aspect ratio is preserved.
maxHeightnumberResize images taller than this to fit. Aspect ratio is preserved.
mimeTypestringForce an output format: image/jpeg, image/png, or image/webp.

Response:

{
  "processed": 2,
  "results": [
    { "originalName": "photo1.jpg",  "mimeType": "image/jpeg", "data": "base64..." },
    { "originalName": "photo2.heic", "mimeType": "image/jpeg", "data": "base64..." }
  ],
  "usage": { "used": 2, "limit": 100, "remaining": 98 }
}

Supported input formats: JPEG, PNG, WebP, GIF, HEIC/HEIF, TIFF, and camera RAW (CR2, NEF, ARW, DNG, and more).

Check usage

GET /usage

curl https://pixsqueeze-api-production.up.railway.app/usage \
  -H "Authorization: Bearer psx_YOUR_API_KEY"

Response:

{
  "plan": "FREE",
  "used": 3,
  "limit": 100,
  "remaining": 97,
  "resetDate": "2026-07-01"
}

Billing

Plans are managed from the dashboard, which uses these endpoints under the hood:

  • POST /billing/checkout — start a Stripe Checkout session for a plan upgrade
  • POST /billing/portal — open the Stripe customer portal

Errors

401Missing or invalid API key.
409An account with this email already exists. Keys are shown only once; rotate via /auth/rotate-key.
413Request body too large.
422Unsupported or unreadable image file.
429Monthly image limit reached. Upgrade your plan or wait for the reset date.
500Unexpected server error — retry with exponential backoff.

Ready to try it?

100 free images per month. No credit card required.