ScavioScavio
ProductPricingDocs
Sign InGet Started
  1. Home
  2. Tutorials
  3. How to Enrich Leads with a Search API in n8n
Tutorial

How to Enrich Leads with a Search API in n8n

Build an n8n workflow that takes a company name, runs a search API call to extract website, description, and key info, and outputs an enriched lead record.

Get Free API KeyAPI Docs

You can enrich leads in n8n by adding an HTTP Request node that calls the Scavio search API with the company name, then parsing the results to extract the website, description, and employee count into your lead record.

Prerequisites

  • n8n installed (self-hosted or cloud)
  • Scavio API key
  • Input list of company names

Walkthrough

Step 1: Create the HTTP Request node for search

Add an HTTP Request node in n8n with POST method and the Scavio search endpoint.

JSON
// n8n HTTP Request Node Configuration
// Method: POST
// URL: https://api.scavio.dev/api/v1/search
// Authentication: Header Auth
//   Name: x-api-key
//   Value: {{ $env.SCAVIO_API_KEY }}
// Body (JSON):
{
  "query": "{{ $json.company_name }} company website about",
  "num_results": 5
}

Step 2: Parse the search results with a Code node

Add a Code node after the HTTP Request to extract structured fields from the SERP results.

JavaScript
// n8n Code Node (JavaScript)
const results = $input.item.json.organic_results || [];
const companyName = $('Input').item.json.company_name;

// Find the most relevant result (usually the first)
const main = results[0] || {};

// Try to find official website (avoid Wikipedia, LinkedIn)
const officialSite = results.find(r => 
  !r.link.includes('wikipedia') && 
  !r.link.includes('linkedin') && 
  !r.link.includes('crunchbase')
);

return {
  company_name: companyName,
  website: officialSite?.link || null,
  description: main.snippet || null,
  search_title: main.title || null,
  enriched_at: new Date().toISOString()
};

Step 3: Extract the company from the organic results

Get funding, employee count, or industry by parsing the knowledge panel if present.

JavaScript
// Extended Code node to include knowledge panel data
const data = $input.item.json;
const kp = data.knowledge_panel || {};
const results = data.organic_results || [];

const officialSite = results.find(r =>
  !r.link.includes('wikipedia') &&
  !r.link.includes('linkedin') &&
  !r.link.includes('crunchbase')
);

return {
  company_name: $('Input').item.json.company_name,
  website: officialSite?.link || kp.website || null,
  description: kp.description || results[0]?.snippet || null,
  industry: kp.industry || null,
  founded: kp.founded || null,
  headquarters: kp.headquarters || null,
  enriched_at: new Date().toISOString()
};

Step 4: Verify with the Python equivalent

Use this Python script to test your enrichment logic before wiring up n8n.

Python
import requests

API_KEY = "your-scavio-api-key"

def enrich_company(company_name: str) -> dict:
    r = requests.post(
        "https://api.scavio.dev/api/v1/search",
        json={"query": f"{company_name} company website about", "num_results": 5},
        headers={"x-api-key": API_KEY},
        timeout=15
    )
    r.raise_for_status()
    data = r.json()
    results = data.get("organic_results", [])
    kp = data.get("knowledge_panel", {})
    official = next(
        (res for res in results
         if not any(x in res["link"] for x in ["wikipedia", "linkedin", "crunchbase"])),
        results[0] if results else {}
    )
    return {
        "company": company_name,
        "website": official.get("link") or kp.get("website"),
        "description": kp.get("description") or official.get("snippet"),
        "industry": kp.get("industry"),
        "founded": kp.get("founded")
    }

print(enrich_company("Notion"))

Python Example

Python
import requests
from typing import Optional

API_KEY = "your-scavio-api-key"

EXCLUDE_DOMAINS = ["wikipedia.org", "linkedin.com", "crunchbase.com", "facebook.com", "twitter.com"]

def enrich_company(company_name: str) -> dict:
    r = requests.post(
        "https://api.scavio.dev/api/v1/search",
        json={"query": f"{company_name} company official website", "num_results": 10},
        headers={"x-api-key": API_KEY},
        timeout=15
    )
    r.raise_for_status()
    data = r.json()
    results = data.get("organic_results", [])
    kp = data.get("knowledge_panel", {})

    official = next(
        (res for res in results if not any(exc in res.get("link", "") for exc in EXCLUDE_DOMAINS)),
        results[0] if results else {}
    )

    return {
        "company": company_name,
        "website": official.get("link") or kp.get("website"),
        "description": kp.get("description") or official.get("snippet"),
        "industry": kp.get("industry"),
        "founded": kp.get("founded"),
        "headquarters": kp.get("headquarters"),
        "source": official.get("link")
    }

