🎉  WebMerge is now Formstack Documents! Learn More   🎉

Close

Developer Resources

Easily integrate document generation into any application using our open REST API.

Get Started

Developers hero graphic

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
Parameter
Description
Example Values
name File Name contract.pdf
url
(required if contents is empty)
Remote file URL https://example.com/contract.pdf
contents
(required if url is empty)
Base64 encoded file
Valid file types: docx, doc, xlsx, xls, pptx, ppt, jpeg, jpg, png, gif, htm, html

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
Parameter
Description
Example Values
name File Name contract.docx
url
(required if contents is empty)
Remote file URL https://example.com/contract.docx
contents
(required if url is empty)
Base64 encoded file
Valid file types: docx, doc, xlsx, xls, pptx, ppt, jpeg, jpg, png, gif, htm, html

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
Parameter
Description
Example Values
name File Name contract.pdf
url
(required if contents is empty)
Remote file URL https://example.com/contract.pdf
contents
(required if url is empty)
Base64 encoded file

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
Parameter
Description
Example Values
name File Name contract.pdf
url
(required if contents is empty)
Remote file URL https://example.com/contract.pdf
contents
(required if url is empty)
Base64 encoded file
password Owner Password (password to edit permissions)
user_password User Password (password to open PDF)
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
Parameter
Description
Example Values
name File Name contract.pdf
url
(required if contents is empty)
Remote file URL https://example.com/contract.pdf
contents
(required if url is empty)
Base64 encoded file
extract
(optional)
Extract page range(s) 1-3, 5, 7-8
remove
(optional)
Remove page range(s) 2, 4-7

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)