Integration guide
LeadMerlin + n8n
There is no dedicated LeadMerlin node yet. Use n8n’s built-in HTTP Request node with header authentication — the workflow is four nodes plus a loop.
Before you start
- An n8n instance (cloud or self-hosted).
- A LeadMerlin API key.
Setup
- 1
Create a Header Auth credential
In Credentials, add "Header Auth" with name x-api-key and your key as the value. Reuse it on every HTTP Request node.
- 2
HTTP Request — start the search
Method POST, URL below, body type JSON. Map keyword and location code from your trigger (form, sheet row, schedule).
POST https://api.leadmerlin.com/api/v2/searches { "keyword": "{{ $json.keyword }}", "location_codes": [{{ $json.location_code }}] } - 3
Wait, then poll
Add a Wait node (for example 30 seconds), then an HTTP Request node that GETs the job. Add an IF node: if status is not "completed", loop back to the Wait node.
GET https://api.leadmerlin.com/api/v2/jobs/{{ $('Start search').item.json.job_id }} - 4
Fetch results with pagination
GET the results URL with limit=200. In the node’s Pagination options, update the cursor query parameter from the previous response and stop when has_more is false.
GET https://api.leadmerlin.com/api/v2/jobs/<job_id>/results?limit=200 cursor = {{ $response.body.next_cursor }} stop when: {{ $response.body.has_more === false }} - 5
Split and route
Split Out the businesses array, filter (for example email present and phone_type = mobile), then send to Google Sheets, HubSpot or your sequencer.
Location codes in these examples are placeholders — always look yours up with GET /v2/locations first.
Tips
- Add a loop counter so a failed job cannot poll forever — stop on status "failed" too.
- Use POST /v2/enrichments instead of searches when your trigger already has domains (up to 100 per request).
API at a glance
| Call | What it does |
|---|---|
| GET /v2/locations?q= | City name → location_code (free) |
| GET /v2/suggest?niche= | Vague niche → Google categories + sharper keywords (free) |
| POST /v2/searches | Start a search job: keyword, 1–5 location_codes, optional strictness |
| POST /v2/enrichments | Enrich up to 100 domains you already have |
| GET /v2/jobs/:id | Poll until status is completed |
| GET /v2/jobs/:id/results | Paginated enriched businesses (cursor, limit ≤ 200) |
| /v2/demo/* | Same shapes on fixture data — no key, no credits |
All calls use the x-api-key header except the demo endpoints. Base URL: https://api.leadmerlin.com/api
Related
Get your API key.
Sign up free to get an lm_ key and 100 enriched leads. No credit card.