Server-side PDF compression powered by MuPDF. Compress any PDF to an exact target size (50KB, 1MB, 5MB...) with one call โ built for AI agents and developers.
/api/v1/compress?target=500000
Upload a PDF as the raw request body. Get the compressed PDF back with metadata headers.
curl -X POST "https://api.pdfslim.app/api/v1/compress?target=500000" \
--data-binary @input.pdf \
-o output.pdf
# Response headers:
# X-Pdf-Reduction: 82.3%
# X-Pdf-Reached-Target: true
# X-Pdf-Pages: 12
/api/v1/inspect
Get page count, size, and password status before processing.
curl -X POST "https://api.pdfslim.app/api/v1/inspect" \
--data-binary @input.pdf
# โ {"pages":12,"size_bytes":5821000,"size_mb":5.55,"needs_password":false}
/api/v1/optimize
Lossless optimization (garbage collection + stream re-compression).
Point any MCP client at:
https://api.pdfslim.app/mcp
Tools exposed:
| Tool | Purpose |
|---|---|
compress_pdf | Compress to target size (base64 in, base64 + stats out) |
optimize_pdf | Lossless optimization |
inspect_pdf | Page count / size / password check |
| Plan | Calls | Max file | Price |
|---|---|---|---|
| Anonymous | 20 / day / IP | 10 MB | Free |
| Starter Key | 5,000 / month | 100 MB | $9.9 / month |
Send your key: Authorization: Bearer YOUR_KEY
curl -X POST "https://api.pdfslim.app/api/v1/compress?target=1000000" \
-H "Authorization: Bearer YOUR_KEY" \
--data-binary @input.pdf -o output.pdf
PDF Slim API runs MuPDF (the C engine behind Ghostscript) compiled to WebAssembly on Cloudflare Workers. It renders each page and re-encodes at tuned quality/resolution โ the same strategy desktop tools use, with pixel-level control. Typical results: 82โ93% size reduction on scanned documents.