Overview
The Merge PDF endpoint takes two or more PDF files and returns a link to a single PDF that contains all of their pages, in the order the files were sent.
Merging PDFs
Send a POST request to the following endpoint:
POST https://www.givemepdf.com/api/v1/pdf/merge
Credits required: 1 / file
Merging 3 files costs 3 credits. Credits are only charged when the merge succeeds.
Authentication
Every API call must include an API-KEY header.
You can find your API key in your dashboard.
Request body
Send the request as multipart/form-data. Add every PDF as a separate files[] field, in the order you want them merged.
| Parameter | Accepted value | Required |
|---|---|---|
files[] |
2 to 20 PDF files, each up to 20 MB. The merged PDF can have up to 1000 pages. | Yes |
document_name |
String, up to 60 characters | No |
Example
curl -X POST https://www.givemepdf.com/api/v1/pdf/merge \ -H "API-KEY: your-api-key" \ -F "files[]=@cover.pdf" \ -F "files[]=@report.pdf" \ -F "files[]=@appendix.pdf" \ -F "document_name=Annual report"
Response
When the merge succeeds, you will receive a JSON response with status code 200. Here is a sample response:
{
"message": "OK",
"data": {
"location": "https://givemepdf.com/storage/8b6293cb05ee815c/ossrPslsisxeRLp0.pdf",
"page_count": 12,
"credit_used": 3,
"file_ttl_days": 1,
"warning": "This file is available for 1 day(s). Please download as soon as possible."
},
"meta": {
"remaining_free_credit": 3470,
"remaining_paid_credit": 10000
}
}
Possible errors
| Status | Message | How to fix it |
|---|---|---|
401 Unauthorized |
API-KEY missing | Make sure your request includes the API-KEY header with a value. |
401 Unauthorized |
Invalid API Key | Your API key is incorrect, expired or revoked. Sign in to your dashboard to copy a valid key or generate a new one. |
402 Payment Required |
Merging 3 files costs 3 credits. You have 1 credit left. | Each file costs 1 credit. Top up your credits or merge fewer files. |
422 Unprocessable Entity |
Please upload at least 2 PDF files. | Send every file as a separate files[] field. |
422 Unprocessable Entity |
This file is not a readable PDF. | The file at this position is damaged or not a PDF. The error is returned for the matching files.N field. |
422 Unprocessable Entity |
Password protected or encrypted PDFs are not supported. | Remove the password from the PDF and try again. |
422 Unprocessable Entity |
The merged PDF would have 1200 pages. The maximum is 1000. | Merge fewer or smaller files. |
500 Internal Server Error |
Could not merge these PDFs. | Something went wrong while merging. No credits were charged. If the problem persists, contact us. Contact us |
Troubleshooting
- Interactive form fields with the same name in different files share one value in the merged PDF.
- Bookmarks of the original files are not kept in the merged PDF.