Compress PDF API
Send a PDF URL and get back a lighter file — images resampled for the screen, text and vector graphics kept sharp. Made for email attachments, uploads and storage bills.
- Free plan
- No credit card
Request
curl -X POST https://apdf.io/api/pdf/file/compress \
-H "Authorization: Bearer TOKEN" \
-d file="FILE_URL"
const data = new FormData();
data.append('file', 'FILE_URL');
fetch('https://apdf.io/api/pdf/file/compress', {
headers: {'Authorization': 'Bearer TOKEN'},
method: 'POST',
body: data
})
.then(response => response.json())
.then(json => console.log(json));
use GuzzleHttp\Client;
$client = new Client();
$response = $client->post(
'https://apdf.io/api/pdf/file/compress', [
'headers' => [
'Authorization' => 'Bearer TOKEN'
],
'form_params' => [
'file' => 'FILE_URL'
]
]);
$body = $response->getBody();
echo json_encode($body->getContents());
require 'rest-client'
response = RestClient.post(
'https://apdf.io/api/pdf/file/compress',
{
'file' => 'FILE_URL'
},
{
Authorization: "Bearer TOKEN"
}
)
puts response.body
import requests
response = requests.post(
'https://apdf.io/api/pdf/file/compress',
headers = {
'Authorization': 'Bearer TOKEN'
},
data = {
'file': 'FILE_URL'
}
)
print(response.text)
import (
"fmt"
"github.com/go-resty/resty/v2"
)
func main() {
client := resty.New()
data := map[string]string{
"file": "FILE_URL"
}
resp, _ := client.R().
SetFormData(data).
SetHeader("Authorization", "Bearer TOKEN").
Post("https://apdf.io/api/pdf/file/compress")
fmt.Println(resp.String())
}
import okhttp3.*;
class Pdf {
public static void main(String[] args) throws Exception {
OkHttpClient client = new OkHttpClient();
FormBody formBody = new FormBody.Builder()
.add("file", "FILE_URL")
.build();
Request request = new Request.Builder()
.url("https://apdf.io/api/pdf/file/compress")
.addHeader("Authorization", "Bearer TOKEN")
.post(formBody)
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
Lighter files.
Same document.
Compression goes after the heavy images, not the content.
If there is nothing to gain, your file comes back unchanged.
- Photos and color scans
- Resampled to 150 dpi
- Text
- Stays text, sharp and selectable
- Vector graphics
- Stay vector, as sharp as before
- No real saving
- You get the original back
- The response
- Both sizes, to log the saving
Small enough to send.
Heavy PDFs bounce, stall and pile up in storage. Compress them on the way out or on the way in.
Under the attachment limit
Shrink the reports your app emails before they hit your mail provider's attachment limit and bounce.
Lower storage bills
Compress user uploads before they land in your bucket, so every stored copy and every backup costs less.
Faster on mobile
Serve lighter PDFs to customers on slow connections, so the document opens instead of loading forever.
Phone scans and photos
Bring receipts and paperwork captured at full camera resolution down to a size that fits the rest of your files.
Compress from anywhere.
Shrink files right where they already live.
One account and one monthly allowance behind every route.
One authenticated POST from any language. Copy-paste samples in cURL, Node.js, Python and more.
POST /api/pdf/file/compress
Pick the action in any Zap and map files from earlier steps. No code and no servers to run.
Compress PDF
Add the Apdf node to any workflow, on n8n Cloud or self-hosted, and chain it with your automation.
Compress PDF
Let Claude, ChatGPT, Gemini or your own agent run it through the MCP server, on any paid plan.
compress-pdf-file
1,000 compressions
a month. Free.
Start on the free plan and move up only when your volume does — up to 1,000,000 operations a month on Business.
- One call is one operation, however many pages.
- Only calls that do the work are counted.
- Hard limits, so no surprise overage charges.
Compressing PDFs, answered
Compress PDF tutorials
Compress a Folder of PDFs with Claude Code
Batch compression without the batch script: hand Claude Code a folder of hosted PDFs and the agent loops the compress tool over every file, polls the jobs, and reports honestly — a 74 MB board pack collapses 94%, a lean text file shaves 4%, and an optimized scan keeps its original.
Compress Large PDFs for Email Attachments with Node.js
Reduce PDF file sizes before sending email attachments using Node.js and the Apdf Compress API. Avoid bounced emails, improve deliverability, and save bandwidth with automatic compression that can shrink files by 50-90%.
Reduce AWS S3 Costs by Automating PDF Compression
This tutorial shows how to cut AWS S3 storage costs by compressing PDFs before storing them. Using Java and the Apdf Compress API, developers can achieve up to 90% file size reduction on image-heavy PDFs, directly translating into lower storage bills.
Your code made the PDF.
Then it went dark.
Opened, read, re-read, dropped on page 4 — you never see any of it. Share the PDFs you generate through Apdf recipient links, and every signal becomes something you can act on: ping Slack, update the CRM, let an agent follow up. Same account, same API token, one more call.
API · Webhook · MCP