🛠️

PDF Merge

Merge multiple PDF documents into a single file

POST 1 credit /pdf/merge
curl -X POST "https://pdf.toolkitapi.io/pdf/merge" \
  -H "Content-Type: application/json" \
  -d '{
    "pdf_urls": [
      "https://toolkitapi.io/report-q1.pdf",
      "https://toolkitapi.io/report-q2.pdf"
    ]
  }'
import httpx

resp = httpx.post(
    "https://pdf.toolkitapi.io/pdf/merge",
    json={
    "pdf_urls": [
      "https://toolkitapi.io/report-q1.pdf",
      "https://toolkitapi.io/report-q2.pdf"
    ]
  },
)
print(resp.json())
const resp = await fetch("https://pdf.toolkitapi.io/pdf/merge", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "pdf_urls": [
      "https://toolkitapi.io/report-q1.pdf",
      "https://toolkitapi.io/report-q2.pdf"
    ]
  }),
});
const data = await resp.json();
console.log(data);
# See curl example
Response 200 OK
{
  "pdf": "JVBERi0xLjcKMSAwIG9iago8PC...",
  "page_count": 14,
  "file_size": 245832,
  "input_count": 2
}

Description

Merge multiple PDF documents into a single file

How to Use

1

1. Provide a list of PDFs to merge — either as `pdfs` (base64-encoded strings) or `pdf_urls` (public URLs). You must use one or the other, not both.

2

2. Order the list in the sequence you want pages to appear in the final document. The first PDF's pages come first, then the second's, and so on.

3

3. Send a POST request and check the `page_count` field in the response to confirm all pages were included.

4

4. Decode the base64 `pdf` field to save the merged document.

About This Tool

PDF Merge combines two or more PDF documents into a single file in the order you provide them. Use this tool when you need to consolidate separate reports, invoices, or chapters into one cohesive document.

You can supply PDFs as base64-encoded strings or as publicly accessible URLs. The endpoint accepts between 2 and 20 documents per request, preserving the original page content, bookmarks, and formatting.

Why Use This Tool

Frequently Asked Questions

How many PDFs can I merge at once?
You can merge between 2 and 20 PDF documents in a single request. For larger batches, merge in groups and then merge the results.
Are bookmarks and links preserved?
Page content and formatting are fully preserved. Internal bookmarks and cross-references within individual documents are maintained, though inter-document links may need updating.
Can I mix base64 and URL sources?
No. You must provide all documents as either base64-encoded strings (`pdfs`) or as URLs (`pdf_urls`). You cannot mix the two in a single request.

Start using PDF Merge now

Get your free API key and make your first request in under a minute.