Developer API

REST API reference

Compress files programmatically. Same engine, same credit billing as the dashboard.

Authentication

Create a key under Dashboard → API keys. Send it as a Bearer token (or the X-Api-Key header).

# Base URL https://ads.webnet.vip/api/v1 # Header Authorization: Bearer ak_live_xxxxxxxxxxxx
POST/api/v1/compress

Compress one file. Send it as multipart file, or JSON with file_base64.

FieldValuesNotes
filebinaryThe source image/PDF (multipart).
qualitybalanced · high · maxDefault balanced. max = smallest.
outputwebp · jpeg · pngConvert images to this format (Webnet AI engine). Omit to keep the source format. PDFs always stay PDF.
returnjson · base64 · binarybinary streams the file back directly.

Example — cURL

curl -X POST https://ads.webnet.vip/api/v1/compress \
  -H "Authorization: Bearer ak_live_xxx" \
  -F "file=@invoice.pdf" \
  -F "quality=max" \
  -F "return=binary" -o invoice.min.pdf

Example — JSON response

{
  "ok": true,
  "job": {
    "token": "a1b2c3…",
    "status": "done",
    "original_size": 1048576,
    "compressed_size": 184320,
    "saved_percent": 82.4,
    "credits_charged": 2,
    "download_url": "https://ads.webnet.vip/api/v1/jobs/a1b2c3…/download"
  },
  "balance": 148
}
GET/api/v1/balance

Returns the authenticated account's remaining credits.

GET/api/v1/jobs

Lists recent jobs (?limit=20). Use /api/v1/jobs/{token} for one job and /download for its file.

Errors

CodeMeaning
401Missing or invalid API key.
402Insufficient credits.
422Unsupported file / compression failed (not charged).