Block 1 - Registered API Keys
- Type / Role
- n8n-nodes-base.set - set
- Config choices
- Version 3.4
This workflow is provided as-is. Please review and test before using in production.
How it works This workflow demonstrates a fundamental pattern for securing a webhook by requiring an API key. It acts as a gatekeeper, checking for a valid key in the request header before allowing...
n8n-nodes-base.set, n8n-nodes-base.if, n8n-nodes-base.stickynote, n8n-nodes-base.respondtowebhook, n8n-nodes-base.webhook, n8n-nodes-base.httprequest, n8n-nodes-base.filter, n8n-nodes-base.splitout
This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Lucas Peyrin.
Original n8n.io sourceThis workflow demonstrates a fundamental pattern for securing a webhook by requiring an API key. It acts as a gatekeeper, checking for a valid key in the request header before allowing the request to proceed.
Secured Webhook node receives an incoming POST request. It expects an API key to be sent in the x-api-key header.Check API Key node takes the key from the incoming request's header.Get API Key) which acts as a mock database.Registered API Keys node) and filters it to find a match for the key that was provided.API Key Identified node routes the execution to the "success" path, returning a 200 OK response with the identified user's ID.401 Unauthorized error.This pattern separates the public-facing endpoint from the data source, which is a good security practice.
Setup time: ~2 minutes
This workflow is designed to be a self-contained example.
X-N8N-Auth, Value: my-secret-password). Select this credential in all four webhook/HTTP Request nodes.Registered API Keys node. This is your mock database. Edit the array to include the user_id and api_key pairs you want to authorize.Test Secure Webhook node to send a request.x-api-key header to an invalid key to see the 401 Unauthorized error.For Production: Replace the mock database part of this workflow (the Get API Key webhook and Registered API Keys node) with a real database node like Supabase, Postgres, or Baserow to look up keys.
This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.
| Workflow | 🗲 Creating a Secure Webhook - MUST HAVE |
|---|---|
| Complexity | advanced |
| Nodes | 16 |
| Categories | SecOps |
| Author | Lucas Peyrin |
| Published | 24 Jun 2025 |
Use the JSON export at /data/workflows/5174/5174.json as the source template for this automation.
Open n8n, import the downloaded JSON, and review each node before activating the workflow.
Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.
Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.
Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.
Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.
Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.
How it works This workflow demonstrates a fundamental pattern for securing a webhook by requiring an API key. It acts as a gatekeeper, checking for a valid key in the request header before allowing...
Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.
Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your SecOps use case.