Skip to main content
POST
/
v1
/
compress
Compress image
curl --request POST \
  --url https://api.compresto.app/v1/compress \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "image": "<string>",
  "url": "<string>",
  "quality": 80,
  "format": "auto",
  "maxWidth": 2,
  "maxHeight": 2
}
'
"<string>"

Authorizations

X-API-Key
string
header
required

API key for authentication. Get your key at https://compresto.app/dashboard

Body

Provide either 'image' (base64) or 'url'. If both are provided, 'url' takes priority.

image
string

Base64-encoded image (with or without data URI prefix)

url
string<uri>

Public image URL (https)

quality
integer
default:80

Compression quality (1-100)

Required range: 1 <= x <= 100
format
enum<string>
default:auto

Output format

Available options:
auto,
jpeg,
png,
webp
maxWidth
integer

Maximum width in pixels (maintains aspect ratio)

Required range: x >= 1
maxHeight
integer

Maximum height in pixels (maintains aspect ratio)

Required range: x >= 1

Response

Compressed image binary

The response is of type file.