Zapier Integration: Automate Document Generation
Last updated March 23, 2026
The PDFMonkey Zapier integration lets you generate, retrieve, and manage documents directly from your Zaps. If you are new to the integration, start with the Getting Started section below for a complete end-to-end tutorial.
Getting Started
Before you begin, make sure you have a PDFMonkey account and a published template. See From Zero to First Document for setup instructions.
Writing Your First Template
In the HTML tab of your template, insert the following code:
<p class="greeting">Hello {{name}}!</p>
<p>Your favorite number is {{favoriteNumber}}.</p>
In the CSS tab, insert the following code:
.greeting {
color: #6D28D9;
font-size: 24px;
}
And finally in the Test data tab, insert this:
{
"name": "Peter Parker",
"favoriteNumber": 8
}
Click Save to see the preview update, then click Publish to make the template available for generation.
Always publish your template!
Generating Your First Document
Now that your template is complete, let’s head to Zapier.
For this guide we will define a Zap triggered by a form submission on Tally, generate a document in PDFMonkey, and then send it by email.
The Tally Form
We will use the following Tally form as our source of information in our Zap:

Setting Up Your Zap
Start by creating a new Zap. As trigger we will use Tally’s New Response event:

We then proceed to fill out our form and check it’s correctly connected in Zapier:


Calling PDFMonkey
Now that we have some data to work with, we will configure our PDFMonkey action.
Select the PDFMonkey app and choose the Generate Document action.

You can then map the data from the form to variables for your document. Make sure to use the same names as the ones used when writing the template.

Naming variables
We’re now ready to test the document generation.


Sending the Document by Email
Now that our document is generated, let’s send it by email.
Add a new action and select the Email by Zapier app, then choose the Send Outbound Email action.

We can now use our document’s Download URL as attachment for the email. Zapier automatically downloads the file and attaches it.

You can now test this last action and you should receive an email with the document attached.
Congrats! You generated your very first PDFMonkey document using Zapier!
Generate a Document
The Generate Document action creates a document from one of your PDFMonkey templates. You select a template, map your data fields, and PDFMonkey generates the document. The action returns a download URL you can use in subsequent Zap steps.
For a step-by-step walkthrough of your first Zap, see the Getting Started section above.
Advanced JSON Payload
Be careful!
With great power comes great trouble sometimes. Only switch to advanced JSON if you know what you are doing and know how to escape your data properly.
See Troubleshooting for more information.
By default, the integration provides a simple mapping field to define what gets sent to PDFMonkey. In most cases the simple mapping is sufficient, but there are situations where you need to structure your data differently. The Use a custom JSON structure option switches from the simple mapping to a text area where you can insert your own JSON with nested properties:

Custom Filename
You can specify a custom name for the generated file. This is useful if you plan on storing the document in a service like Drive or Dropbox.
You can use dynamic parts to build the filename, but keep these restrictions in mind:
- The filename must not contain any slash
/or backslash\ - Non-latin characters should be avoided as they can be corrupted when saving the file
Short names based on dates or IDs tend to work best.
Metadata
When you generate a document, you can attach metadata to it. Metadata is not available in the template and cannot influence the content of the document; it is simply attached to it.
A common use case is receiving the document via a webhook and using its metadata to route or handle it differently.

Line Items
If you are generating an invoice or a quote, you will likely need to deal with line items. Zapier provides a way to access those items if the trigger you use supports them.
Take the example of a Stripe invoice. Items in the invoice are available through a Line Items collection. To send those items in a way that PDFMonkey can understand, set Add Line Items to Yes.
This opens a section where you specify what a single item looks like. For example, consider a Stripe invoice with these items:
Delicious waffle 3.50€ x12 = 42.00€
Perfectly round donut 4.99€ x5 = 24.95€
TOTAL 66.95€
The TOTAL should be sent as basic data for the document, while the name, unit price, quantity, and total amount for each item should be sent as line items from Zapier:

