Tutorial

How to Automate Lead Enrichment with Search API

Learn how to enrich lead records with live search data from Google, Reddit, and YouTube instead of expensive enrichment databases.

Traditional lead enrichment tools like ZoomInfo and Apollo charge $0.10-0.50 per record from proprietary databases that update periodically. Search API enrichment takes a different approach: query live search results for each lead to get current company info, social presence, and online sentiment. This tutorial builds a Python enrichment pipeline that takes a list of company names and outputs enriched records with website, LinkedIn URL, review data, and recent news.

Prerequisites

  • Python 3.8+ installed
  • requests library installed
  • A Scavio API key from scavio.dev
  • A CSV of company names to enrich

Walkthrough

Step 1: Load your lead list

Read company names from a CSV file.

Python
import csv

def load_leads(filepath: str) -> list:
    with open(filepath) as f:
        reader = csv.DictReader(f)
        return [row['company_name'] for row in reader]

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

Step 2: Enrich each lead with search data

Run multiple searches per lead to build a complete profile.

Python
import requests, os
H = {'x-api-key': os.environ['SCAVIO_API_KEY']}

def enrich_lead(company: str) -> dict:
    # Search for company website and info
    info = requests.post('https://api.scavio.dev/api/v1/search', headers=H,
        json={'platform': 'google', 'query': company}, timeout=10).json()
    # Search for LinkedIn
    linkedin = requests.post('https://api.scavio.dev/api/v1/search', headers=H,
        json={'platform': 'google', 'query': f'{company} site:linkedin.com'}, timeout=10).json()
    # Search for reviews
    reviews = requests.post('https://api.scavio.dev/api/v1/search', headers=H,
        json={'platform': 'google', 'query': f'{company} reviews'}, timeout=10).json()
    return {
        'company': company,
        'website': info.get('organic', [{}])[0].get('link', ''),
        'description': info.get('organic', [{}])[0].get('snippet', ''),
        'linkedin': next((r['link'] for r in linkedin.get('organic', []) if 'linkedin.com' in r.get('link', '')), ''),
        'review_count': len(reviews.get('organic', [])),
    }

Step 3: Process all leads with rate limiting

Enrich all leads with a small delay between requests to be respectful of rate limits.

Python
import time

def enrich_all(leads: list, delay: float = 0.5) -> list:
    enriched = []
    for i, company in enumerate(leads):
        try:
            data = enrich_lead(company)
            enriched.append(data)
            print(f'[{i+1}/{len(leads)}] Enriched: {company}')
        except Exception as e:
            enriched.append({'company': company, 'error': str(e)})
            print(f'[{i+1}/{len(leads)}] Failed: {company}: {e}')
        time.sleep(delay)
    return enriched

Step 4: Export enriched data

Save the enriched leads to a CSV for import into your CRM or outreach tool.

Python
def export_enriched(data: list, filepath: str):
    if not data: return
    keys = data[0].keys()
    with open(filepath, 'w', newline='') as f:
        writer = csv.DictWriter(f, fieldnames=keys)
        writer.writeheader()
        writer.writerows(data)
    print(f'Exported {len(data)} enriched leads to {filepath}')

enriched = enrich_all(leads)
export_enriched(enriched, 'enriched_leads.csv')

Python Example

Python
import requests, os, csv
H = {'x-api-key': os.environ['SCAVIO_API_KEY']}

def enrich(company):
    data = requests.post('https://api.scavio.dev/api/v1/search', headers=H,
        json={'platform': 'google', 'query': company}, timeout=10).json()
    top = data.get('organic', [{}])[0]
    return {'company': company, 'url': top.get('link', ''), 'snippet': top.get('snippet', '')}

# Usage: enriched = [enrich(c) for c in companies]

JavaScript Example

JavaScript
async function enrich(company) {
  const data = await fetch('https://api.scavio.dev/api/v1/search', {
    method: 'POST', headers: {'x-api-key': process.env.SCAVIO_API_KEY, 'Content-Type': 'application/json'},
    body: JSON.stringify({platform: 'google', query: company})
  }).then(r => r.json());
  const top = data.organic?.[0] || {};
  return {company, url: top.link, snippet: top.snippet};
}

Expected Output

JSON
A CSV of enriched leads with company website, LinkedIn URL, description, and review presence data.

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+ installed. requests library installed. A Scavio API key from scavio.dev. A CSV of 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

Learn how to enrich lead records with live search data from Google, Reddit, and YouTube instead of expensive enrichment databases.