Image compression API tutorial
MiniPic offers an image compression API that is compatible with the HTTP Basic / Bearer auth and response shape of popular compression services, so in most cases you can migrate from TinyPNG and similar services just by swapping the API endpoint and key. Our in-house engine shrinks PNG, JPEG and WebP by 60% on average with no visible quality loss, there is a free monthly quota, and you are only billed for successful compressions. For the full endpoint reference, see the developer docs (minipic.cn/docs).
Why choose the MiniPic image compression API
- Compatible with popular compression APIs: matching auth and response shape — in most cases you integrate by swapping endpoint and key.
- Fast, low latency: quick uploads and responses, so service calls don't stall.
- Free monthly quota: resets on the first day of each month — plenty to get a typical project started.
- Billed only for successful compressions: failures, oversized files and blocked requests are never billed.
Integrate in 3 steps
Step 1: create an API key in the console
Sign in to the MiniPic console and go to API key management to create a key. Keys are prefixed mp_live_ (production) / mp_test_ (sandbox); the full key is shown only once at creation, so store it safely.
Step 2: send your first compression request
Use HTTP Basic auth (username is always api, password is your key) to compress an image:
Step 3: get and download the result
The compatibility endpoint /shrink returns 201 Created, with the result served over an encrypted private link that only you (the key holder) can access; the native /v1/compress endpoint returns the compressed binary directly. Re-downloading the same result is not billed.
Node.js example
Python example
Migrating from the TinyPNG API
MiniPic is compatible with the auth and response shape of popular compression services, so in most cases you can migrate from TinyPNG and similar services just by swapping the API endpoint and key, with no changes to your application code. Point the base URL at MiniPic (minipic.cn), swap in your MiniPic API key, and start compressing.
Quota, rate limits and billing
- Free quota: a fixed number of requests per month, resetting on the first day of each month.
- Tiered pricing: the per-image rate decreases as your monthly volume grows.
- Billing: you are charged only for successful compressions; failures, oversized files and blocked requests are never billed.
- Rate limit: 10 req/s per key, burst 20; exceeding it returns 429 +
Retry-After.
For the full endpoint reference and error-code table, see the developer docs; for the pricing tiers, see the pricing page; for billing details, see billing.
Frequently asked questions
How do I integrate the MiniPic image compression API?
Create an API key in the MiniPic console, then send your request to the compression endpoint using HTTP Basic auth (username api, password your key) or a Bearer token. The API is compatible with the auth and response shape of popular compression services, so in most cases you only need to swap the endpoint and the key.
Is the MiniPic image compression API free?
There is a free monthly quota that resets on the first day of each month. Beyond that, usage is billed per successfully compressed image at tiered rates. You are only charged for successful compressions — failures, oversized files and blocked requests are never billed.
Can I migrate from the TinyPNG API to MiniPic?
Yes. The MiniPic /shrink endpoint is compatible with the auth and response shape of popular compression services, so in most cases you can migrate by changing the API endpoint and key, with no changes to your application code.
Integrate in 3 steps, with a free monthly quota
Create an API key, then swap endpoint and key to start compressing.