{
  "name": "Reconcile expenses and optimize tax deductions with OpenAI GPT‑4.1‑mini and Gmail",
  "nodes": [
    {
      "id": "864b4df3-47aa-4bd8-bc82-0b8aecfcff84",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -960,
        48
      ]
    },
    {
      "id": "a0abc676-1a98-423d-b179-b3be2f1b4349",
      "name": "Workflow Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        -736,
        48
      ]
    },
    {
      "id": "73a31f19-a659-439c-8b6e-5ca27e5c56ee",
      "name": "Fetch Expense Receipts",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -512,
        -48
      ]
    },
    {
      "id": "fa3a847c-a111-4357-a9dc-a2e842e0ea31",
      "name": "Fetch Revenue Data",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -288,
        144
      ]
    },
    {
      "id": "2301d4d7-36d6-4083-8f69-76603e11502a",
      "name": "Extract Receipt Data",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        -288,
        -48
      ]
    },
    {
      "id": "91936ec6-e147-4554-9907-7899f8a5188d",
      "name": "Receipt Matching Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        160,
        48
      ]
    },
    {
      "id": "0b5880c9-c38a-4c9c-9c6e-347a27926a9d",
      "name": "OpenAI Model - Receipt Matching",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        176,
        272
      ]
    },
    {
      "id": "0eea9256-ff36-4ae1-8911-50b6d108f824",
      "name": "Structured Output - Receipt Matching",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        304,
        272
      ]
    },
    {
      "id": "8f5c9240-88fe-480c-b99b-5f512ec21233",
      "name": "Deduction Category Extraction Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        512,
        48
      ]
    },
    {
      "id": "4065dadd-7702-4060-a5e7-4b4a91cf5020",
      "name": "OpenAI Model - Deduction Extraction",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        528,
        272
      ]
    },
    {
      "id": "fae7892a-acd1-4421-88c1-cd146759e30d",
      "name": "Structured Output - Deduction Extraction",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        656,
        272
      ]
    },
    {
      "id": "004909a3-7f57-4a06-a924-889429f0f8a8",
      "name": "Calculate Tax Deductions",
      "type": "n8n-nodes-base.code",
      "position": [
        960,
        80
      ]
    },
    {
      "id": "7e0b6b8b-22f9-4eec-a671-1e86ac84b240",
      "name": "Report Generation Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1312,
        48
      ]
    },
    {
      "id": "9232d324-c195-4a67-91e6-e8c443a9a77b",
      "name": "OpenAI Model - Report Generation",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1360,
        272
      ]
    },
    {
      "id": "60484377-2ae3-47e6-acaa-0a4c135ca31d",
      "name": "Structured Output - Report Generation",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1552,
        272
      ]
    },
    {
      "id": "360e2c80-e7a6-48fe-a4dd-81127395da66",
      "name": "Prepare Final Packet",
      "type": "n8n-nodes-base.set",
      "position": [
        1600,
        48
      ]
    },
    {
      "id": "1d572fd1-07ca-4027-a704-822141d705fb",
      "name": "Send to Tax Agent",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1824,
        48
      ]
    },
    {
      "id": "4acf57e1-69c2-4b35-9e42-ff58e735ab4f",
      "name": "Merge Receipt and Revenue Data",
      "type": "n8n-nodes-base.merge",
      "position": [
        -64,
        48
      ]
    },
    {
      "id": "05568eda-40b9-41fc-963a-8a06e70e07b9",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        320,
        -512
      ],
      "parameters": {
        "width": 640,
        "height": 320,
        "content": "## Prerequisites\nFinancial system API access with read permissions, OpenAI API access. \n## Use Cases\nMonthly expense reconciliation, quarterly tax preparation, annual tax filing automation\n## Customiz"
      }
    },
    {
      "id": "28a59a1b-49eb-48d9-aefe-1e073ea268cb",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        -464
      ],
      "parameters": {
        "width": 416,
        "height": 272,
        "content": "## Setup Steps\n1. Configure financial system API credentials in \"Fetch Expense Receipts\" \n2. Set up OpenAI API key in all AI agent nodes for intelligent processing\n3. Define schedule frequency in \"Sch"
      }
    },
    {
      "id": "aa1417ff-67c7-4254-95a3-6ef9e8b86d55",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -960,
        -480
      ],
      "parameters": {
        "width": 752,
        "height": 288,
        "content": "## How It Works\nThis workflow streamlines financial operations for accounting teams, finance departments, and tax professionals managing business expenses. It addresses the challenge of reconciling ex"
      }
    },
    {
      "id": "b4036f04-9c89-490a-9c20-0b08ba34a65d",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        -160
      ],
      "parameters": {
        "width": 368,
        "height": 832,
        "content": "## Deduction categorization agent classifies expenses into tax-compliant categories\n**Why**: Ensures accurate tax treatment while maximizing legitimate deduction opportunities within regulatory limits"
      }
    },
    {
      "id": "b3e4afb1-563f-4fa1-9444-a43381756010",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        -160
      ],
      "parameters": {
        "width": 368,
        "height": 848,
        "content": "## Receipt matching agent pairs expenses with revenue using AI pattern recognition\n**Why**: Handles inconsistent formats and missing data that rule-based matching systems cannot resolve effectively"
      }
    },
    {
      "id": "61ec375c-9abb-4982-9bb9-6f2e7c04e13e",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1008,
        -160
      ],
      "parameters": {
        "width": 1056,
        "height": 576,
        "content": "## Parallel data collection fetches expense receipts and revenue records\n**Why**: Simultaneous retrieval reduces processing time and ensures data consistency across both sources"
      }
    },
    {
      "id": "50ce9d00-30cb-4f33-8bf5-0b7c0a94f975",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1200,
        -160
      ],
      "parameters": {
        "width": 832,
        "height": 832,
        "content": "\n## Report generation agent compiles comprehensive documentation packets\n**Why**: Creates audit-ready records with proper supporting evidence, reducing tax preparation time significantly"
      }
    },
    {
      "id": "b125b150-0b20-4c3f-93b9-ef3065f73ae6",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        864,
        -160
      ],
      "parameters": {
        "width": 304,
        "height": 1088,
        "content": "## Tax calculator determines optimized deductions considering category constraints\n**Why**: Maximizes tax benefits while maintaining compliance with deduction caps and regulatory requirements"
      }
    }
  ],
  "connections": {
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Workflow Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Revenue Data": {
      "main": [
        [
          {
            "node": "Merge Receipt and Revenue Data",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Extract Receipt Data": {
      "main": [
        [
          {
            "node": "Merge Receipt and Revenue Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Final Packet": {
      "main": [
        [
          {
            "node": "Send to Tax Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Expense Receipts": {
      "main": [
        [
          {
            "node": "Extract Receipt Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Receipt Matching Agent": {
      "main": [
        [
          {
            "node": "Deduction Category Extraction Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Configuration": {
      "main": [
        [
          {
            "node": "Fetch Expense Receipts",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch Revenue Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Report Generation Agent": {
      "main": [
        [
          {
            "node": "Prepare Final Packet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate Tax Deductions": {
      "main": [
        [
          {
            "node": "Report Generation Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Receipt and Revenue Data": {
      "main": [
        [
          {
            "node": "Receipt Matching Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Model - Receipt Matching": {
      "ai_languageModel": [
        [
          {
            "node": "Receipt Matching Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Model - Report Generation": {
      "ai_languageModel": [
        [
          {
            "node": "Report Generation Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Deduction Category Extraction Agent": {
      "main": [
        [
          {
            "node": "Calculate Tax Deductions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Model - Deduction Extraction": {
      "ai_languageModel": [
        [
          {
            "node": "Deduction Category Extraction Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output - Receipt Matching": {
      "ai_outputParser": [
        [
          {
            "node": "Receipt Matching Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output - Report Generation": {
      "ai_outputParser": [
        [
          {
            "node": "Report Generation Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output - Deduction Extraction": {
      "ai_outputParser": [
        [
          {
            "node": "Deduction Category Extraction Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  }
}