Build with the CookMyPDF API
Every tool on this site, callable from your code. 300 free credits per month — 1 job = 1 credit. Create an API key from your account page.
Quickstart
Three requests: get a presigned upload URL, create a job, download the result. Authenticate with Authorization: Bearer ff_live_….
# 1. Get an upload URL, saying how large the file is in bytes.
# The URL is signed for exactly that size; storage refuses any other.
curl -X POST https://api.cookmypdf.com/v1/uploads \
-H "Authorization: Bearer ff_live_..." \
-H "Content-Type: application/json" -d '{"files": [{"size": 48213}]}'
# 2. PUT that file to the returned url, then create the job
curl -X POST https://api.cookmypdf.com/v1/jobs \
-H "Authorization: Bearer ff_live_..." \
-H "Content-Type: application/json" \
-d '{"toolId": "compress-pdf", "inputKeys": ["up/<key>"], "options": {"level": "recommended"}}'
# 3. Poll until succeeded, then fetch download links
curl https://api.cookmypdf.com/v1/jobs/<id> -H "Authorization: Bearer ff_live_..."
curl https://api.cookmypdf.com/v1/jobs/<id>/download -H "Authorization: Bearer ff_live_..."Node.js
const API = 'https://api.cookmypdf.com';
const KEY = process.env.COOKMYPDF_API_KEY;
const headers = { authorization: `Bearer ${KEY}`, 'content-type': 'application/json' };
// Each upload URL is signed for one size; storage refuses any other.
const { uploads } = await (await fetch(`${API}/v1/uploads`, {
method: 'POST', headers, body: JSON.stringify({ files: [{ size: fileBytes.byteLength }] }),
})).json();
await fetch(uploads[0].url, { method: 'PUT', body: fileBytes });
const { id } = await (await fetch(`${API}/v1/jobs`, {
method: 'POST', headers,
body: JSON.stringify({ toolId: 'pdf-to-word', inputKeys: [uploads[0].key] }),
})).json();
let job;
do {
await new Promise(r => setTimeout(r, 700));
job = await (await fetch(`${API}/v1/jobs/${id}`, { headers })).json();
} while (job.status === 'queued' || job.status === 'processing');
const { urls } = await (await fetch(`${API}/v1/jobs/${id}/download`, { headers })).json();Python
import os, time, requests
API = "https://api.cookmypdf.com"
HEADERS = {"Authorization": f"Bearer {os.environ['COOKMYPDF_API_KEY']}"}
size = os.path.getsize("input.pdf") # each upload URL is signed for exactly this many bytes
uploads = requests.post(f"{API}/v1/uploads", json={"files": [{"size": size}]}, headers=HEADERS).json()["uploads"]
requests.put(uploads[0]["url"], data=open("input.pdf", "rb"))
job = requests.post(f"{API}/v1/jobs", headers=HEADERS, json={
"toolId": "compress-pdf", "inputKeys": [uploads[0]["key"]],
}).json()
while True:
status = requests.get(f"{API}/v1/jobs/{job['id']}", headers=HEADERS).json()
if status["status"] in ("succeeded", "failed"):
break
time.sleep(0.7)
urls = requests.get(f"{API}/v1/jobs/{job['id']}/download", headers=HEADERS).json()["urls"]Webhooks
Pass webhookUrl (https) when creating a job and we POST the result to you when it finishes — signed with your key's webhook secret so you can prove it came from us:
// Verify X-CookMyPDF-Signature: t=<unix>,v1=<hex>
import { createHmac, timingSafeEqual } from 'node:crypto';
function verify(body, header, webhookSecret) {
const [t, v1] = [/t=(\d+)/, /v1=([0-9a-f]+)/].map(re => re.exec(header)?.[1]);
if (!t || !v1 || Math.abs(Date.now() / 1000 - Number(t)) > 300) return false;
const expected = createHmac('sha256', webhookSecret).update(`${t}.${body}`).digest('hex');
return expected.length === v1.length && timingSafeEqual(Buffer.from(expected), Buffer.from(v1));
}Reference
- Official SDKs:
npm install @cookmypdf/sdk·pip install cookmypdf— both wrap the upload/poll/download sequence in one call and verify webhook signatures for you - Full OpenAPI 3.1 spec: /v1/openapi.json
- Every tool and its options: tool reference — machine-readable at /v1/tools
- Keys carry scopes (
jobs:read,jobs:write,ai,sign:write) and a per-key rate limit. Grant only what an integration needs — a key withoutaicannot spend your AI credits. Missing scope returns403; over the limit returns429 - Credits: free 300/mo · Premium 2,000/mo · Business 10,000/mo — pricing
- Files auto-delete within 1 hour; download links live 15 minutes — privacy & security
- Service status: status page