Developer Resources
Easily integrate document generation into any application using our open REST API.
Tools
These API calls allow you to perform various functions with files.
Combine Files
POST /tools/combine
This method is used to combine multiple files (pages) into a single file. Please see the full list of parameters below.
Request Parameters
Parameter |
Description |
Example Values |
||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| output | The type of file to produce | pdf or docx | ||||||||||||
| files | Array of files
|
|||||||||||||
Example Request:
Name/Value Pairs
curl -X POST https://www.webmerge.me/api/tools/combine \
-d "output=pdf" \
-d "files[0][name]=contract.pdf" \
-d "files[0][url]=https://www.example.com/contract.pdf" \
-d "files[1][name]=appendix.pdf" \
-d "files[1][url]=https://www.example.com/appendix.pdf"JSON
curl -X POST https://www.webmerge.me/api/tools/combine \
-H "Content-Type: application/json" \
-d '{"output":"pdf", "files":[{"name":"contract.pdf",
"url":"https://www.example.com/contract.pdf"},
{"name":"appendix.pdf", "url":"https://www.example.com/
appendix.pdf"}]}'
Example Response:
%PDF-1.7 ........... ...........(the contents of the document - save to file)
Convert File to PDF
POST /tools/convert_to_pdf
This method is used to convert a file to PDF. Please see the full list of parameters below.
Request Parameters
Parameter |
Description |
Example Values |
||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| file | File info
|
|||||||||||||
Example Request:
Name/Value Pairs
curl -X POST https://www.webmerge.me/api/tools/convert_to_pdf \
-d "file[name]=contract.docx" \
-d "file[url]=https://www.example.com/contract.docx"JSON
curl -X POST https://www.webmerge.me/api/tools/convert_to_pdf \
-H "Content-Type: application/json" \
-d '{"file":{"name":"contract.docx",
"url":"https://www.example.com/contract.docx"}}'
Example Response:
%PDF-1.7 ........... ...........(the contents of the document - save to file)
Compress PDF
POST /tools/compress_pdf
This method is used to compress a PDF file. Please see the full list of parameters below.
Request Parameters
Parameter |
Description |
Example Values |
||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| file | File info
|
|||||||||||||
Example Request:
Name/Value Pairs
curl -X POST https://www.webmerge.me/api/tools/compress_pdf \
-d "file[name]=contract.pdf" \
-d "file[url]=https://www.example.com/contract.pdf"JSON
curl -X POST https://www.webmerge.me/api/tools/compress_pdf \
-H "Content-Type: application/json" \
-d '{"file":{"name":"contract.pdf",
"url":"https://www.example.com/contract.pdf"}}'
Example Response:
%PDF-1.7 ........... ...........(the contents of the document - save to file)
Encrypt PDF
POST /tools/encrypt_pdf
This method is used to encrypt a PDF file. Please see the full list of parameters below.
Request Parameters
Parameter |
Description |
Example Values |
||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| file | File info
|
|||||||||||||
| password | Owner Password | |||||||||||||
| user_password | User Password | |||||||||||||
| permissions | Allowed Permissions (array) | [Printing, DegradedPrinting, ModifyContents, Assembly, CopyContents, FillIn, AllFeatures] | ||||||||||||
Example Request:
Name/Value Pairs
curl -X POST https://www.webmerge.me/api/tools/encrypt_pdf \
-d "file[name]=contract.pdf" \
-d "file[url]=https://www.example.com/contract.pdf" \
-d "password=xyz123" \
-d "permissions[]=AllFeatures"JSON
curl -X POST https://www.webmerge.me/api/tools/encrypt_pdf \
-H "Content-Type: application/json" \
-d '{"file":{"name":"contract.pdf",
"url":"https://www.example.com/contract.pdf"},
"password":"xyz123",
"permissions":["AllFeatures"]}'
Example Response:
%PDF-1.7 ........... ...........(the contents of the document - save to file)
Split PDF
POST /tools/split_pdf
This method is used to split a PDF file into separate pages (files) or used to extract/remove pages from a PDF. Please see the full list of parameters below.
Request Parameters
Parameter |
Description |
Example Values |
||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| file | File info
|
|||||||||||||
| extract |
Extract page range(s) | |||||||||||||
| remove |
Remove page range(s) | |||||||||||||
Example Request:
Name/Value Pairs
curl -X POST https://www.webmerge.me/api/tools/split_pdf \
-d "file[name]=contract.pdf" \
-d "file[url]=https://www.example.com/contract.pdf"JSON
curl -X POST https://www.webmerge.me/api/tools/split_pdf \
-H "Content-Type: application/json" \
-d '{"file":{"name":"contract.pdf",
"url":"https://www.example.com/contract.pdf"}}'
Example Response:
PK....... ........... ...........(ZIP FILE)