Lead validation API
A small Node.js API that n8n calls to validate and route leads.
Problem
Validation rules buried inside workflow nodes are hard to test and reuse.
Solution
A Node.js API with API-key authentication validates the lead's JSON, normalises names and email, decides the route, and returns a clean response with a request ID. n8n calls it over HTTPS.
How it works
- n8nSends the lead
- AuthChecks the API key
- ValidateNormalises and routes
- ResponseReturns clean JSON
Ready to run
- 1
n8n. n8n sends the lead to the API over HTTPS.
- 2
Auth. The API checks the API key and rejects any request without it.
- 3
Validate. It validates the JSON, normalises names and email, and decides the route.
- 4
Response. It returns a clean JSON answer with a request ID, which n8n uses to continue.
Outcome
Tested from n8n Cloud: valid new and qualified leads, an invalid lead, and a wrong key all behaved as expected.
Stack
- Node.js
- n8n
- HTTPS