Developers

Image compression API

MiniPic’s image compression API is compatible with the authentication and response format of popular compression APIs, so you can migrate by swapping the endpoint and key. You get 500 free calls a month when you sign up, and you’re billed only for successful compressions.

500 free calls a month after sign-up · Billed only for successful compressions · Resource packs never expire

Compatibility layer /shrink
# Compress a PNG: HTTP Basic auth, username is always api, password is your API key
curl -i https://api.minipic.cn/shrink \
  --user api:YOUR_API_KEY \
  --data-binary @input.png
# Returns 201 Created on success; download the compressed image from the result link in the response

Two layers

Two layers: the /shrink compatibility layer and the /v1 native layer.

Compatibility layer

POST /shrink

Compatible with the authentication and response format of popular compression APIs, so you can migrate by swapping the endpoint and key.

  • Upload the binary, or pass a public URL
  • GET /output/{id} downloads the result
  • POST /output/{id} derived operations: resize (scale / fit / cover), convert (between PNG / JPEG / WebP), preserve (keep metadata)

Native layer

POST /v1/compress

A synchronous endpoint that returns the compressed result directly.

  • quality: smart / high / extreme / 1-100
  • format: keep / webp
  • GET /v1/usage checks your usage

Quick start

Integrate in three steps.

API integration guide

  1. Create an API key

    Sign in to the console and create an API key: keys starting with mp_live_ are for production, and mp_test_ for the sandbox. The full key is shown only once, when it’s created.

  2. Send a request

    Authenticate with HTTP Basic (username api, password your key) or Bearer, and call /shrink or /v1/compress.

  3. Get the result

    With /shrink, download from the result link in the response; /v1/compress returns the compressed image directly. Downloading the same result again isn’t billed.

Free quota & billing

Free quota and billing: you pay only for successful compressions.

Resets at 00:00 Beijing time on the 1st of each month; Team gets 3,000 calls a month, shared across the team.

Downloading the same result again isn’t billed; each derived operation counts as 1 image; failures, oversized files and blocked requests don’t count.

500 calls/mo

Free when you sign up

1,000 calls/mo

Pro

Resource packs

Resource packs never expire, with tiered pricing.

Once the free quota runs out, you use prepaid resource packs, with no monthly pay-as-you-go billing.

View pricing

10,000 images

¥450¥315

Never expires.

100,000 images

¥1,200¥840

Never expires.

1,000,000 images

¥7,000¥4,900

Never expires.

Auth & limits

Authentication, rate limits and per-file size caps.

Authentication

Basic or Bearer

Up to 5 keys per account; the server stores only a hash of each key.

Rate limit

10 requests/sec

Bursts of up to 20 per key; no more than 20 tasks in progress at once per key.

Per file

5 MB / 80 MB

5 MB free, 80 MB paid; up to 100 megapixels per image.

Formats

Supported formats.

The original format is kept by default; HEIC is converted to JPEG and BMP to PNG, and you can also convert to WebP. GIF gets lossless optimization by default, and SVG gets source-level optimization only.

Not yet supported: AVIF as a conversion target, smart thumbnails, and direct upload to object storage.

FAQ

Is the image compression API free?

You get 500 calls a month when you sign up (reset at 00:00 Beijing time on the 1st of each month); Pro includes 1,000 a month and Team 3,000 a month. Beyond that, you use prepaid resource packs.

How do I migrate from TinyPNG?

The /shrink endpoint is compatible with the authentication and response format of popular compression APIs, so in most cases you just swap the API endpoint and key.

Do failed compressions count?

No. Only successful compressions are billed; failures, oversized files and blocked requests don’t count.

Do resource packs expire?

No. Resource packs never expire.

Which formats does the API support?

It compresses PNG, JPEG, WebP, GIF, TIFF, AVIF and SVG, and accepts HEIC and BMP as input.