Skip to main content
POST
/
v1
/
compress
Compress image
curl --request POST \
  --url https://api.compresto.app/v1/compress \
  --header 'Content-Type: multipart/form-data' \
  --header 'X-API-Key: <api-key>' \
  --form image='@example-file' \
  --form quality=80 \
  --form format=auto \
  --form maxWidth=2 \
  --form maxHeight=2
"<string>"

Authorizations

X-API-Key
string
header
required

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

Query Parameters

quality
integer
default:80

Compression quality (1-100). Overrides body parameter.

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

Output format. Overrides body parameter.

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

Maximum width in pixels. Preserves aspect ratio.

Required range: x >= 1
maxHeight
integer

Maximum height in pixels. Preserves aspect ratio.

Required range: x >= 1

Body

image
file
required

Image file to compress

quality
integer
default:80

Compression quality

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

Output format

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

Maximum width in pixels

Required range: x >= 1
maxHeight
integer

Maximum height in pixels

Required range: x >= 1

Response

Compressed image binary

The response is of type file.