Link Search Menu Expand Document

PDF Merge

Related Knowledgebase-Explore Samples

Merge PDF from two or more PDF files into a new one.

Available Methods

[POST] /pdf/merge

  • url required. Comma separated urls to the source PDF files in the same order that you want them to be merged. Supports links from Google Drive, Dropbox and from built-in PDF.co files storage. For uploading files via API please check Files Upload section. If you are randomly getting Too Many Requests or Access Denied error for your input url, please try to add cache: to enable built-in url caching. Need to merge non-PDF files too? Use /pdf/merge2 endpoint instead.
  • encrypt (legacy, now all files are stored at the encrypted cloud storage by default.

Important: you can also encrypt output files and decrypt input files with user-controlled data encryption (strong AES encryption + custom keys). Click here to learn more.

  • async optional. Runs processing asynchronously. Returns Use JobId that you may use with /job/check to check state of the processing (possible states: working, failed, aborted and success). Must be one of: true, false.
  • name optional. name of the output file.
  • expiration (optional). Output link expiration in minutes. Default is 60 (i.e. 60 minutes or 1 hour). After this delay generated output file(s) (if any) will be auto-removed from PDF.co temporary files storage. Max allowed expiration period depends on your current subscription plan. To store permanent input files (e.g. re-usable images, pdf, documents), please use PDF.co built-in Files Storage instead.
  • profiles optional. Must be a String. Use this param to set additional configuration for fine tuning and extra options. Explore PDF.co knowledgebase for profile examples.

  • Method: POST
  • URL: /v1/pdf/merge

Query parameters

No query parameters accepted.

Body payload

{
    "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-merge/sample1.pdf,https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-merge/sample2.pdf",
    "async": false
}

Example responses

/pdf/merge
{
    "url": "https://pdf-temp-files.s3.amazonaws.com/3ec287356c0b4e02b5231354f94086f2/result.pdf",
    "error": false,
    "status": 200,
    "name": "result.pdf",
    "remainingCredits": 98465
}

Code Snippet

CURL
curl --location --request POST 'https://api.pdf.co/v1/pdf/merge' \
--header 'x-api-key: ' \
--header 'Content-Type: application/json' \
--data-raw '{
    "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-merge/sample1.pdf,https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-merge/sample2.pdf",
    "async": false
}'

[POST] /pdf/merge2 (supports zip, doc, rtf, xls, png, jpg etc)

This endpoint is similar to /pdf/merge but it also supports zip, doc, docx, xls, xlsx, rtf, txt, png, jpg files as source.

We recommended to use this endpoint in "async": true mode because it may need to convert source documents to pdf.

This endpoint also consumes more credits because of the internal conversions.

  • url required. Comma separated urls to the source files (pdf, zip, documents, txt, rtf, xls, xslx, png, jpg) in the same order that you want them to be merged. Supports links from Google Drive, Dropbox and from built-in PDF.co files storage. For uploading files via API please check Files Upload section. If you are randomly getting Too Many Requests or Access Denied error for your input url, please try to add cache: to enable built-in url caching.
  • httpusername (optional) - http auth user name if required to access source url.
  • httppassword (optional) - http auth password if required to access source url.

  • encrypt (legacy, now all files are stored at the encrypted cloud storage by default.

Important: you can also encrypt output files and decrypt input files with user-controlled data encryption (strong AES encryption + custom keys). Click here to learn more.

  • async optional. Runs processing asynchronously. Returns Use JobId that you may use with /job/check to check state of the processing (possible states: working, failed, aborted and success). Must be one of: true, false.
  • name optional. name of the output file.
  • expiration (optional). Output link expiration in minutes. Default is 60 (i.e. 60 minutes or 1 hour). After this delay generated output file(s) (if any) will be auto-removed from PDF.co temporary files storage. Max allowed expiration period depends on your current subscription plan. To store permanent input files (e.g. re-usable images, pdf, documents), please use PDF.co built-in Files Storage instead.
  • profiles optional. Must be a String. Use this param to set additional configuration for fine tuning and extra options. Explore PDF.co knowledgebase for profile examples.

  • Method: POST
  • URL: /v1/pdf/merge2

Query parameters

No query parameters accepted.

Body payload

{
 "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-merge/sample1.pdf,https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/other/Input.xls, https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-merge/images-and-documents.zip",
 "async": false
}

Example responses

/pdf/merge2
{
    "url": "https://pdf-temp-files.s3.amazonaws.com/3ec287356c0b4e02b5231354f94086f2/result.pdf",
    "error": false,
    "status": 200,
    "name": "result.pdf",
    "remainingCredits": 98465
}

Code Snippet

CURL
curl --location --request POST 'https://api.pdf.co/v1/pdf/merge2' \
--header 'x-api-key: ' \
--header 'Content-Type: application/json' \
--data-raw '{
 "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-merge/sample1.pdf,https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/other/Input.xls, https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-merge/images-and-documents.zip",
 "async": false
}'

Knowledgebase

Samples