def enrich_batch(companies: list[str]) -> list[dict]:
    results = []
    for company in companies:
        try:
            record = enrich_company(company)
            results.append(record)
            print(f"Enriched: {company} -> {record.get('website')}")
        except Exception as e:
            print(f"Failed: {company} -> {e}")
            results.append({"company": company, "error": str(e)})
    return results

if __name__ == "__main__":
    companies = ["Notion", "Linear", "Retool", "Vercel", "PlanetScale"]
    enriched = enrich_batch(companies)
    import json
    print(json.dumps(enriched, indent=2))

JavaScript Example

JavaScript
const API_KEY = 'your-scavio-api-key';
const EXCLUDE = ['wikipedia.org', 'linkedin.com', 'crunchbase.com'];

async function enrichCompany(companyName) {
  const res = await fetch('https://api.scavio.dev/api/v1/search', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json', 'x-api-key': API_KEY },
    body: JSON.stringify({ query: `${companyName} company official website`, num_results: 10 })
  });
  const data = await res.json();
  const results = data.organic_results ?? [];
  const kp = data.knowledge_panel ?? {};
  const official = results.find(r => !EXCLUDE.some(e => r.link?.includes(e))) ?? results[0] ?? {};
  return {
    company: companyName,
    website: official.link ?? kp.website ?? null,
    description: kp.description ?? official.snippet ?? null,
    industry: kp.industry ?? null,
    founded: kp.founded ?? null
  };
}

const companies = ['Notion', 'Linear', 'Retool'];
for (const c of companies) {
  const record = await enrichCompany(c);
  console.log(JSON.stringify(record, null, 2));
}

Expected Output

JSON
{
  "company": "Notion",
  "website": "https://www.notion.so",
  "description": "Notion is a productivity and note-taking web application. It offers organizational tools including task management, project tracking, to-do lists, bookmarking, and more.",
  "industry": "Software",
  "founded": "2013",
  "headquarters": "San Francisco, CA"
}

Related Tutorials

  • How to Build a Cold Email Enrichment Pipeline
  • How to Build a Google Maps Lead List with an API
  • How to Build a Multi-Source Research Agent

Frequently Asked Questions

Most developers complete this tutorial in 15 to 30 minutes. You will need a Scavio API key (free tier works) and a working Python or JavaScript environment.

n8n installed (self-hosted or cloud). Scavio API key. Input list of company names. A Scavio API key gives you 50 free credits on signup.

Yes. The free tier includes 50 credits on signup, which is more than enough to complete this tutorial and prototype a working solution.

Scavio has a native LangChain package (langchain-scavio), an MCP server, and a plain REST API that works with any HTTP client. This tutorial uses the raw REST API, but you can adapt to your framework of choice.

Related Resources

Use Case

n8n Search Enrichment Workflow

Read more
Best Of

Best Search APIs for n8n Lead Scoring Workflows (2026)

Read more
Best Of

Best Search APIs for n8n Automation Workflows in 2026

Read more
Glossary

Lead Enrichment via Search API

Read more
Solution

Enrich Sales Leads with Search Data Instead of Apollo

Read more
Workflow

Lead Scoring via Search Enrichment Workflow

Read more

Start Building

Build an n8n workflow that takes a company name, runs a search API call to extract website, description, and key info, and outputs an enriched lead record.

Get Free API KeyRead the Docs
ScavioScavio

Real-time search API for AI agents. Search every platform, not just Google.

Product

  • Features
  • Pricing
  • Dashboard
  • Affiliates

Developers

  • Documentation
  • API Reference
  • Quickstart
  • MCP Integration
  • Python SDK

Alternatives

  • Tavily Alternative
  • SerpAPI Alternative
  • Firecrawl Alternative
  • Exa Alternative

Tools

  • JSON Formatter
  • cURL to Code
  • Token Counter
  • All Tools

© 2026 Scavio. All rights reserved.

Featured on TAAFT
Terms of ServicePrivacy Policy