Skip to content

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_public)

Create a Zap: Trigger → Invoice → Action ​

Step 1: Choose a Trigger ​

Pick any trigger to start the Zap:

TriggerUse 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:

FieldValue
MethodPOST
URLhttps://api.thelawin.dev/v1/generate
Data(see below)
HeadersContent-Type: application/json
X-API-Key: env_sandbox_demo_public

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:

  1. Add Code by Zapier (JavaScript) to convert Base64 to a file URL
  2. Add Gmail → Send Email with the PDF as attachment

Save PDF to Google Drive:

  1. Code by Zapier → decode Base64
  2. Google Drive → Upload File

Example Zap: Google Sheets → ZUGFeRD PDF → Gmail ​

  1. Trigger: Google Sheets | New Spreadsheet Row
  2. Action 1: Webhooks by Zapier | Custom Request (to thelawin.dev)
  3. Action 2: Gmail | Send Email (with PDF link in body)

Pre-Validation (free) ​

Use /v1/validate before generating the PDF | costs no credits:

FieldValue
MethodPOST
URLhttps://api.thelawin.dev/v1/validate

The response returns valid: true/false and any errors.

Common Errors ​

ErrorCauseSolution
401 UnauthorizedAPI key missingCheck headers: X-API-Key
422 Validation ErrorInvalid JSON or missing required fieldsRead errors[].path in the response
Zapier shows "Task Halted"HTTP 4xx/5xx responseCheck response body in Zapier task history

Next Steps ​

ZUGFeRD 2.4 & Factur-X 1.0.8 compliant