{
 "name": "Create ZUGFeRD invoice (Apify)",
 "nodes": [
  {
   "parameters": {},
   "name": "Manual Trigger",
   "type": "n8n-nodes-base.manualTrigger",
   "typeVersion": 1,
   "position": [
    200,
    300
   ],
   "id": "a1"
  },
  {
   "parameters": {
    "method": "POST",
    "url": "https://api.apify.com/v2/acts/rm.solutions~invoice-pdf-generator/run-sync-get-dataset-items",
    "sendQuery": true,
    "queryParameters": {
     "parameters": [
      {
       "name": "token",
       "value": "={{$env.APIFY_TOKEN}}"
      }
     ]
    },
    "sendBody": true,
    "specifyBody": "json",
    "jsonBody": "{\n \"eInvoice\": \"zugferd\",\n \"language\": \"de\",\n \"currency\": \"EUR\",\n \"taxRate\": \"19\",\n \"seller\": {\n  \"name\": \"Example GmbH\",\n  \"address\": \"Musterstr. 1\",\n  \"postalCode\": \"10115\",\n  \"city\": \"Berlin\",\n  \"country\": \"DE\",\n  \"taxId\": \"DE123456789\",\n  \"email\": \"rechnung@example.com\"\n },\n \"bank\": {\n  \"iban\": \"DE89370400440532013000\"\n },\n \"invoice\": {\n  \"invoiceNumber\": \"2026-042\",\n  \"dueDate\": \"2026-12-11\",\n  \"serviceDate\": \"2026-11-27\",\n  \"buyer\": {\n   \"name\": \"Kunde AG\",\n   \"address\": \"Hauptstr. 5\",\n   \"postalCode\": \"80331\",\n   \"city\": \"München\",\n   \"email\": \"ap@kunde.de\"\n  },\n  \"items\": [\n   {\n    \"description\": \"Webdesign\",\n    \"quantity\": 12,\n    \"unit\": \"h\",\n    \"unitPrice\": 85\n   }\n  ]\n }\n}",
    "options": {}
   },
   "name": "Create invoice",
   "type": "n8n-nodes-base.httpRequest",
   "typeVersion": 4.2,
   "position": [
    420,
    300
   ],
   "id": "a2"
  },
  {
   "parameters": {
    "url": "={{$json.pdfUrl}}",
    "options": {
     "response": {
      "response": {
       "responseFormat": "file"
      }
     }
    }
   },
   "name": "Download PDF",
   "type": "n8n-nodes-base.httpRequest",
   "typeVersion": 4.2,
   "position": [
    640,
    300
   ],
   "id": "a3"
  }
 ],
 "connections": {
  "Manual Trigger": {
   "main": [
    [
     {
      "node": "Create invoice",
      "type": "main",
      "index": 0
     }
    ]
   ]
  },
  "Create invoice": {
   "main": [
    [
     {
      "node": "Download PDF",
      "type": "main",
      "index": 0
     }
    ]
   ]
  }
 },
 "settings": {}
}