{
  "name": "Bitavu - Generate an invoice PDF",
  "nodes": [
    {
      "parameters": {},
      "id": "manual-trigger",
      "name": "Run example",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "template",
              "name": "templateId",
              "value": "invoice",
              "type": "string"
            },
            {
              "id": "revision",
              "name": "revision",
              "value": 1,
              "type": "number"
            },
            {
              "id": "input",
              "name": "data",
              "value": {
                "invoice": {
                  "number": "N8N-2087",
                  "date": "2026-11-10",
                  "due": "2026-11-24"
                },
                "client": {
                  "name": "Workflow demo customer",
                  "address": "Fictional workflow address"
                },
                "items": [
                  {
                    "description": "Workflow setup",
                    "quantity": 1,
                    "unitPrice": 240
                  },
                  {
                    "description": "Monthly automation",
                    "quantity": 2,
                    "unitPrice": 90
                  }
                ],
                "notes": "Generated with data supplied by n8n. Fictional sample data."
              },
              "type": "object"
            },
            {
              "id": "operation",
              "name": "operationId",
              "value": "={{ 'bitavu-n8n-operation-' + $execution.id + '-' + $itemIndex }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "sample-data",
      "name": "Invoice data",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        280,
        0
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.bitavu.com/v1/render",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Idempotency-Key",
              "value": "={{ $json.operationId }}"
            }
          ]
        },
        "sendBody": true,
        "contentType": "json",
        "specifyBody": "json",
        "jsonBody": "={{ { templateId: $json.templateId, revision: $json.revision, data: $json.data } }}",
        "options": {
          "timeout": 120000,
          "response": {
            "response": {
              "responseFormat": "file",
              "outputPropertyName": "pdf"
            }
          }
        }
      },
      "id": "generate-pdf",
      "name": "Generate PDF with Bitavu",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        560,
        0
      ]
    }
  ],
  "connections": {
    "Run example": {
      "main": [
        [
          {
            "node": "Invoice data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Invoice data": {
      "main": [
        [
          {
            "node": "Generate PDF with Bitavu",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "active": false,
  "pinData": {},
  "tags": []
}
