Skip to main content
RapidDev - Software Development Agency
n8n-tutorial

How to Test a Webhook in n8n

To test a webhook in n8n, open the Webhook trigger node and click Listen for Test Event to activate the test URL. Send a request to the test URL (which uses /webhook-test/ instead of /webhook/) using curl, Postman, or your application. The incoming data appears in the node's output panel, letting you inspect headers, body, and query parameters before activating the workflow for production use.

What you'll learn

  • The difference between test and production webhook URLs in n8n
  • How to send test requests using curl and inspect the data in the editor
  • How to configure authentication on webhooks and test authenticated requests
  • How to debug common webhook issues like missing data and wrong content types
Book a free consultation
4.9Clutch rating
600+Happy partners
17+Countries served
190+Team members
Intermediate8 min read15-20 minutesn8n 1.0+ (self-hosted and Cloud)March 2026RapidDev Engineering Team
TL;DR

To test a webhook in n8n, open the Webhook trigger node and click Listen for Test Event to activate the test URL. Send a request to the test URL (which uses /webhook-test/ instead of /webhook/) using curl, Postman, or your application. The incoming data appears in the node's output panel, letting you inspect headers, body, and query parameters before activating the workflow for production use.

Testing Webhooks in n8n: Test URLs, Production URLs, and Data Inspection

n8n provides two webhook URLs for every Webhook trigger node: a test URL for development and a production URL for live use. Understanding the difference and knowing how to send test requests, inspect incoming data, and debug common issues is essential for building reliable webhook-driven workflows. This tutorial walks you through the full testing cycle from first request to production activation.

Prerequisites

  • A running n8n instance (self-hosted or Cloud)
  • A workflow with a Webhook trigger node
  • curl or Postman installed for sending HTTP requests
  • Access to the n8n editor in a browser

Step-by-step guide

1

Understand the test URL vs production URL

Every Webhook trigger node in n8n has two URLs. The test URL contains /webhook-test/ in the path and is only active when you click Listen for Test Event in the editor. It is designed for development and lets you see the incoming data immediately in the node output panel. The production URL contains /webhook/ and is only active when the workflow is toggled to Active. It runs the full workflow in the background. During development, always use the test URL so you can inspect data step by step without activating the workflow.

Expected result: You understand that /webhook-test/ is for development and /webhook/ is for production, and they are never active simultaneously.

2

Start listening for a test event

Open your workflow in the n8n editor and click on the Webhook trigger node. In the node panel, you will see the test URL displayed. Click the Listen for Test Event button (or click Test Workflow at the top). n8n now waits for an incoming HTTP request at the test URL. The editor shows a spinning indicator while it waits. You have approximately 120 seconds to send a request before the listener times out. Keep the editor tab open and focused while testing — navigating away may interrupt the listener.

Expected result: The n8n editor shows a Waiting for test event indicator on the Webhook node.

3

Send a test request with curl

Open a terminal and send an HTTP request to the test URL using curl. Include a JSON body with sample data that represents what your real integration will send. Use the -H flag to set the Content-Type header to application/json so n8n correctly parses the body. If your webhook expects query parameters, append them to the URL. If it expects form data, use -d with URL-encoded values and set Content-Type to application/x-www-form-urlencoded instead.

typescript
1# JSON POST request
2curl -X POST https://your-n8n.example.com/webhook-test/my-webhook \
3 -H 'Content-Type: application/json' \
4 -d '{
5 "event": "order.created",
6 "customer_email": "test@example.com",
7 "order_id": 12345,
8 "total": 99.99
9 }'
10
11# GET request with query parameters
12curl 'https://your-n8n.example.com/webhook-test/my-webhook?status=active&page=1'
13
14# Form data POST request
15curl -X POST https://your-n8n.example.com/webhook-test/my-webhook \
16 -H 'Content-Type: application/x-www-form-urlencoded' \
17 -d 'name=John&email=john@example.com'

Expected result: curl returns a response from n8n (typically the workflow output or a simple acknowledgment), and the data appears in the Webhook node's output panel in the editor.

4

Inspect the incoming data in the n8n editor

