ChargedAPI
PDF Tools 4 min read

How to Merge PDF Files Programmatically

Learn how to combine multiple PDF documents into a single file using API calls. Perfect for document automation, report generation, and file management.

Quick Start: cURL

curl -X POST "https://api.chargedapi.com/pdf/merge" \
  -H "X-API-Key: YOUR_API_KEY" \
  -F "files=@document1.pdf" \
  -F "files=@document2.pdf" \
  -F "files=@document3.pdf" \
  -o merged.pdf

Python Example

import requests

def merge_pdfs(pdf_files, api_key):
    files = [("files", open(f, "rb")) for f in pdf_files]
    
    response = requests.post(
        "https://api.chargedapi.com/pdf/merge",
        headers={"X-API-Key": api_key},
        files=files
    )
    
    return response.content

# Merge 3 PDFs
pdfs = ["report1.pdf", "report2.pdf", "appendix.pdf"]
result = merge_pdfs(pdfs, "YOUR_API_KEY")

with open("combined-report.pdf", "wb") as f:
    f.write(result)

Features

Common Use Cases

๐Ÿ“Š Report Generation

Combine cover page, content, and appendices

๐Ÿ“ Document Archival

Consolidate related documents into one file

๐Ÿ“ Contract Assembly

Merge agreement, terms, and signatures

๐Ÿงพ Invoice Batching

Combine multiple invoices for printing

Start Merging PDFs

Get your free API key and merge your first PDFs today.

Get Free API Key