n8n
Prerequisites
- A PolyDoc account and API key — sign up for free, no credit card required. The free plan includes 150 PDF conversions per month.
- An n8n instance — self-host for free or use n8n Cloud.
Use Case 1: Generate PDFs from Spreadsheet Data
Automatically generate an invoice PDF for every new row added to a Google Sheet and email it to the recipient.Google Sheets trigger (new row) → HTTP Request (PolyDoc API) → Gmail
Create a new workflow
Open your n8n instance and click Add workflow. Give it a descriptive name like "Invoices → PDF → Email".
/img/guides/n8n/n8n-uc1-create-workflow.pngAdd a Google Sheets trigger node
Add a worksheet with column headers that match your PolyDoc template. The example below uses an invoices tab and one sample row; you can import data via File → Import (CSV/XLSX).
| invoice_number | invoice_date | invoice_due_date | invoice_subtotal | invoice_tax_rate | invoice_tax_amount | invoice_total | customer_name | customer_email | customer_street | customer_city | customer_country |
|---|---|---|---|---|---|---|---|---|---|---|---|
| INV-2026-001 | 2026-01-15 | 2026-02-14 | 1200 | 0.1 | 120 | 1320 | John Doe | john.doe@example.com | 456 Customer Avenue | Beautiful City | UK |
Click Add first step and select Google Sheets → On Row Added. Connect your Google account, choose your spreadsheet, and select the invoices tab.
n8n will poll for new rows at the interval you configure (default: every minute). Click Fetch Test Event to pull in a sample row.
/img/guides/n8n/n8n-uc1-sheets-trigger.pngAdd an HTTP Request node for PolyDoc
Add an HTTP Request node after the trigger and configure:
- Method: POST
- URL:
https://api.polydoc.tech/pdf/convert - Authentication: Generic Credential Type → Header Auth
- Create a credential with Name
Authorizationand ValueBearer YOUR_API_KEY(get your key from the Dashboard) - Add header:
X-Sandbox=true - Body Content Type: JSON
- Specify Body: use JSON and map row fields with expressions like
{{ $json.customer_name }} - Options → Response: set Response Format to File so the PDF binary is available for the next node
/img/guides/n8n/n8n-uc1-http-request.pngSend the PDF by email
Add a Gmail node (or any email node) after the HTTP Request. Configure:
- To:
{{ $('Google Sheets Trigger').item.json.customer_email }} - Subject:
Your PDF — {{ $('Google Sheets Trigger').item.json.invoice_number }} - Attachments: select the binary data from the HTTP Request node
/img/guides/n8n/n8n-uc1-gmail-node.pngExecute and activate the workflow
Click Test workflow to run it once with a sample row. Verify the PDF arrives in the recipient's inbox. When satisfied, toggle the workflow to Active so it runs automatically on new rows.
/img/guides/n8n/n8n-uc1-activate.pngUse Case 2: Webhook-Triggered PDF
Accept incoming JSON via a webhook, generate a PDF with PolyDoc, and return it directly in the HTTP response.Webhook node → HTTP Request (PolyDoc API) → Respond to Webhook
Add a Webhook node
Create a new workflow. Add a Webhook node as the trigger. Set the HTTP Method to POST. Copy the Test URL shown in the node — you'll use it in the next step.
/img/guides/n8n/n8n-uc2-webhook-node.pngSend test data to the webhook
Send a test POST request with JSON data to the webhook URL. For example using curl:
curl -X POST <YOUR_TEST_URL> \
-H "Content-Type: application/json" \
-d '{"name": "Jane Doe", "amount": "€1,200.00"}'n8n will capture the payload and display the received fields in the Webhook node output.
/img/guides/n8n/n8n-uc2-test-webhook.pngAdd an HTTP Request node for PolyDoc
Add an HTTP Request node and configure it the same way as in Use Case 1:
- URL:
https://api.polydoc.tech/pdf/convert - Method: POST
- Header Auth credential:
Authorization=Bearer YOUR_API_KEY - Header:
X-Sandbox=true - JSON body: map webhook fields using
{{ $json.name }},{{ $json.amount }}, etc. - Response Format: File
/img/guides/n8n/n8n-uc2-http-request.pngReturn the PDF in the response
Add a Respond to Webhook node. Set Respond With to Binary and select the PDF data from the previous node. This returns the generated PDF directly to the caller.
/img/guides/n8n/n8n-uc2-respond-webhook.pngActivate the workflow
Click Test workflow and send another POST to the test URL. Confirm the PDF is returned. Then toggle the workflow to Active — the Production URL (different from the test URL) will be live and ready to accept requests.
/img/guides/n8n/n8n-uc2-activate.png