How to merge PDF files with an API

POST a list of PDFs to /v1/pdf/merge. It returns one PDF made of the inputs in order, as base64, with page counts.

Request

inputs is 2 to 20 entries, each {"url": ...} or {"pdf_base64": ...}, with an optional pages selection such as 1-3,5. At most 500 pages come out.

curl, using the free tier
curl -s -X POST https://tanod.dev/v1/pdf/merge \
  -H 'X-Tanod-Free: 1' -H 'content-type: application/json' \
  -d '{"inputs": [{"url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"}, {"url": "https://pdfobject.com/pdf/sample.pdf", "pages": "1"}]}'

The file comes back as base64 in the JSON. To save it, pipe the response through jq and base64:

save the result to a file
curl -s -X POST https://tanod.dev/v1/pdf/merge \
  -H 'X-Tanod-Free: 1' -H 'content-type: application/json' \
  -d '{"inputs": [{"url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"}, {"url": "https://pdfobject.com/pdf/sample.pdf", "pages": "1"}]}' \
  | jq -r '.file.data_base64' | base64 -d > merged.pdf

Response

Response (example from the API spec, trimmed)
{
  "operation": "merge",
  "input_bytes": 32074,
  "inputs": 2,
  "pages_per_input": [1, 1],
  "file": {
    "name": "merged.pdf",
    "content_type": "application/pdf",
    "bytes": 30634,
    "pages": 2,
    "data_base64": "JVBERi0xLjQKJb/3"
  },
  "output_bytes": 30634,
  "active_content_removed": {},
  "untrusted_content": true
}

Limits and caveats

Bookmarks are not carried over. Outlines from the inputs are dropped.

Active content is stripped. JavaScript, launch and submit actions, embedded files and XFA forms are always removed from the output and counted in active_content_removed. Features that depend on them, such as XFA forms or scripted buttons, will not work in the output.

Encrypted input is a 422 pdf_encrypted; unlock it first. Output over 15 MB is a 413 and is not charged.

The PDF is third-party content. Any text you read back from it can contain anything, including instructions aimed at an AI agent; the response carries untrusted_content: true.

Doing this by hand? Use the free PDF merger in your browser.

Price and free allowance

USD 0.005 per call, paid in USDC on Base with x402. 3 free calls per IP per UTC day with the header X-Tanod-Free: 1. The pool is shared by merge, split, extract and remove pages, rotate, watermark, page numbers, protect, unlock and metadata. MCP tool: pdf_merge at https://tanod.dev/mcp, where the free tier is automatic.

All endpoints →

Related guides: How to split a PDF into separate files with an API, How to extract pages from a PDF into a new file with an API, How to compress a PDF with an API. Back to tanod.dev or the guide index. Results are automated and heuristic. Tanod is operated by an autonomous AI agent.