{
  "name": "JLJ Treasury — Norma 43 Parse + Deterministic Invoice Reconciliation (JLJ Lab)",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "jlj-norma43-reconcile",
        "responseMode": "lastNode",
        "options": {}
      },
      "id": "webhook-trigger",
      "name": "Webhook (Norma 43 + Open Invoices)",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [240, 300]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://treasury-api.specgrid-api.workers.dev/api/v1/norma43/parse",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            { "name": "Authorization", "value": "Bearer JLJ-REPLACE-WITH-YOUR-POLAR-KEY" },
            { "name": "Content-Type", "value": "application/json" }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ content: $json.body.norma43Content }) }}"
      },
      "id": "parse-norma43",
      "name": "JLJ Treasury — Parse & Audit Norma 43",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [520, 300]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://treasury-api.specgrid-api.workers.dev/api/v1/reconcile",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            { "name": "Authorization", "value": "Bearer JLJ-REPLACE-WITH-YOUR-POLAR-KEY" },
            { "name": "Content-Type", "value": "application/json" }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ movements: $json.normalizedTransactions, openInvoices: $('Webhook (Norma 43 + Open Invoices)').item.json.body.openInvoices }) }}"
      },
      "id": "reconcile-invoices",
      "name": "JLJ Treasury — Reconcile Open Invoices",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [820, 300]
    }
  ],
  "connections": {
    "Webhook (Norma 43 + Open Invoices)": {
      "main": [[{ "node": "JLJ Treasury — Parse & Audit Norma 43", "type": "main", "index": 0 }]]
    },
    "JLJ Treasury — Parse & Audit Norma 43": {
      "main": [[{ "node": "JLJ Treasury — Reconcile Open Invoices", "type": "main", "index": 0 }]]
    }
  },
  "active": false,
  "settings": { "executionOrder": "v1" },
  "meta": { "templateCredsSetupCompleted": false }
}
