Overview
This node integrates with the PDFMonkey API to generate, retrieve, download, and delete PDF documents based on predefined templates. It is particularly useful for automating document creation workflows where PDFs need to be dynamically generated from data inputs, such as invoices, reports, contracts, or certificates.
For the Generate Document operation (the focus here), the node creates a new PDF by filling a specified PDFMonkey template with dynamic payload data provided either as JSON or key-value pairs. It can optionally wait for the document generation to complete and automatically download the resulting PDF or image file.
Practical examples:
- Automatically generating customer invoices from order data.
- Creating personalized certificates by merging user information into a certificate template.
- Producing dynamic reports by feeding analytics data into a report template.
Properties
| Name | Meaning |
|---|---|
| Document Template ID | The ID of the PDFMonkey template to use for generating the PDF document. |
| Payload Input | Method to enter the payload data: either as raw JSON or as key-value pairs. |
| Payload (JSON) | The dynamic data in JSON format used to fill the PDF template (required if using JSON input method). |
| Payload (Key-Value Pairs) | Dynamic data entered as multiple key-value pairs; values support JSON arrays/objects if formatted properly. |
| Custom Filename | Optional custom filename for the generated document; if empty, a random filename will be assigned. |
| Meta (JSON) | Additional metadata for the document in JSON format; can include custom fields like filename override. |
| Wait For Completion | Boolean flag indicating whether to wait for the document generation to finish and download the file automatically. |
Output
The node outputs an array of items corresponding to each input item processed. Each output item contains:
- json: The full response object from the PDFMonkey API related to the document operation.
- binary.data (only when waiting for completion and the document is successfully generated): The downloaded PDF or image file data prepared as binary data, ready for further workflow usage or saving.
- pairedItem: Links the output to the original input item index.
If the document generation fails or the document is not ready for download, the output json will contain status messages or error details accordingly.
Dependencies
- Requires an API key credential for authenticating with the PDFMonkey API.
- Needs network access to
https://api.pdfmonkey.io. - Uses internal helper methods for HTTP requests and binary data preparation.
- No additional external dependencies beyond the PDFMonkey API and n8n environment.
Troubleshooting
- Document generation failure: If the document status returns "failure," check the payload data correctness and template configuration in PDFMonkey. The error cause may be included in the failure message.
- Document not ready for download: When attempting to download a document that is still processing, the node warns that the document is not ready. Consider enabling "Wait For Completion" to avoid this.
- Invalid JSON payload: When using JSON input, ensure the JSON is well-formed. Malformed JSON will cause errors.
- API authentication errors: Verify that the API key credential is correctly configured and has necessary permissions.
- Deletion failures: Errors during document deletion usually indicate invalid document IDs or permission issues.