Skip to main content
AltFTool original, tested in n8nEngineering

Webhook JSON validation API endpoint - n8n workflow template

This workflow turns n8n into a small, well-behaved JSON API. A Webhook node listens for POST requests on the path contact-intake and hands the response over to Respond to Webhook nodes, so you decide exactly what the caller receives. A Code node checks the request body: name…

Written and tested by AltFTool

Starts on
Webhook
Nodes
5 nodes
Level
Beginner
Setup
About 3 min

Workflow preview

How this workflow runs

  1. 1

    Incoming POST

    Starts the workflow when an external service sends an HTTP request to a webhook URL.

  2. 2

    Validate payload

    Runs custom JavaScript to transform or manipulate the data flowing through the workflow.

  3. 3

    Is valid?

    Branches the workflow based on a true/false condition.

  4. 4

    Respond 200 OK

    Sends the workflow's response back to the caller of the webhook.

  5. 5

    Respond 422 with errors

    Sends the workflow's response back to the caller of the webhook.

Overview and setup

How it works

This workflow turns n8n into a small, well-behaved JSON API. A Webhook node listens for POST requests on the path contact-intake and hands the response over to Respond to Webhook nodes, so you decide exactly what the caller receives.

A Code node checks the request body: name must be 2 to 100 characters, email must look like a real address, and the optional message must be under 2,000 characters. Values are trimmed and the email is lower-cased. Every problem is collected into an errors list instead of stopping at the first one.

An IF node then sends valid requests to Respond 200 OK, which returns the cleaned data, and invalid ones to Respond 422 with errors, which returns a list of field-level messages your front end can show next to each input.

Set up steps

  1. Import the workflow and open Incoming POST to copy the test URL.
  2. Click Execute workflow, then send a request, for example with curl and a JSON body containing name and email.
  3. Try an invalid body to see the 422 response.
  4. Activate the workflow and switch your client to the production URL.

Customise it

  • Edit the rules in Validate payload to match your own schema.
  • Add nodes between Is valid? and the 200 response to save the data to a CRM, sheet or database.
  • Protect the endpoint with header authentication in the Webhook node options.
  • Change the path to fit your API naming.

n8n nodes used (4 types)

What every node does (5)
  • Incoming POST (Webhook)Starts the workflow when an external service sends an HTTP request to a webhook URL.
  • Validate payload (Code)Runs custom JavaScript to transform or manipulate the data flowing through the workflow.
  • Is valid? (If)Branches the workflow based on a true/false condition.
  • Respond 200 OK (Respond To Webhook)Sends the workflow's response back to the caller of the webhook.
  • Respond 422 with errors (Respond To Webhook)Sends the workflow's response back to the caller of the webhook.

FAQ

Webhook JSON validation API endpoint: questions

How do I import the "Webhook JSON validation API endpoint" workflow into n8n?

Copy the workflow JSON from this page, open the n8n editor, click on an empty canvas and paste with Ctrl+V (Cmd+V on macOS). You can also download the .json file and choose Import from File in the workflow menu. Save the workflow, then attach credentials before activating it.

Which nodes and credentials does "Webhook JSON validation API endpoint" use?

It uses Webhook, Code, If and Respond To Webhook. Any node that connects to an external service needs your own credential — open each node after import and select or create one. Trigger, logic and transformation nodes usually need no credentials.

Can it run on n8n Cloud and on self-hosted n8n?

The workflow format is the same on both. If a node appears as unknown or outdated after import, update n8n to a recent version or, on self-hosted instances, install the required community node package. Features such as $env access are available on self-hosted instances only.

How can I customise "Webhook JSON validation API endpoint"?

Start by changing the trigger (schedule, webhook or app event) and the destination nodes to match your stack — it is listed under Engineering. Edit prompts, field mappings and filters in the relevant nodes, use expressions like {{ $json.field }} to map data, and test with a manual execution before activating.

n8n is a trademark of n8n GmbH. AltFTool is not affiliated with, endorsed by or sponsored by n8n. Community templates are credited to their creators and link to the original listing; AltFTool originals are written and tested by the AltFTool team.