PDF Coder API
Every PDF Coder tool is available over a REST API, except Edit PDF, which works in the browser only. AI assistants and agents can use the same tools through our MCP server.
Interactive API documentation · Reference · OpenAPI schema · MCP server
Get an API key
Create a key on your account page and send it in the X-API-Key header. The API also answers without a key, at the limits for visitors without an account.
Quick start
Send files as multipart/form-data in the field file, or give a public https address in file_url. The answer has a download_url; text results (text, Markdown, HTML, OCR) also come back inline in metadata.text.
curl
curl -X POST https://pdfcoder.com/api/v1/compress/ \
-H "X-API-Key: YOUR_API_KEY" \
-F "file=@report.pdf" -F "level=recommended"
curl -X POST https://pdfcoder.com/api/v1/convert/pdf-to/ \
-H "X-API-Key: YOUR_API_KEY" \
-F "file_url=https://example.com/paper.pdf" -F "format=md"
Python
import requests
API = "https://pdfcoder.com/api/v1"
headers = {"X-API-Key": "YOUR_API_KEY"}
with open("scan.pdf", "rb") as f:
r = requests.post(f"{API}/ocr/", headers=headers, files={"file": f}, data={"language": "eng"})
r.raise_for_status()
data = r.json()["data"]
print(data["metadata"]["text"]) # the recognised text
pdf = requests.get("https://pdfcoder.com" + data["download_url"]).content # searchable PDF
JavaScript (Node 18+)
import { readFile } from "node:fs/promises";
const form = new FormData();
form.append("file", new Blob([await readFile("form.pdf")]), "form.pdf");
form.append("values", JSON.stringify({ full_name: "Ana García", agree: true }));
form.append("flatten", "true");
const r = await fetch("https://pdfcoder.com/api/v1/forms/fill/", {
method: "POST", headers: { "X-API-Key": "YOUR_API_KEY" }, body: form,
});
const { data } = await r.json();
console.log(data.download_url);
What the API can do
- Compress PDFs
- Merge PDFs
- Split a PDF into pages
- Add a text or image watermark
- Password-protect a PDF
- Remove a PDF password
- Add a typed signature
- Rotate pages
- Delete pages
- Extract pages
- Add page numbers
- Reorder, rotate, duplicate and delete pages
- Crop pages
- Repair a damaged PDF
- Flatten form fields and comments
- Turn a web page into a PDF
- Turn text into a PDF
- Convert a PDF to PDF/A
- Convert Office, OpenDocument, RTF, HTML, Markdown, text and EPUB files to PDF
- Convert a PDF to Word, Excel, PowerPoint, text, Markdown, HTML, EPUB or images, with OCR for scans
- Put images into one PDF
- List a form's fields
- Fill in PDF forms
- Redact areas for good
- List links
- Remove links
- Make scanned PDFs and images searchable with OCR
- Compare two PDFs
- Generate invoices, quotes and receipts
Limits and errors
Each call counts against the key owner's plan: tasks per day, file size and operations at the same time. The headers X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset show today's tasks. Over a limit the answer is TASK_LIMIT (429), FILE_TOO_LARGE (413) or CONCURRENCY_LIMIT (429), with the limit in meta.
Results can be downloaded for 1 hour and are deleted automatically within 2 hours.