# Feature: Auto-Generate Test cURL for n8n Webhook Nodes
## Problem
When testing n8n webhook-based workflows, it’s often unclear which **headers, authentication method, query parameters, and body fields** are actually required—especially when downstream nodes depend on specific inputs. Developers end up crafting cURL requests manually, which leads to misunderstandings, errors, and wasted time.
## Goal
Provide a **"Generate cURL"** button that produces a **fully runnable, complete cURL example** (including authentication + payload + query + headers) that matches what the webhook expects.
---
## User Flow
1. Build (or mostly build) the workflow.
2. In the **Webhook node** (or workflow header), click **Generate cURL**.
3. Select generation mode:
- **A) From schema/definition** (stable and reproducible)
- **B) From last execution** (real sample payload)
4. Select output target:
- **Linux/macOS (bash)**
- **Windows PowerShell** (correct quoting/escaping)
5. Copy cURL (or download as `.sh` / `.ps1`) and test externally.
---
## Functional Requirements
| Area | Must support |
|---|---|
| Endpoint | Correct URL + HTTP method (prod/test URL, path params) |
| Authentication | Inherit webhook auth config (Basic, Bearer, API-key header, custom header/query token). **Secrets redacted by default** |
| Headers | `Content-Type`, `Accept`, custom headers, optional signature/idempotency headers if configured |
| Query Params | Include required/optional params with example values |
| Body | JSON (nested), optionally `x-www-form-urlencoded` and `multipart/form-data` where relevant |
| Examples | Use placeholders by default; optionally “Use last execution values” |
| Validation | Optional: display/export JSON Schema + field descriptions |
| Output | “Copy cURL”; optional “Copy as fetch / Python requests” (nice-to-have) |
---
## Input Definition: “What payload does the webhook expect?”
To avoid guessing:
### Option 1 (Recommended): Manual Schema in Webhook Node
Add an **Expected Input Schema** section (JSON Schema or UI form) with:
- `name`
- `type`
- `required`
- `example`
- `description`
### Option 2: Auto-Infer
- Infer from **last execution** payload
- Optional static workflow analysis (detect `$json.*` references downstream) and mark fields as “inferred”
> Practical approach: Auto-infer is fast; manual schema is unambiguous and versionable.
---
## Security Defaults
- Never show secrets in clear text by default
→ use `******` or `${TOKEN}` placeholders
- “Include secrets” toggle only after explicit confirmation
- Indicate which values were redacted
---
## Example Output (bash)
```bash
curl -X POST "https://<your-n8n-host>/webhook/<path>?source=test" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${N8N_WEBHOOK_TOKEN}" \
-d '{
"event": "lead.created",
"lead": {
"id": "12345",
"email": "[email protected]"
},
"meta": {
"timestamp": "2025-12-31T12:00:00Z",
"requestId": "req_abc123"
}
}'
Example Output (Windows PowerShell)
curl.exe -X POST "https://<your-n8n-host>/webhook/<path>?source=test" `
-H "Content-Type: application/json" `
-H "Accept: application/json" `
-H ("Authorization: Bearer {0}" -f $env:N8N_WEBHOOK_TOKEN) `
--data-raw "{`"event`":`"lead.created`",`"lead`":{`"id`":`"12345`",`"email`":`"[email protected]`"},`"meta`":{`"timestamp`":`"2025-12-31T12:00:00Z`",`"requestId`":`"req_abc123`"}}"
Acceptance Criteria
- The generated cURL is runnable without manual edits (except setting secrets/tokens)
- Executing the cURL triggers the webhook and the workflow runs successfully with valid sample data
- Includes all configured auth mechanisms (with redaction by default)
- Supports at minimum: JSON body + query params + custom headers + bash/PowerShell outputs
Nice-to-Have Enhancements
- “Copy as JavaScript fetch”
- “Copy as Python requests”
- Export schema as
schema.json
- Environment switcher (dev/staging/prod base URL)
- Auto-generate
.env template for required secrets
The idea is:
My use case:
I think it would be beneficial to add this because:
Any resources to support this?
Are you willing to work on this?
Good idea, this is clearly missing in n8n.
Though I think it’s worth looking at this both ways. Generating a cURL for testing is useful, but being able to import a cURL to configure the webhook would be just as valuable.
Typical case: a client or an API doc gives you a sample cURL. Today you have to manually parse the headers, body, auth, and reconfigure your webhook by hand. If you could just paste the cURL and have the node pre-configure itself, that would save a ton of time.
And then the expected input schema (that you suggest defining manually) could be auto-generated from the imported cURL. Less config, fewer mistakes.