Tutorial

How to Enrich Leads with Google Search Data for Cold Email

Enrich a lead list with company data from Google search using the Scavio API. Extract company descriptions, tech stacks, and recent news for personalized outreach.

Cold email works best when each message is personalized with specific details about the recipient's company. Manually researching every lead does not scale. This tutorial builds an automated lead enrichment pipeline that takes a CSV of company names, searches Google for each one via the Scavio API, extracts the knowledge graph description, recent news, and key details from organic snippets, then writes an enriched CSV ready for mail merge or CRM import.

Prerequisites

  • Python 3.8 or higher
  • requests library installed
  • A Scavio API key
  • A CSV file with company names to enrich

Walkthrough

Step 1: Load the lead list

Read company names from a CSV file. The script expects a column called company_name.

Python
import csv

def load_leads(path: str) -> list[dict]:
    with open(path) as f:
        return list(csv.DictReader(f))

leads = load_leads("leads.csv")
print(f"Loaded {len(leads)} leads")

Step 2: Search Google for each company

Query Google for the company name and extract the knowledge graph, organic snippets, and any news results.

Python
import requests

def search_company(name: str) -> dict:
    r = requests.post(
        "https://api.scavio.dev/api/v1/search",
        headers={"x-api-key": API_KEY},
        json={"query": name, "country_code": "us"}
    )
    r.raise_for_status()
    data = r.json()
    return {
        "description": data.get("knowledge_graph", {}).get("description", ""),
        "website": data.get("knowledge_graph", {}).get("website", ""),
        "snippet": data.get("organic_results", [{}])[0].get("snippet", ""),
    }

Step 3: Enrich each lead

Loop through leads, search for each company, and merge the enrichment data back into the lead dict.

Python
import time

def enrich_leads(leads: list[dict]) -> list[dict]:
    for lead in leads:
        enrichment = search_company(lead["company_name"])
        lead.update(enrichment)
        time.sleep(0.5)
    return leads

Step 4: Export the enriched data

Write the enriched leads to a new CSV with additional columns for description, website, and snippet.

Python
def export_enriched(leads: list[dict], path: str = "leads_enriched.csv") -> None:
    if not leads:
        return
    with open(path, "w", newline="") as f:
        writer = csv.DictWriter(f, fieldnames=leads[0].keys())
        writer.writeheader()
        writer.writerows(leads)
    print(f"Exported {len(leads)} enriched leads to {path}")

Python Example

Python
import os
import csv
import time
import requests

API_KEY = os.environ.get("SCAVIO_API_KEY", "your_scavio_api_key")
ENDPOINT = "https://api.scavio.dev/api/v1/search"

def search_company(name: str) -> dict:
    r = requests.post(ENDPOINT, headers={"x-api-key": API_KEY},
                      json={"query": name, "country_code": "us"})
    r.raise_for_status()
    data = r.json()
    kg = data.get("knowledge_graph", {})
    return {
        "description": kg.get("description", ""),
        "website": kg.get("website", ""),
        "snippet": data.get("organic_results", [{}])[0].get("snippet", ""),
    }

def enrich(input_csv: str, output_csv: str) -> None:
    with open(input_csv) as f:
        leads = list(csv.DictReader(f))
    for lead in leads:
        lead.update(search_company(lead["company_name"]))
        time.sleep(0.5)
    with open(output_csv, "w", newline="") as f:
        w = csv.DictWriter(f, fieldnames=leads[0].keys())
        w.writeheader()
        w.writerows(leads)
    print(f"Enriched {len(leads)} leads")

if __name__ == "__main__":
    enrich("leads.csv", "leads_enriched.csv")

JavaScript Example

JavaScript
const API_KEY = process.env.SCAVIO_API_KEY || "your_scavio_api_key";
const ENDPOINT = "https://api.scavio.dev/api/v1/search";
const fs = require("fs");

async function searchCompany(name) {
  const res = await fetch(ENDPOINT, {
    method: "POST",
    headers: { "x-api-key": API_KEY, "Content-Type": "application/json" },
    body: JSON.stringify({ query: name, country_code: "us" })
  });
  const data = await res.json();
  const kg = data.knowledge_graph || {};
  return {
    description: kg.description || "",
    website: kg.website || "",
    snippet: (data.organic_results || [{}])[0]?.snippet || ""
  };
}

async function main() {
  const companies = ["Stripe", "Vercel", "Supabase"];
  for (const name of companies) {
    const info = await searchCompany(name);
    console.log(`${name}: ${info.description.slice(0, 80)}`);
    console.log(`  Website: ${info.website}`);
  }
}
main().catch(console.error);

Expected Output

JSON
Enriched 50 leads

leads_enriched.csv:
company_name,email,description,website,snippet
Stripe,contact@stripe.com,"Online payment processing for internet businesses",https://stripe.com,"Stripe is a technology company that builds economic infrastructure..."
Vercel,hi@vercel.com,"Cloud platform for frontend frameworks",https://vercel.com,"Vercel enables developers to build and deploy web applications..."

Related Tutorials

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.

Python 3.8 or higher. requests library installed. A Scavio API key. A CSV file with company names to enrich. A Scavio API key gives you 500 free credits per month.

Yes. The free tier includes 500 credits per month, 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.

Start Building

Enrich a lead list with company data from Google search using the Scavio API. Extract company descriptions, tech stacks, and recent news for personalized outreach.