Prerequisites
- A Mergram account with API access
- A saved template (created in the visual editor)
- A Zapier account
Before you begin
Create and test your template in the Mergram visual editor first. Ensure the field layout and data mapping work correctly with a preview before setting up automation. You need a saved template ID for API calls.
Step 1: Create an API Key
- Open Developer → API Keys in Mergram
- Click Generate New Key, give it a name, and select scopes:
merge— Trigger PDF mergesemail— Trigger email campaignstemplates:read— List and view templates
- Copy the key — you won’t be able to see it again
Step 2: Configure in Zapier
-
Create a Zap — Start with a trigger (e.g., “New Row in Google Sheets”, “New Form Submission”)
-
Add a Webhooks action — Choose “Webhooks by Zapier” → “Custom Request”
-
Configure the webhook:
- Method:
POST - URL:
https://mergram.com/api/v1/merge - Headers:
Authorization: Bearer mg_your_key_hereContent-Type: application/json
- Payload Type:
json
- Method:
-
Build the JSON payload — Map trigger data to the merge request:
{
"templateId": "tmpl_abc123",
"data": [
{ "Name": "Alice Chen", "Amount": "$1,500.00" },
{ "Name": "Bob Martinez", "Amount": "$2,300.00" }
],
"outputConfig": {
"combinePdf": false,
"filenameTemplate": "Invoice_[[Name]]"
}
}
Step 3: Check Job Status
Poll the job status endpoint to see when your merge completes:
GET /api/v1/jobs/job_xyz789
Authorization: Bearer mg_your_key_here
Download results when complete:
GET /api/v1/jobs/job_xyz789/output
Authorization: Bearer mg_your_key_here
Pro tip
Use Zapier’s Delay step (5–10 seconds) between submitting a merge and checking status, then add a Loop step to poll until the job completes.
Zapier-specific features
Multi-step Zaps
Chain multiple actions after your trigger. For example:
- Trigger — New row in Google Sheets
- Action 1 — POST to Mergram API (create merge job)
- Action 2 — Delay (wait for processing)
- Action 3 — GET job status
- Action 4 — Send Slack notification with download link
Filters
Use Zapier’s Filter step to conditionally trigger merges. For example, only merge when a spreadsheet column has a specific value (e.g., Status = "Approved").
Paths
Use Paths to branch your Zap based on conditions. For example:
- Path A: If
Type = "Invoice"→ use the invoice template - Path B: If
Type = "Certificate"→ use the certificate template
Looping
Process multiple items from a single trigger using Looping. If your trigger delivers an array of records (e.g., new rows from a database query), Looping iterates over each item and creates a separate merge job per item.
Tables
Store reference data in Zapier Tables (e.g., template IDs, default configurations) and look up values dynamically in your Zaps.
Transfer
Use Zapier Transfer to process historical data in bulk. Connect a data source (spreadsheet, database) and process all existing rows through your merge Zap at once.
Zapier plan requirements
Multi-step Zaps, Filters, Paths, and Looping require a paid Zapier plan. The free plan supports single-step Zaps with one trigger and one action only.
Common Zap Templates
- Google Sheets → PDF — New spreadsheet row triggers a merge
- Typeform → PDF — New form submission generates a personalized document
- Shopify → Invoice — New order creates a PDF invoice
- HubSpot → Certificate — Deal stage change generates a certificate
- Airtable → PDF — New record generates a document
Best Practices
- Store API keys in Zapier’s account settings — Use Zapier’s built-in secret storage instead of hardcoding keys in the webhook configuration
- Test with small datasets first — Verify the Zap works with a single row before enabling it for production data
- Add error handling — Use Zapier’s built-in error notifications to catch failed API calls
- Monitor Zap runs — Check Zapier’s task history for failed runs and troubleshoot promptly
Limitations
- Single-step Zaps on free plan — Multi-step Zaps, Filters, Paths, and Looping require a paid Zapier plan
- No file upload via Zapier — PDF templates and spreadsheets must exist in Mergram before triggering a merge
- Polling required — No webhook callbacks for job completion; use Delay + Loop to poll the status endpoint
- Rate limits — Standard API rate limits apply (100 total requests per minute, 20 write operations per minute)
- No template creation via Zapier — Templates must be created in the Mergram visual editor