After the test request arrives, the Webhook node's output panel shows the parsed data. Click on the node to open it and review the Output tab. You will see the request body under $json, headers under $headers, query parameters under $query, and URL parameters under $params. Switch between Table view and JSON view to explore the data structure. This is the exact data shape that downstream nodes will receive. If a field is missing or has an unexpected type, fix the sender's request before proceeding.

Expected result: The Webhook node output shows the parsed JSON body, headers, query parameters, and any URL path parameters from your test request.

5

Test with authentication enabled

If your webhook requires authentication, configure it in the Webhook node settings under Authentication. n8n supports Basic Auth, Header Auth, and JWT. After enabling authentication, your test requests must include the correct credentials. For Basic Auth, use the -u flag in curl. For Header Auth, add the custom header with -H. Test that authenticated requests succeed and unauthenticated requests return a 401 or 403 error.

typescript
1# Basic Auth
2curl -X POST https://your-n8n.example.com/webhook-test/my-webhook \
3 -u 'myuser:mypassword' \
4 -H 'Content-Type: application/json' \
5 -d '{"test": true}'
6
7# Header Auth (e.g., X-API-Key)
8curl -X POST https://your-n8n.example.com/webhook-test/my-webhook \
9 -H 'X-API-Key: your-secret-key-here' \
10 -H 'Content-Type: application/json' \
11 -d '{"test": true}'
12
13# Verify unauthenticated requests are rejected
14curl -v -X POST https://your-n8n.example.com/webhook-test/my-webhook \
15 -H 'Content-Type: application/json' \
16 -d '{"test": true}'

Expected result: Authenticated requests are accepted and data appears in the editor. Unauthenticated requests return a 401 Unauthorized response.

6

Activate the workflow and switch to the production URL

Once your test data looks correct and all downstream nodes work as expected, toggle the workflow to Active using the switch in the top-right corner of the editor. The production URL (/webhook/) is now live and will run the full workflow for every incoming request. Update your external application or service to send requests to the production URL instead of the test URL. The test URL stops responding once the workflow is active. Verify production behavior by checking the Executions panel for successful runs.

Expected result: The workflow is active, the production webhook URL accepts requests, and executions appear in the Executions panel.

Complete working example

webhook-test-script.sh
1#!/bin/bash
2# Webhook testing script for n8n
3# Usage: ./webhook-test-script.sh <webhook_url> [auth_type]
4
5WEBHOOK_URL="${1:?Usage: $0 <webhook_url> [none|basic|header]}"
6AUTH_TYPE="${2:-none}"
7
8echo "Testing webhook: $WEBHOOK_URL"
9echo "Auth type: $AUTH_TYPE"
10echo "---"
11
12# Build auth flags
13AUTH_FLAGS=""
14case $AUTH_TYPE in
15 basic)
16 read -p "Username: " USERNAME
17 read -sp "Password: " PASSWORD
18 echo
19 AUTH_FLAGS="-u $USERNAME:$PASSWORD"
20 ;;
21 header)
22 read -p "Header name (e.g., X-API-Key): " HEADER_NAME
23 read -sp "Header value: " HEADER_VALUE
24 echo
25 AUTH_FLAGS="-H '$HEADER_NAME: $HEADER_VALUE'"
26 ;;
27esac
28
29# Test 1: JSON POST
30echo "\n[Test 1] JSON POST request"
31curl -s -w "\nHTTP Status: %{http_code}\n" \
32 -X POST "$WEBHOOK_URL" \
33 $AUTH_FLAGS \
34 -H 'Content-Type: application/json' \
35 -d '{
36 "event": "test.webhook",
37 "timestamp": "'"$(date -u +%Y-%m-%dT%H:%M:%SZ)"'",
38 "data": {
39 "id": 1,
40 "name": "Test Item",
41 "value": 42.5
42 }
43 }'
44
45# Test 2: GET with query params
46echo "\n[Test 2] GET request with query parameters"
47curl -s -w "\nHTTP Status: %{http_code}\n" \
48 $AUTH_FLAGS \
49 "$WEBHOOK_URL?action=ping&format=json"
50
51# Test 3: Empty body (edge case)
52echo "\n[Test 3] POST with empty body"
53curl -s -w "\nHTTP Status: %{http_code}\n" \
54 -X POST "$WEBHOOK_URL" \
55 $AUTH_FLAGS \
56 -H 'Content-Type: application/json' \
57 -d '{}'
58
59echo "\n--- All tests complete ---"

