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/compressCompress one file. Send it as multipart file, or JSON with file_base64.
| Field | Values | Notes |
|---|---|---|
| file | binary | The source image/PDF (multipart). |
| quality | balanced · high · max | Default balanced. max = smallest. |
| output | webp · jpeg · png | Convert images to this format (Webnet AI engine). Omit to keep the source format. PDFs always stay PDF. |
| return | json · base64 · binary | binary 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/balanceReturns the authenticated account's remaining credits.
GET
/api/v1/jobsLists recent jobs (?limit=20). Use /api/v1/jobs/{token} for one job and /download for its file.
Errors
| Code | Meaning |
|---|---|
| 401 | Missing or invalid API key. |
| 402 | Insufficient credits. |
| 422 | Unsupported file / compression failed (not charged). |