{
  "name": "Detect and mask PII for GDPR-safe AI document analysis with Anthropic and PostgreSQL",
  "nodes": [
    {
      "id": "509fea67-c604-42e9-abc9-ce599ad31da8",
      "name": "Document Upload Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -2480,
        448
      ]
    },
    {
      "id": "2d5bcfdf-1489-43ad-8504-87f6a3db157b",
      "name": "Workflow Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        -2240,
        448
      ]
    },
    {
      "id": "b3a269ce-b37e-4541-a87f-e5a0b4dae12d",
      "name": "Email Detector",
      "type": "n8n-nodes-base.code",
      "position": [
        -1632,
        160
      ]
    },
    {
      "id": "b6ebdf9f-f3de-4a80-beb4-f726821403f5",
      "name": "Phone Detector",
      "type": "n8n-nodes-base.code",
      "position": [
        -1632,
        352
      ]
    },
    {
      "id": "024b8041-4754-4318-86e5-957b877ba894",
      "name": "ID Number Detector",
      "type": "n8n-nodes-base.code",
      "position": [
        -1632,
        544
      ]
    },
    {
      "id": "66ab913d-3b63-4f75-8a1b-8044f9d87de5",
      "name": "Address Detector AI",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -1696,
        832
      ]
    },
    {
      "id": "e98b7074-76d6-47ee-8ef2-675f3bd0072f",
      "name": "Anthropic Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        -1680,
        1056
      ]
    },
    {
      "id": "a62f38ce-f36f-44b6-8779-300ed5696de7",
      "name": "Address Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -1552,
        1056
      ]
    },
    {
      "id": "20e85e22-f4bd-4f36-9c8d-a035bd4ac003",
      "name": "Merge PII Detections",
      "type": "n8n-nodes-base.merge",
      "position": [
        -1344,
        256
      ]
    },
    {
      "id": "38f16629-57c7-45df-ba10-d9ea4f82369a",
      "name": "PII Consolidation & Conflict Resolver",
      "type": "n8n-nodes-base.code",
      "position": [
        -1104,
        288
      ]
    },
    {
      "id": "772fe712-8991-4aee-a79d-62477300c34a",
      "name": "Tokenization & Vault Storage",
      "type": "n8n-nodes-base.code",
      "position": [
        -864,
        288
      ]
    },
    {
      "id": "b47316b1-0af7-4008-879d-3e6cb8e9bbd5",
      "name": "Store Tokens in Vault",
      "type": "n8n-nodes-base.postgres",
      "position": [
        -688,
        288
      ]
    },
    {
      "id": "af0a7c94-8163-438d-a6c5-aa8f6f7b9087",
      "name": "Generate Masked Text",
      "type": "n8n-nodes-base.code",
      "position": [
        -448,
        288
      ]
    },
    {
      "id": "bc397644-596a-4577-bbfc-1b07e642c8bd",
      "name": "AI Processing (Masked Data)",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        0,
        -80
      ]
    },
    {
      "id": "6635ccf1-cf62-4d25-9380-82f069f03ac4",
      "name": "AI Processing Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        -48,
        160
      ]
    },
    {
      "id": "38140b45-2819-4624-9205-3d6a34e57990",
      "name": "AI Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        176,
        176
      ]
    },
    {
      "id": "4ebcce26-37f1-4648-83a6-1b02a85a6b14",
      "name": "Re-Injection Controller",
      "type": "n8n-nodes-base.code",
      "position": [
        400,
        96
      ]
    },
    {
      "id": "0600a96e-6d42-4f3f-8873-053e4bc165f8",
      "name": "Retrieve Original Values",
      "type": "n8n-nodes-base.postgres",
      "position": [
        592,
        96
      ]
    },
    {
      "id": "421b28cc-27c5-4657-ad05-18580a6fe572",
      "name": "Restore Original PII",
      "type": "n8n-nodes-base.code",
      "position": [
        800,
        96
      ]
    },
    {
      "id": "2c6f4f1e-4a06-4e1d-8b42-cc7900705149",
      "name": "Store Audit Log",
      "type": "n8n-nodes-base.postgres",
      "position": [
        1024,
        96
      ]
    },
    {
      "id": "8da4b467-5509-4ebb-9c02-569ab4d641e6",
      "name": "Masking Success Check",
      "type": "n8n-nodes-base.if",
      "position": [
        -224,
        288
      ]
    },
    {
      "id": "0f13d421-974b-4be1-b63d-14f960285477",
      "name": "Block AI Processing",
      "type": "n8n-nodes-base.set",
      "position": [
        32,
        656
      ]
    },
    {
      "id": "a7569d7e-db56-4b12-9791-b706598c336a",
      "name": "Send Alert Notification",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        272,
        656
      ]
    },
    {
      "id": "77b63ba2-8ba4-405a-998c-bf223e7e9a1c",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2544,
        304
      ],
      "parameters": {
        "width": 422,
        "height": 336,
        "content": "## Document Intake & Configuration\n\nReceives documents via webhook and initializes workflow settings such as document ID, confidence thresholds, and database table configuration."
      }
    },
    {
      "id": "8c88f2f3-b3e1-4c2d-a3ae-3f114abf5687",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2096,
        304
      ],
      "parameters": {
        "width": 326,
        "height": 336,
        "content": "##  Text Extraction\n\nExtracts raw text from uploaded PDF or document files while preserving original content for downstream processing."
      }
    },
    {
      "id": "4e63dfbc-bfd9-4ca3-bd59-3e8203bd306d",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1744,
        -48
      ],
      "parameters": {
        "width": 326,
        "height": 720,
        "content": "## Multi-Detector PII Detection\n\nIdentifies sensitive data including emails, phone numbers, IDs, and addresses using regex-based logic and AI-powered detection."
      }
    },
    {
      "id": "0693dde2-322f-460a-81ee-818fc47d9069",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1792,
        688
      ],
      "parameters": {
        "width": 486,
        "height": 528,
        "content": "## Address Detection (AI-Powered)\n\nUses an AI model to identify physical addresses in text and returns structured results with location, position, and confidence for each detected address."
      }
    },
    {
      "id": "422a1021-f3ca-4548-9e36-edd8bcca935a",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1392,
        48
      ],
      "parameters": {
        "width": 214,
        "height": 416,
        "content": "## PII Aggregation\n\nCombines outputs from multiple detectors into a unified dataset for further processing."
      }
    },
    {
      "id": "af88bf3a-0499-4e2c-a1c7-2701604aac83",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1152,
        48
      ],
      "parameters": {
        "width": 230,
        "height": 416,
        "content": "## Conflict Resolution Engine\n\nResolves overlapping detections, prioritizes higher confidence matches, and removes duplicate PII entries."
      }
    },
    {
      "id": "dab87540-2c97-41af-895c-758a92ec7499",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        368,
        -48
      ],
      "parameters": {
        "width": 566,
        "height": 352,
        "content": "## Re-Injection Controller\n\nDetermines which fields are allowed to restore original PII based on permissions and prepares retrieval requests and Fetches original sensitive values and Replaces tokens w"
      }
    },
    {
      "id": "75e4b5f1-545c-40cf-8737-780eb2b79ead",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -144,
        -208
      ],
      "parameters": {
        "width": 470,
        "height": 336,
        "content": "## AI Processing (Safe Data)\n\nProcesses the masked document using AI while preserving tokens to prevent exposure of sensitive information."
      }
    },
    {
      "id": "15588210-d142-4328-83a2-cba8155a23ef",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        960,
        -64
      ],
      "parameters": {
        "width": 246,
        "height": 368,
        "content": "## Audit Logging\n\nStores processing metadata, detected PII types, and re-injection events for compliance and traceability."
      }
    },
    {
      "id": "5050b4ea-ac25-43d9-9d3b-88b392e70636",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -16,
        528
      ],
      "parameters": {
        "width": 454,
        "height": 272,
        "content": "## Error Handling & Alerts\n\nBlocks AI processing and triggers alerts when masking fails or compliance rules are violated."
      }
    },
    {
      "id": "e6490d3e-4ed4-45f6-b851-3c57f6974863",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -896,
        48
      ],
      "parameters": {
        "width": 358,
        "height": 416,
        "content": "## Tokenization & Vault Storage\n\nReplaces detected PII with secure tokens and stores original values in a protected database vault."
      }
    },
    {
      "id": "0391e0e3-e5b1-4f7c-9e8e-8638bf9c3c35",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -512,
        48
      ],
      "parameters": {
        "width": 278,
        "height": 416,
        "content": "## Masking Validation\n\nEnsures all PII has been successfully masked and blocks further processing if any sensitive data remains exposed."
      }
    },
    {
      "id": "f3b40a67-5f75-4495-93cb-1f1939af6088",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3232,
        192
      ],
      "parameters": {
        "width": 416,
        "height": 512,
        "content": "##  GDPR-Compliant AI Document Processing Pipeline\n\nThis workflow securely processes documents by detecting and tokenizing PII, masking sensitive data before AI analysis, and selectively restoring ori"
      }
    },
    {
      "id": "d1a3aad2-b91c-4551-851c-0c52035b89ef",
      "name": "Extract Text",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        -2032,
        448
      ]
    }
  ],
  "connections": {
    "Extract Text": {
      "main": [
        [
          {
            "node": "Email Detector",
            "type": "main",
            "index": 0
          },
          {
            "node": "Phone Detector",
            "type": "main",
            "index": 0
          },
          {
            "node": "ID Number Detector",
            "type": "main",
            "index": 0
          },
          {
            "node": "Address Detector AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Detector": {
      "main": [
        [
          {
            "node": "Merge PII Detections",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Phone Detector": {
      "main": [
        [
          {
            "node": "Merge PII Detections",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "AI Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Processing (Masked Data)",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "ID Number Detector": {
      "main": [
        [
          {
            "node": "Merge PII Detections",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "AI Processing Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Processing (Masked Data)",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Address Detector AI": {
      "main": [
        [
          {
            "node": "Merge PII Detections",
            "type": "main",
            "index": 3
          }
        ]
      ]
    },
    "Block AI Processing": {
      "main": [
        [
          {
            "node": "Send Alert Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Anthropic Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Address Detector AI",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Generate Masked Text": {
      "main": [
        [
          {
            "node": "Masking Success Check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge PII Detections": {
      "main": [
        [
          {
            "node": "PII Consolidation & Conflict Resolver",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Restore Original PII": {
      "main": [
        [
          {
            "node": "Store Audit Log",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Address Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Address Detector AI",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Masking Success Check": {
      "main": [
        [
          {
            "node": "AI Processing (Masked Data)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Block AI Processing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store Tokens in Vault": {
      "main": [
        [
          {
            "node": "Generate Masked Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Configuration": {
      "main": [
        [
          {
            "node": "Extract Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Document Upload Webhook": {
      "main": [
        [
          {
            "node": "Workflow Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Re-Injection Controller": {
      "main": [
        [
          {
            "node": "Retrieve Original Values",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Retrieve Original Values": {
      "main": [
        [
          {
            "node": "Restore Original PII",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Processing (Masked Data)": {
      "main": [
        [
          {
            "node": "Re-Injection Controller",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Tokenization & Vault Storage": {
      "main": [
        [
          {
            "node": "Store Tokens in Vault",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "PII Consolidation & Conflict Resolver": {
      "main": [
        [
          {
            "node": "Tokenization & Vault Storage",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}