{"product_id":"redact-restore-pii-in-n8n-claude-sonnet-via-openrouter","title":"Redact \u0026 Restore PII in n8n: Claude Sonnet via OpenRouter","description":"\u003ch3\u003eRedact \u0026amp; Restore PII in n8n using Claude Sonnet (via OpenRouter) — end-to-end safe LLM processing\u003c\/h3\u003e\n\u003cp\u003eThis n8n workflow automatically removes sensitive personal data (PII) from incoming chat text, runs your custom AI task on the sanitized version, and then restores the original values in the final output—so you can keep privacy controls without losing context.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eIngests chat text\u003c\/strong\u003e from the \u003cem\u003eChat Trigger\u003c\/em\u003e input.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eRedacts structured PII locally\u003c\/strong\u003e by detecting and tokenizing items such as \u003cem\u003eemail addresses\u003c\/em\u003e, \u003cem\u003eIBANs\u003c\/em\u003e, \u003cem\u003epayment card numbers\u003c\/em\u003e (including \u003cem\u003eLuhn\u003c\/em\u003e validation), \u003cem\u003eFinnish HETU\u003c\/em\u003e, and \u003cem\u003ephone-like numbers\u003c\/em\u003e. It stores a \u003cem\u003etoken-to-original\u003c\/em\u003e mapping.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eRedacts unstructured PII with Claude Sonnet\u003c\/strong\u003e by calling \u003cstrong\u003eOpenRouter (Anthropic Claude Sonnet)\u003c\/strong\u003e to identify additional sensitive spans (e.g., \u003cem\u003efull names\u003c\/em\u003e and \u003cem\u003ehome addresses\u003c\/em\u003e) and returning them as an array.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eMerges tokens and sanitizes text\u003c\/strong\u003e by replacing detected unstructured spans with redaction tokens.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eRuns your configurable LLM task\u003c\/strong\u003e on the fully sanitized text using a second \u003cstrong\u003eOpenRouter (Claude Sonnet)\u003c\/strong\u003e call (example tasks include summarization or classification).\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eRestores original values\u003c\/strong\u003e in the AI task output by replacing all redaction tokens with the originals, and returns restored text (including any unresolved tokens).\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eProcess customer chat conversations in n8n while keeping PII out of your LLM prompts.\u003c\/li\u003e\n  \u003cli\u003ePerform secure summarization\/classification of support messages without leaking names, addresses, or payment details.\u003c\/li\u003e\n  \u003cli\u003eBuild privacy-preserving workflows for SaaS operators handling sensitive user communications.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003en8n nodes:\u003c\/strong\u003e code, sticky note, Chat Trigger, OpenRouter Chat Model, LLM task step, and an output parser (structured output).\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eOpenRouter integration:\u003c\/strong\u003e uses Anthropic \u003cstrong\u003eClaude Sonnet\u003c\/strong\u003e via \u003cem\u003eOpenRouter\u003c\/em\u003e for unstructured PII span detection and for your AI task.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eSetup:\u003c\/strong\u003e create an OpenRouter API credential in n8n and configure both OpenRouter Chat Model nodes; update the “Your AI Task (replace me)” prompt\/instructions to match your intended operation.\u003c\/li\u003e\n\u003c\/ul\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":45895367426227,"sku":"N8N-18676","price":36.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/Z1GentevoWbGqyEIzeW0u_EOqKn9xn.png?v=1787648536","url":"https:\/\/buyflowscripts.com\/products\/redact-restore-pii-in-n8n-claude-sonnet-via-openrouter","provider":"N8N Commerce","version":"1.0","type":"link"}