Zapier Integration
Use Zapier to call the thelawin.dev API and generate ZUGFeRD PDFs without writing code. The Webhooks by Zapier action does the HTTP request for you.
Prerequisites
- Zapier account (Free tier or higher)
- thelawin.dev API key (for testing:
env_sandbox_demo)
Create a Zap: Trigger → Invoice → Action
Step 1: Choose a Trigger
Pick any trigger to start the Zap:
| Trigger | Use Case |
|---|---|
| Google Sheets (New Row) | New spreadsheet row = new invoice |
| Stripe (New Payment) | Payment received = generate invoice |
| Typeform (New Entry) | Form submission = invoice |
| Schedule (Every Day/Week) | Recurring invoices |
| Webhook (Catch Hook) | Custom trigger via HTTP |
Step 2: Webhooks by Zapier (Custom Request)
Add Webhooks by Zapier → Custom Request as an action:
| Field | Value |
|---|---|
| Method | POST |
| URL | https://api.thelawin.dev/v1/generate |
| Data | (see below) |
| Headers | Content-Type: application/json |
X-API-Key: env_sandbox_demo |
Data (JSON):
json
{
"format": "zugferd",
"template": "minimal",
"locale": "de",
"invoice": {
"number": "RE-2026-001",
"date": "2026-01-15",
"currency": "EUR",
"seller": {
"name": "Deine Firma GmbH",
"street": "Musterstrasse 1",
"city": "Berlin",
"postal_code": "10115",
"country": "DE",
"vat_id": "DE123456789"
},
"buyer": {
"name": "Kunde AG",
"city": "Muenchen",
"country": "DE"
},
"items": [
{
"description": "Beratungsleistung",
"quantity": 8,
"unit": "HUR",
"unit_price": 150.00,
"vat_rate": 19
}
]
}
}Dynamic Fields
Replace static values with Zapier variables from your trigger:
"name": ""(from Google Sheets)"unit_price":(from Stripe)
Step 3: Process the Result
The response contains pdf_base64 and filename. Use additional Zapier actions:
Send PDF by email:
- Add Code by Zapier (JavaScript) to convert Base64 to a file URL
- Add Gmail → Send Email with the PDF as attachment
Save PDF to Google Drive:
- Code by Zapier → decode Base64
- Google Drive → Upload File
Example Zap: Google Sheets → ZUGFeRD PDF → Gmail
- Trigger: Google Sheets | New Spreadsheet Row
- Action 1: Webhooks by Zapier | Custom Request (to thelawin.dev)
- Action 2: Gmail | Send Email (with PDF link in body)
Pre-Validation (free)
Use /v1/validate before generating the PDF | costs no credits:
| Field | Value |
|---|---|
| Method | POST |
| URL | https://api.thelawin.dev/v1/validate |
The response returns valid: true/false and any errors.
Common Errors
| Error | Cause | Solution |
|---|---|---|
401 Unauthorized | API key missing | Check headers: X-API-Key |
422 Validation Error | Invalid JSON or missing required fields | Read errors[].path in the response |
| Zapier shows "Task Halted" | HTTP 4xx/5xx response | Check response body in Zapier task history |
Next Steps
- Invoice Formats | ZUGFeRD, XRechnung, Peppol, FatturaPA
- Templates | minimal, classic, compact
- n8n Guide | Alternative for self-hosted workflows