Developer API
Pro and Team accounts can create API keys and call a small set of endpoints from scripts or backends. Keys are shown once. Successful jobs count against the same daily jobs and credits as the website.
Create a key in your account. Free accounts can follow the docs, then upgrade to call the API.
Node client
The same @mypdf/api-client package the Expo app uses. Copy packages/api-client into your repo, or point at this file. The key stays on your server.
const { createApiClient } = require("@mypdf/api-client");
const fs = require("fs");
const client = createApiClient({
baseUrl: "https://mypdf.io",
apiKey: process.env.PDFTOOLS_API_KEY,
});
const usage = await client.usage();
const merged = await client.merge([
fs.readFileSync("one.pdf"),
fs.readFileSync("two.pdf"),
], ["one.pdf", "two.pdf"]);
fs.writeFileSync("merged.pdf", merged);Make / n8n
One HTTP request is enough. Create a Pro or Team key on Account, then POST multipart files with Authorization: Bearer pdf_live_…. Download the n8n merge recipe and import it (Workflow → Import from File). In Make, use the HTTP module the same way: POST https://mypdf.io/api/v1/merge, header auth, two file fields named files. Compress is async — POST /api/v1/compress, then poll /api/v1/jobs/:id until done. Zapier and Drive import are not built.
POST https://mypdf.io/api/v1/merge Authorization: Bearer pdf_live_... Content-Type: multipart/form-data files=@one.pdf files=@two.pdf
Authentication
Send the key as a Bearer token from a server or script. Never put a pdf_live_ key in a webpage, mobile app, or public repo — this API allows any origin because it is meant for backend calls, not browsers.
Authorization: Bearer pdf_live_...
GET /api/v1/usage
Returns the current plan, jobs used today, and credit balance. This call does not consume a job.
curl -H "Authorization: Bearer $PDFTOOLS_API_KEY" \ https://mypdf.io/api/v1/usage
POST /api/v1/merge
Upload at least two PDFs as multipart files. The response is the merged PDF. Up to 20 files per request. File size follows your plan.
curl -X POST \ -H "Authorization: Bearer $PDFTOOLS_API_KEY" \ -F "files=@one.pdf" \ -F "files=@two.pdf" \ --output merged.pdf \ https://mypdf.io/api/v1/merge
POST /api/v1/signing/requests
Create a request-signature link the same way the website does. Optional placements is a JSON array of page fields. Optional message is shown to the signer. Optional signerEmail emails them the link when SMTP is configured.
curl -X POST \
-H "Authorization: Bearer $PDFTOOLS_API_KEY" \
-F "file=@contract.pdf" \
-F "message=Please sign page 1" \
-F "signerEmail=alex@office.com" \
-F 'placements=[{"pageIndex":0,"x":0.12,"y":0.72,"width":0.28,"height":0.08}]' \
https://mypdf.io/api/v1/signing/requestsPOST /api/v1/compress
Queue a Ghostscript compress job. The request returns immediately with a job id. A daily job is consumed only when compression succeeds. Optional compressionLevel is 1 (high quality), 2 (balanced, default), or 3 (smallest). Files are kept for 60 minutes.
curl -X POST \ -H "Authorization: Bearer $PDFTOOLS_API_KEY" \ -F "file=@large.pdf" \ -F "compressionLevel=2" \ https://mypdf.io/api/v1/compress
GET /api/v1/jobs/:id
Poll a job created by compress. Status is queued, processing, done, or error. This call does not consume a job.
curl -H "Authorization: Bearer $PDFTOOLS_API_KEY" \ https://mypdf.io/api/v1/jobs/JOB_ID
GET /api/v1/jobs/:id/file
Download the finished PDF. Returns 409 while the job is still running.
curl -H "Authorization: Bearer $PDFTOOLS_API_KEY" \
--output compressed.pdf \
https://mypdf.io/api/v1/jobs/JOB_ID/filePOST /api/v1/split
Split a PDF into a ZIP of parts. Default mode=each writes one PDF per page. mode=ranges uses ranges or pages such as 1-3,5. The response is a ZIP.
curl -X POST \ -H "Authorization: Bearer $PDFTOOLS_API_KEY" \ -F "file=@report.pdf" \ -F "mode=ranges" \ -F "ranges=1-2,4" \ --output split.zip \ https://mypdf.io/api/v1/split
POST /api/v1/extract
Keep only the listed pages and return one PDF. pages accepts odd, even, 1,3,5, or 1-3,5.
curl -X POST \
-H "Authorization: Bearer $PDFTOOLS_API_KEY" \
-F "file=@report.pdf" \
-F "pages=1-2,5" \
--output extracted.pdf \
https://mypdf.io/api/v1/extractPOST /api/v1/image-extract
OCR a JPG or PNG with Tesseract and return structured output. Optional format is json (default), text, xlsx, csv, or docx. Optional language uses the same codes as website OCR (default eng). xlsx and csv return 422 with code: no_table when no table is reconstructed — this is not a one-column OCR dump. Empty images return 422 no_text. The website Image to JSON job stays in the browser; this endpoint runs OCR on the server.
curl -X POST \ -H "Authorization: Bearer $PDFTOOLS_API_KEY" \ -F "file=@scan.png" \ -F "format=json" \ -F "language=eng" \ https://mypdf.io/api/v1/image-extract
POST /api/v1/rotate
Rotate pages clockwise. degrees must be 90, 180, or 270. Optional pages uses the same list as extract. Omit pages to rotate every page.
curl -X POST \ -H "Authorization: Bearer $PDFTOOLS_API_KEY" \ -F "file=@scan.pdf" \ -F "degrees=90" \ -F "pages=1,3" \ --output rotated.pdf \ https://mypdf.io/api/v1/rotate
POST /api/v1/protect
Password-protect a PDF with 256-bit encryption. The response is the locked file. Requires qpdf on the server.
curl -X POST \ -H "Authorization: Bearer $PDFTOOLS_API_KEY" \ -F "file=@contract.pdf" \ -F "password=change-me" \ --output protected.pdf \ https://mypdf.io/api/v1/protect
POST /api/v1/unlock
Remove a password from a PDF. The response is the unlocked file. Requires qpdf on the server.
curl -X POST \ -H "Authorization: Bearer $PDFTOOLS_API_KEY" \ -F "file=@locked.pdf" \ -F "password=change-me" \ --output unlocked.pdf \ https://mypdf.io/api/v1/unlock
POST /api/v1/ai
Send an instruction and optional document text. The response is a plan that names one existing MyPDF tool, plus heuristic fields and confidence when text is present. It does not run compress, merge, OCR, or a multi-step workflow. Pro and Team API key required. One job on 2xx.
curl -X POST \
-H "Authorization: Bearer $PDFTOOLS_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"instruction\":\"Extract: Vendor, Invoice number, Total\",\"text\":\"Invoice number INV-1042 Total $18.00\"}" \
https://mypdf.io/api/v1/aiWebhooks
Add an HTTPS endpoint in your account. We POST JSON for job.completed, job.failed, and signing.completed. The signing secret is shown once. Verify PDFTools-Signature as HMAC-SHA256(secret, timestamp + "." + rawBody).
const crypto = require("crypto");
function verify(rawBody, header, secret) {
const parts = Object.fromEntries(
header.split(",").map((item) => item.split("="))
);
const expected = crypto
.createHmac("sha256", secret)
.update(`${parts.t}.${rawBody}`)
.digest("hex");
return crypto.timingSafeEqual(
Buffer.from(parts.v1, "hex"),
Buffer.from(expected, "hex")
);
}