{
  "name": "Ausgangsrechnung in Lexware Office (Vorlage clxdigital.de)",
  "nodes": [
    {
      "parameters": {},
      "id": "13a48099-f09c-5193-8bbf-196c2fcd8c7c",
      "name": "Testlauf starten",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "a1",
              "name": "kunde_name",
              "value": "Musterfirma GmbH (Test)",
              "type": "string"
            },
            {
              "id": "a2",
              "name": "strasse",
              "value": "Musterstraße 1",
              "type": "string"
            },
            {
              "id": "a3",
              "name": "plz",
              "value": "12345",
              "type": "string"
            },
            {
              "id": "a4",
              "name": "ort",
              "value": "Musterstadt",
              "type": "string"
            },
            {
              "id": "a5",
              "name": "leistung",
              "value": "Beratung Prozessanalyse (Testdaten)",
              "type": "string"
            },
            {
              "id": "a6",
              "name": "menge",
              "value": 2,
              "type": "number"
            },
            {
              "id": "a7",
              "name": "einheit",
              "value": "Stunde",
              "type": "string"
            },
            {
              "id": "a8",
              "name": "einzelpreis_netto",
              "value": 100,
              "type": "number"
            },
            {
              "id": "a9",
              "name": "steuersatz",
              "value": 19,
              "type": "number"
            },
            {
              "id": "a10",
              "name": "leistungsdatum",
              "value": "2026-11-27",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "8432bafd-cbd5-5bee-900f-f70b1a540fc3",
      "name": "Testauftrag",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        240,
        0
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.lexware.io/v1/invoices",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"voucherDate\": \"{{ $now.setZone('Europe/Berlin').startOf('day').toISO() }}\",\n  \"address\": {\n    \"name\": \"{{ $json.kunde_name }}\",\n    \"street\": \"{{ $json.strasse }}\",\n    \"zip\": \"{{ $json.plz }}\",\n    \"city\": \"{{ $json.ort }}\",\n    \"countryCode\": \"DE\"\n  },\n  \"lineItems\": [\n    {\n      \"type\": \"custom\",\n      \"name\": \"{{ $json.leistung }}\",\n      \"quantity\": {{ $json.menge }},\n      \"unitName\": \"{{ $json.einheit }}\",\n      \"unitPrice\": {\n        \"currency\": \"EUR\",\n        \"netAmount\": {{ $json.einzelpreis_netto }},\n        \"taxRatePercentage\": {{ $json.steuersatz }}\n      }\n    }\n  ],\n  \"totalPrice\": { \"currency\": \"EUR\" },\n  \"taxConditions\": { \"taxType\": \"net\" },\n  \"shippingConditions\": {\n    \"shippingType\": \"service\",\n    \"shippingDate\": \"{{ DateTime.fromISO($json.leistungsdatum, { zone: 'Europe/Berlin' }).toISO() }}\"\n  },\n  \"title\": \"Rechnung\",\n  \"introduction\": \"Unsere Leistungen stellen wir Ihnen hiermit in Rechnung.\",\n  \"remark\": \"Testrechnung aus n8n, bitte nicht versenden.\"\n}",
        "options": {}
      },
      "id": "0f474927-05e7-538e-94e6-6fe0c254afdc",
      "name": "Rechnungsentwurf anlegen",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        480,
        0
      ]
    },
    {
      "parameters": {
        "url": "=https://api.lexware.io/v1/invoices/{{ $json.id }}",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json"
            }
          ]
        },
        "options": {}
      },
      "id": "d11be3bd-04c9-5ec9-9f83-bd4d5dca90bb",
      "name": "Entwurf abrufen",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        720,
        0
      ]
    },
    {
      "parameters": {
        "content": "## Ausgangsrechnung in Lexware Office\nVorlage von clxdigital.de/anleitungen\n\n- Legt eine Rechnung als **Entwurf** an (ohne finalize).\n- In beiden HTTP-Nodes deinen Zugang vom Typ **Bearer Auth** wählen.\n- Kein API-Schlüssel in dieser Datei. Nur Testdaten.\n- Höchstens 2 Anfragen pro Sekunde an die API.",
        "height": 250,
        "width": 480,
        "color": 7
      },
      "id": "c61624b9-e6a1-50eb-803b-05d12e49c6e7",
      "name": "Hinweis",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -40,
        -330
      ]
    }
  ],
  "connections": {
    "Testlauf starten": {
      "main": [
        [
          {
            "node": "Testauftrag",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Testauftrag": {
      "main": [
        [
          {
            "node": "Rechnungsentwurf anlegen",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Rechnungsentwurf anlegen": {
      "main": [
        [
          {
            "node": "Entwurf abrufen",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": false
  }
}