Skip to main content
POST
Compress image

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.