Bubble Integration: Generate Documents in Your Bubble App
Last updated March 23, 2026
The official PDFMonkey plugin for Bubble lets you generate documents directly from your Bubble workflows without writing backend code. Install it from the Bubble marketplace, add a single workflow action, and get a download URL back when the document is ready.
There are two ways to connect PDFMonkey to Bubble:
- PDFMonkey plugin (recommended) — install from the marketplace for a no-code setup with built-in polling.
- API Connector — call the PDFMonkey REST API directly for full control over requests and responses.
Prerequisites
Before you begin, make sure you have:
- A PDFMonkey account (sign up here)
- A Bubble account with an app
- A published template in PDFMonkey
For account creation and template setup, see From Zero to First Document.
You also need your API Secret Key, available on the My Account page. See Authentication for details.
PDFMonkey Plugin
The official PDFMonkey plugin is the fastest way to generate documents from Bubble. It handles authentication, document creation, and polling automatically: you add a single action to your workflow, and it returns the finished document.
Installing the Plugin
- Open your Bubble app editor.
- Go to Plugins and click Add plugins.
- Search for PDFMonkey and install the PDFMonkey plugin.
- In the plugin settings, paste your API Secret Key from the My Account page.
That is all you need for authentication. The plugin passes your key via the Authorization header on every request.
Generate a Document Action
The plugin provides a server-side action called PDFMonkey - Generate a Document. Add it to any Bubble workflow to create and generate a document from one of your templates.
Input Fields
| Field | Type | Required | Description |
|---|---|---|---|
| Template ID | Dynamic value | Yes | The ID of your PDFMonkey template (found in the template settings) |
| Document data | Key/value pairs | Yes | The dynamic data for your template; keys must match the variable names defined in your template |
| Document meta-data | Key/value pairs | No | Metadata attached to the document (not available inside the template) |
| Filename | Dynamic value | No | A custom filename for the generated file |
Naming variables
Returned Values
Once the action completes, the following values are available for use in subsequent workflow steps (via Result of step X):
| Field | Type | Description |
|---|---|---|
| id | text | The unique ID of the generated document |
| Download URL | file | A temporary URL to download the file (valid for 1 hour) |
| Public Share Link | text | A permanent share link (available on Premium plans) |
| Filename | text | The filename of the generated file |
| Document meta-data | text | The metadata attached to the document |
| Status | text | The document status (success or failure) |
| Failure cause | text | The error message if generation failed |
| Creation Date | date | When the document was created |
| Generation Date | date | When the document finished generating |
| Workspace ID | text | The ID of the workspace containing the template |
| Template ID | text | The ID of the template used |
| Template name | text | The name (identifier) of the template used |
How the Action Works
When the action runs, it:
- Creates a document via the PDFMonkey API with status
pending, which starts generation immediately. - Polls the API automatically until the document reaches
successorfailure. - Returns the result to your workflow.
This means the action blocks until the document is ready. You do not need to set up polling, webhooks, or any async handling. When the next step in your workflow runs, the document is already generated and the download URL is available.
Workflow Example
Here is a typical workflow that generates an invoice and emails it to the customer:
- A user clicks a Generate Invoice button.
- In the workflow, add the PDFMonkey - Generate a Document action.
- Set Template ID to the ID of your invoice template (you can hardcode it or pull it dynamically from your database).
- Map your Bubble data to the Document data keys. For example:
customerName→ Current User’s NameinvoiceNumber→ Current Invoice’s NumberlineItems→ Current Invoice’s Items (formatted as JSON)
- The action waits until the document is ready.
- In the next step, add a Send Email action and use Result of step X’s Download URL as the attachment.
Publish your template first
List Workspaces Data Source
The plugin also exposes a List Workspaces data source that returns the workspaces available in your PDFMonkey account. You can use it to build dynamic dropdowns or let users select a workspace before generating a document.
API Connector
If you need more control over requests (custom headers, specific endpoints, or direct access to the full API response), you can call the PDFMonkey REST API using Bubble’s built-in API Connector plugin.
When to use the API Connector
Setting Up the API Connector
- In your Bubble app editor, go to Plugins and install the API Connector plugin (if not already installed).
- Click Add another API and name it
PDFMonkey. - Set Authentication to Private key in header and configure:
- Key name:
Authorization - Key value:
Bearer YOUR_API_SECRET_KEY
- Key name:
- Add a new API call with the following settings:
| Setting | Value |
|---|---|
| Name | Create Document |
| Use as | Action |
| Method | POST |
| URL | https://api.pdfmonkey.io/api/v1/documents |
| Headers | Content-Type: application/json |
- In the Body, paste the following JSON:
{
"document": {
"document_template_id": "<template_id>",
"status": "pending",
"payload": {
"name": "<name>"
}
}
}
Replace <template_id> with your template’s ID (found in your PDFMonkey dashboard) and adjust the payload keys to match your template’s dynamic data.
- Click Initialize call to test the connection. If successful, Bubble detects the response fields automatically.
Set status to pending
"status": "pending" for PDFMonkey to start generating the document immediately. If you omit it or set it to "draft", the document is created but not generated. See Document Statuses for details.Using Dynamic Values
To pass dynamic data from your Bubble app, wrap placeholders in angle brackets (<placeholder>) in the API Connector body. Bubble turns these into fields you can map to dynamic values in your workflows.
For example, to generate an invoice, your body might look like this:
{
"document": {
"document_template_id": "<template_id>",
"status": "pending",
"payload": {
"customerName": "<customer_name>",
"invoiceNumber": "<invoice_number>",
"totalAmount": "<total_amount>"
}
}
}
Each <placeholder> becomes a field in the workflow action that you can populate with data from your Bubble app.
Naming variables
Retrieving the Generated File
Document generation is asynchronous. After the Create Document call returns, the document is not ready yet. You have two options to retrieve the finished file:
- Polling — add a second API call (
GET https://api.pdfmonkey.io/api/v1/documents/<document_id>) and check thestatusfield until it reachessuccess. The response then includes adownload_url. - Webhook — configure a webhook in PDFMonkey to notify your Bubble app when the document is ready. This avoids polling and is more efficient for production use.
Troubleshooting
Document Generation Fails
If the plugin action returns a failure status, check the Failure cause field (or failureCause in the API response) for the error message. Common causes include syntax errors in your template or invalid dynamic data.
Invalid JSON in API Connector
If you get a 422 error when using the API Connector, your JSON body is likely malformed. Common causes:
- Unescaped double quotes in dynamic values — if a user-provided value contains
", it breaks the JSON structure. Sanitize inputs before passing them. - Line breaks in values — raw line breaks are invalid in JSON. Replace them with
\nor<br />before sending.
For more on JSON escaping, see the 422 Responses section of the Zapier guide (the same principles apply).
Document Stuck in Draft
If your document is created but never generates (API Connector only), check that "status": "pending" is included in the request body. Without it, PDFMonkey creates the document as a draft and waits for you to trigger generation. See Document Statuses.
pending automatically.Download URL Expired
The download URL is valid for 1 hour. If your workflow takes longer to process the file, download it immediately after generation or use a share link for permanent access.
For more details, see Download URL Returns 403.
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
- Download URL: How download URLs work and when they expire
- Explore other integrations: Zapier, Make, n8n