{
  "name": "Post bank statement transactions to QuickBooks Online using OpenRouter AI",
  "nodes": [
    {
      "id": "a6f5bd1b-9488-4414-afca-e9ed592e52b6",
      "name": "Extract PDF Text",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        -3264,
        2456
      ]
    },
    {
      "id": "340e4c28-389a-4efc-af96-86c601cccdf0",
      "name": "Transaction Extractor AI",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -3040,
        2456
      ]
    },
    {
      "id": "6444a755-5ad6-4019-b0e5-683745b66876",
      "name": "JSON Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -2864,
        2688
      ]
    },
    {
      "id": "b0ab778f-6d40-4311-8f4d-421c13662097",
      "name": "Create QuickBooks SalesReceipt",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -208,
        2368
      ]
    },
    {
      "id": "ae994181-acf4-427a-93e3-f93a15901e9b",
      "name": "Bank Statement Form",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -3488,
        2456
      ]
    },
    {
      "id": "52ea829a-a625-4793-ab63-b40c41520f84",
      "name": "OpenRouter Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        -3040,
        2688
      ]
    },
    {
      "id": "af43d4d4-9ca9-44d3-96d6-0a1c63eb7e67",
      "name": "Split Transactions",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -2688,
        2456
      ]
    },
    {
      "id": "dee42064-962d-48bb-a33d-09a2fc48c455",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -2464,
        2456
      ]
    },
    {
      "id": "b41ef097-b891-4704-8684-470f43d44ee9",
      "name": "Build Salesreceipt Payload",
      "type": "n8n-nodes-base.code",
      "position": [
        -416,
        2368
      ]
    },
    {
      "id": "5733b401-f55c-4062-8717-35befaeddee3",
      "name": "Get many customers",
      "type": "n8n-nodes-base.quickbooks",
      "position": [
        -976,
        2336
      ]
    },
    {
      "id": "cf1debb7-ccf5-4d31-96e8-593ac5592260",
      "name": "Create Vendor",
      "type": "n8n-nodes-base.quickbooks",
      "position": [
        -1280,
        2672
      ]
    },
    {
      "id": "2b8e13cf-c84d-4d03-950f-1a2819cb435a",
      "name": "Vendor Exists?",
      "type": "n8n-nodes-base.if",
      "position": [
        -1504,
        2752
      ]
    },
    {
      "id": "47ab4b59-e851-4956-987a-1607cee94918",
      "name": "Find Vendor",
      "type": "n8n-nodes-base.quickbooks",
      "position": [
        -1728,
        2752
      ]
    },
    {
      "id": "9411680b-8cd9-4c75-b8c4-9011caff2531",
      "name": "Search Categories",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1952,
        2752
      ]
    },
    {
      "id": "789c680c-6b68-4d79-8656-4c145c188a08",
      "name": "Create Items",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1360,
        2272
      ]
    },
    {
      "id": "eeb77754-2940-483b-8d6d-31247eff0196",
      "name": "Collect All Item Mappings",
      "type": "n8n-nodes-base.code",
      "position": [
        -1168,
        2336
      ]
    },
    {
      "id": "2b87de0a-cca5-46b4-82ee-a001b356af29",
      "name": "Need to Create Items?",
      "type": "n8n-nodes-base.if",
      "position": [
        -1584,
        2320
      ]
    },
    {
      "id": "fdce277b-d161-4117-88e6-36cdabd6ae09",
      "name": "Get All QB Items",
      "type": "n8n-nodes-base.quickbooks",
      "position": [
        -1968,
        2320
      ]
    },
    {
      "id": "96c9f261-ee74-4a10-8214-59ec302eaa72",
      "name": "Check Which Items to Create",
      "type": "n8n-nodes-base.code",
      "position": [
        -1776,
        2320
      ]
    },
    {
      "id": "fdc9ab25-31f3-4d09-b478-79f87fa05914",
      "name": "Credit or Debit?",
      "type": "n8n-nodes-base.switch",
      "position": [
        -2192,
        2464
      ]
    },
    {
      "id": "0bc3819d-3c03-4fd7-a411-c55f21564300",
      "name": "Customers Exists?1",
      "type": "n8n-nodes-base.if",
      "position": [
        -784,
        2336
      ]
    },
    {
      "id": "12636d7f-5d9a-4882-8216-f63566c6dc99",
      "name": "Create a Customer",
      "type": "n8n-nodes-base.quickbooks",
      "position": [
        -576,
        2272
      ]
    },
    {
      "id": "8d87eca6-2b68-44c7-a81b-a7b6595fb2b4",
      "name": "Create QuickBooks Expense",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -832,
        2752
      ]
    },
    {
      "id": "bcaacfb1-d417-4372-b1e5-0870a00c8897",
      "name": "Build Expense Payload",
      "type": "n8n-nodes-base.code",
      "position": [
        -1056,
        2752
      ]
    },
    {
      "id": "7c1aedbd-4bc1-4d3c-84e0-2c84f273b474",
      "name": "Workflow Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3984,
        2288
      ],
      "parameters": {
        "width": 380,
        "height": 508,
        "content": "## How it works\nUpload a password-protected or normal bank statement PDF through a web form. AI extracts all transactions and classifies them as credits (income) or debits (expenses). Credits create S"
      }
    },
    {
      "id": "683f4fc6-6b8a-4b6e-bc24-21be977797b2",
      "name": "PDF Extraction",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3296,
        2256
      ],
      "parameters": {
        "width": 560,
        "height": 588,
        "content": "## PDF Extraction\nForm trigger receives bank statement PDF. Text is extracted and sent to AI agent with structured output parser to identify all transactions with dates, amounts, descriptions, and pay"
      }
    },
    {
      "id": "97fdacea-2f20-461f-8ddc-b4d2703bace2",
      "name": "Transaction Processing",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2720,
        2256
      ],
      "parameters": {
        "width": 480,
        "height": 588,
        "content": "## Transaction Processing\nSplit extracted transactions into individual items. Loop processes each one, routing credits and debits to separate paths based on transaction type."
      }
    },
    {
      "id": "c77e9110-11ff-4932-acc4-50e1f12a362a",
      "name": "Credit Path",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2016,
        2144
      ],
      "parameters": {
        "width": 1752,
        "height": 420,
        "content": "## Credit Path (Income)\nFetches existing QuickBooks items or creates new service items. Checks for existing customers by name, creates if missing. Builds and posts Sales Receipt to record income trans"
      }
    },
    {
      "id": "ba30de8a-1dbf-474b-aef5-927c4bb45459",
      "name": "Debit Path",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2016,
        2576
      ],
      "parameters": {
        "width": 1376,
        "height": 420,
        "content": "## Debit Path (Expenses)\nLoads expense categories from Chart of Accounts. Searches for vendor by payee name, creates if not found. Auto-maps transaction to expense category based on description keywor"
      }
    }
  ],
  "connections": {
    "Find Vendor": {
      "main": [
        [
          {
            "node": "Vendor Exists?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Items": {
      "main": [
        [
          {
            "node": "Collect All Item Mappings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Vendor": {
      "main": [
        [
          {
            "node": "Build Expense Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Vendor Exists?": {
      "main": [
        [
          {
            "node": "Create Vendor",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Build Expense Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Credit or Debit?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Credit or Debit?": {
      "main": [
        [
          {
            "node": "Get All QB Items",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Search Categories",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract PDF Text": {
      "main": [
        [
          {
            "node": "Transaction Extractor AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get All QB Items": {
      "main": [
        [
          {
            "node": "Check Which Items to Create",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a Customer": {
      "main": [
        [
          {
            "node": "Build Salesreceipt Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search Categories": {
      "main": [
        [
          {
            "node": "Find Vendor",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Customers Exists?1": {
      "main": [
        [
          {
            "node": "Create a Customer",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Build Salesreceipt Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get many customers": {
      "main": [
        [
          {
            "node": "Customers Exists?1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "JSON Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Transaction Extractor AI",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Split Transactions": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Bank Statement Form": {
      "main": [
        [
          {
            "node": "Extract PDF Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Expense Payload": {
      "main": [
        [
          {
            "node": "Create QuickBooks Expense",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Need to Create Items?": {
      "main": [
        [
          {
            "node": "Create Items",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Collect All Item Mappings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Transaction Extractor AI",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Transaction Extractor AI": {
      "main": [
        [
          {
            "node": "Split Transactions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Collect All Item Mappings": {
      "main": [
        [
          {
            "node": "Get many customers",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create QuickBooks Expense": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Salesreceipt Payload": {
      "main": [
        [
          {
            "node": "Create QuickBooks SalesReceipt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Which Items to Create": {
      "main": [
        [
          {
            "node": "Need to Create Items?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create QuickBooks SalesReceipt": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}