Merge PDFs

Merge PDFs

Merge PDFs is a REST API tool that joins together any number of full PDF files or specified pages from separate documents into a consolidated PDF.

A bubbling flask with code brackets inside
Try Now with API Lab

Start right from your browser - upload files, choose parameters, generate code, and send API Calls directly from API Lab!  

to receive your free API Key.
Parameters
Required Parameters
POST
/merged-pdf
curl -X POST "https://api.pdfrest.com/merged-pdf" \ 
  -H "Accept: application/json" \ 
  -H "Content-Type: multipart/form-data" \
  -H "Api-Key: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \
  
Response
The response for your API Call will display here.
Once you've sent your POST request and received a valid response, you can download your output file using the output URL.

Why is pdfRest the best API to merge PDF files?

pdfRest offers the best solution for merging multiple PDF documents together, because it produces optimized output, supports flexible page ranges, and can be combined with conversion to merge files of other formats.

Merge without the Bloat

Many tools claim to merge PDF documents together, but most leave the resulting file with unnecessary, redundant content we like to refer to as “bloat.” This can make the file size much bigger than it needs to be and create a much slower user experience for file transfers and viewing.

pdfRest optimizes the content of every merged PDF it creates to ensure the output file contains only what it needs.

Assemble Your Perfect Document

pdfRest’s Merge PDFs allows for much more than full document merging.  Let’s say you only need page 1 from Document A, pages 3-5 from Document B, and pages 15, 18, and 72 from Document C… no problem!  Choose exactly which pages to include from each input file and specify the exact order you need them in the output file.

Level Up with Chainable API Calls

Sometimes you need to merge PDFs together, but other times you may need to merge various file types together into one PDF, such as Word documents with PNG images and HTML files.

pdfRest is purpose-built to support multi-step workflow processes. Simply upload your files of various type to the Convert to PDF tool and pass the resource IDs of each output file from those calls to the Merge PDFs tool. No need to download and upload files between API Calls - simply chain calls together.
Start from Code Examples
  1. First, you'll need an API Key - to:
    • Stay anonymous with a Guest API Key for 10 free API Calls
    • Sign up for an upgraded API Key with unlimited, continuous service
  2. Choose your programming language
  3. Copy and paste the code to your project
  4. Update Api-Key field with your unique API Key
  5. Update file with the local path to your input
  6. Run this code to send an API Call
See more code examples in our
GitHub repository
Try pdfRest with just a few clicks
Download our Postman Postman Collection
curl -X POST "https://api.pdfrest.com/merged-pdf" \
  -H "Accept: application/json" \
  -H "Content-Type: multipart/form-data" \
  -H "Api-Key: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \
  -F "file=@../Sample_Input/ducky.pdf" \
  -F "pages[]=all" -F "type[]=file" \
  -F "file=@../Sample_Input/merge1.pdf" \
  -F "pages[]=all" -F "type[]=file" \
  -F "file=@../Sample_Input/merge2.pdf" \
  -F "pages[]=all" -F "type[]=file" \
  -F "file=@../Sample_Input/merge1.pdf" \
  -F "pages[]=all" -F "type[]=file" \
  -F "file=@../Sample_Input/ducky.pdf" \
  -F "pages[]=all" -F "type[]=file" \
  -F "output=example_out"
Customize Your Solution
Pages

The pages[] parameter is used to identify pages and/or page ranges that you would like to take from each input document and merge into a single PDF. This is a versatile parameter that allows you to reorder and duplicate pages based on the page numbers and ranges that you specify. Use this parameter once for each file that you would like to merge.

If a page number is included more than once (e.g., “1,2,3,3,4,5”), then the page will be duplicated in the output file. Pages may also be reordered (e.g., “1,5,3,2,4”), and page ranges may be reversed by listing the higher page number first (e.g., “2,4,9-5,12”).

To include all pages from a document, use the range “1-last”. The “last” keyword can also be applied generally to page ranges (e.g., “1-4,6,7-last”).

The pages[] parameter also accepts the keywords “even” and “odd” to select only those pages to merge into your new PDF.

Generate a self-service API Key now!

Create your FREE API Key to start processing PDFs in seconds, only possible with pdfRest.

Compare Plans
Contact Us