Common mistakes when testing a Webhook in n8n

Why it's a problem: Sending requests to the production URL while the workflow is inactive

How to avoid: Production URLs only work when the workflow is toggled to Active. Use the test URL (/webhook-test/) during development.

Why it's a problem: Forgetting to set Content-Type: application/json, causing n8n to receive the body as a raw string

How to avoid: Always include -H 'Content-Type: application/json' in your curl command when sending JSON data.

Why it's a problem: Navigating away from the editor while waiting for a test event, which stops the listener

How to avoid: Keep the editor tab open and focused. Click Listen for Test Event again if the listener timed out.

Why it's a problem: Using the test URL in production integrations

How to avoid: The test URL is temporary and only active during manual testing. Always configure external services to use the production URL (/webhook/).

Best practices

  • Always test with the /webhook-test/ URL first before activating the workflow for production
  • Pin test data in the Webhook node output to avoid re-sending requests when testing downstream nodes
  • Set the response mode to When Last Node Finishes if the caller needs the workflow result, or Immediately for fire-and-forget scenarios
  • Always enable authentication on production webhooks to prevent unauthorized access
  • Set the WEBHOOK_URL environment variable to your public domain when running n8n behind a reverse proxy or load balancer
  • Test edge cases like empty bodies, missing fields, and wrong content types to ensure your workflow handles them gracefully
  • Use the Respond to Webhook node for custom response bodies and status codes instead of relying on the default response
  • Log webhook payloads to a database or file during initial deployment to debug integration issues

Still stuck?

Copy one of these prompts to get a personalized, step-by-step explanation.

ChatGPT Prompt

I have an n8n Webhook trigger node and I need to test it with different types of HTTP requests (JSON, form data, query parameters). Write me curl commands for each case and explain how to inspect the data in the n8n editor.

n8n Prompt

Create a workflow with a Webhook trigger that accepts a JSON POST request, validates that the body contains an 'event' field using an IF node, and returns a custom JSON response using a Respond to Webhook node with appropriate status codes for valid and invalid requests.

Frequently asked questions

What is the difference between the test URL and the production URL in n8n?

The test URL (/webhook-test/) is only active when you click Listen for Test Event in the editor and shows incoming data in the UI. The production URL (/webhook/) is only active when the workflow is toggled to Active and runs the full workflow in the background.

How long does the test webhook listener stay active?

The test listener stays active for approximately 120 seconds or until it receives one request, whichever comes first. After that, you need to click Listen for Test Event again.

Can I test webhooks on n8n Cloud?

Yes, n8n Cloud provides publicly accessible webhook URLs out of the box. Copy the test URL from the Webhook node and send requests to it from anywhere.

Why does my webhook return a 404 error?

A 404 means the URL is not active. For test URLs, ensure you clicked Listen for Test Event. For production URLs, ensure the workflow is toggled to Active. Also verify the webhook path matches exactly, including case sensitivity.

Can I receive file uploads through a webhook in n8n?

Yes, set the Webhook node's Binary Data option to true. The uploaded file will be available as binary data in downstream nodes. Use multipart/form-data as the content type when sending the request.

How do I return a custom response from a webhook workflow?

Set the Webhook node's Response Mode to When Last Node Finishes and add a Respond to Webhook node at the end of your workflow. Configure the response body, status code, and headers in that node.

Can I test webhooks locally without a public URL?

Yes, if n8n runs locally on port 5678, send requests to http://localhost:5678/webhook-test/your-path. For testing with external services, use a tunneling tool like ngrok to expose your local n8n instance.

Can RapidDev help me set up webhook integrations in n8n?

Yes, RapidDev's engineering team can design and implement webhook-driven n8n workflows with proper authentication, error handling, and response formatting for your specific integration needs.

RapidDev

Talk to an Expert

Our team has built 600+ apps. Get personalized help with your project.

Book a free consultation

Need help with your project?

Our experts have built 600+ apps and can accelerate your development. Book a free consultation — no strings attached.

Book a free consultation

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We'll discuss your project and provide a custom quote at no cost.