Mapping or JSON
Using the Line Items in Your Template
When Zapier sends the line items to PDFMonkey, they are accessible through a special lineItems variable. In the example above, the payload would look like this:
{
"lineItems": [
{
"product": "Delicious waffle",
"quantity": "12",
"unitPrice": "3.50",
"totalAmount": "42.00"
},
{
"product": "Perfectly round donut",
"quantity": "5",
"unitPrice": "4.99",
"totalAmount": "24.95"
}
]
}
Only strings attached
If you look closely at the payload above, only strings are sent. Zapier does not differentiate between text and numbers.
Luckily, Liquid (the template language we use) is smart enough to convert those values to numbers when you do math with them. Just keep this in mind if you run into trouble with numbers. See How to Do Maths for arithmetic tips.
You can loop over the lineItems array to display content for each item individually:
{% for item in lineItems %}
<p>{{item.product}} at {{item.unitPrice}}€ x{{item.quantity}} = {{item.totalAmount}}€</p>
{% endfor %}
This produces the following HTML:
<p>Delicious waffle at 3.50€ x12 = 42.00€</p>
<p>Perfectly round donut at 4.99€ x5 = 24.95€</p>
You will probably want to build a table row for each item, but this gives you a good idea of how to get started. See Conditions and Loops for more Liquid loop techniques.
Document Generated Trigger
The Document Generated trigger fires your Zap every time a document finishes generating (reaches the success status). This is useful for automating post-generation tasks like storing the file in Dropbox, sending it by email, or logging it in a spreadsheet.

You can choose to trigger your Zap for:
- Any template in your workspace
- A single template
- Several specific templates

Make sure to have at least one generated document before testing your trigger in Zapier.

You can then use the generated file to store it, send it by email, or get notified in some way.
Leveraging metadata
The document exposed by the trigger does not contain your payload. If you need any information in the following actions, we recommend attaching metadata to the document.
That is what we did with the Tally information in this example.

Retrieve and Delete Documents
Retrieve a Document
The Retrieve Document action fetches a previously generated document by its ID. Use this when you need to access a document’s details or download URL in a later step of your Zap; for example, after a delay or in a separate workflow from the one that generated it.
Delete a Document
The Delete Document action removes a single document from PDFMonkey. Use this to clean up documents after you have processed them; for example, after downloading and storing the file elsewhere. See Retention and Deletion for more on document lifecycle management.
Troubleshooting
Download URL Expired
If you get an expired download URL error while building your Zap, reload the example record in your trigger.
The download URL is only valid for 1 hour. You need to refresh the documents in Zapier to get a new URL. Click the Load More button in the Test section of your trigger:

Generation output
422 Responses
This error usually happens when you use the custom JSON option and have values that need escaping before being sent to PDFMonkey.
Values Containing Double Quotes
Consider the following custom JSON:
{
"user": {
"name": "(Dynamic Field From Zapier)"
}
}
If the value in Dynamic Field From Zapier contains quotes, the resulting JSON breaks. Take Peter "Spiderman" Parker as an example:
{
"user": {
"name": "Peter "Spiderman" Parker"
}
}
This is not valid JSON. What you need is to escape the double quotes:
{
"user": {
"name": "Peter \"Spiderman\" Parker"
}
}
HTML attributes
<div class="test">).Values Containing Line Breaks
JSON does not support values that include raw line breaks:
{
"userBio": "Once upon a time,
They lived happily ever after."
}
Escape the line breaks by replacing them with a <br /> tag or using the text representation \n:
{
"userBio": "Once upon a time,\nThey lived happily ever after."
}
Solution
Do you really need custom JSON?
If you cannot escape the values before they reach Zapier, add a Code by Zapier action before calling PDFMonkey.
Suppose your data contains both line breaks and double quotes:
| Item | Value |
|---|---|
| Trigger App User Bio | This is the bio of the user. It’s a free form text that the user can edit so it can contain line breaks.
|
| Trigger App User Name | Peter Parker |
| Trigger App User Full Name | Peter “Spiderman” Parker |
You need to escape values for both Trigger App User Bio and Trigger App User Full Name. Start by adding a Code by Zapier action to your Zap and selecting Run Javascript:

Give your fields names that help identify them in the following steps:

Now add the code that escapes the values:
let data = Object.assign({}, inputData);
for (let key in data) {
if (typeof(data[key]) === "string" && data[key].length > 0) {
data[key] = data[key].replace(/\r?\n/g, '<br>').replace(/\t/g, " ").replace(/"/g, '\\\"');
}
}
output = [data];
This gives you the same fields in the output but with their values properly escaped:

You can now use those values when building your PDFMonkey payload:

Notice how we used the fields from the Code by Zapier step, not from the trigger directly.
Next Steps
- From Zero to First Document: Set up your PDFMonkey account and create your first template
- Defining Dynamic Data: Learn how to structure the JSON payload for your templates
- Document Statuses: Understand the lifecycle of a generated document
- Webhooks: Receive real-time notifications when documents finish generating
- Explore other integrations: Make, n8n, Workato