Generic cold outreach gets ignored. Personalized outreach that references a prospect's recent news, technology decisions, or hiring activity gets replies. This tutorial builds a lead enrichment pipeline that takes a CSV of company names, searches for relevant context using the Scavio API, and outputs an enriched CSV with personalization hooks. Each lead costs about $0.010 (2 searches) to enrich, making it practical to personalize thousands of leads.
Prerequisites
- Python 3.9+ installed
- requests and csv libraries
- A Scavio API key from scavio.dev
- A CSV file with lead company names
Walkthrough
Step 1: Load the lead list
Read your leads from a CSV file. At minimum, you need the company name. Additional fields like industry or location improve search quality.
import os, requests, csv, time, json
SCAVIO_KEY = os.environ['SCAVIO_API_KEY']
H = {'x-api-key': SCAVIO_KEY, 'Content-Type': 'application/json'}
URL = 'https://api.scavio.dev/api/v1/search'
# Sample leads (in practice, load from CSV)
leads = [
{'company': 'Vercel', 'industry': 'developer tools'},
{'company': 'Linear', 'industry': 'project management'},
{'company': 'Resend', 'industry': 'email infrastructure'},
]
print(f'Loaded {len(leads)} leads to enrich')Step 2: Search for personalization hooks per lead
For each lead, search for recent news and technology context. Extract the most useful personalization hooks from the results.
def enrich_lead(lead: dict) -> dict:
company = lead['company']
# Recent news search
resp = requests.post(URL, headers=H,
json={'query': f'{company} news announcement 2026', 'country_code': 'us', 'num_results': 3})
news = resp.json().get('organic_results', [])
time.sleep(0.3)
# Tech/product search
resp2 = requests.post(URL, headers=H,
json={'query': f'{company} product launch update', 'country_code': 'us', 'num_results': 3})
product = resp2.json().get('organic_results', [])
# Extract hooks
hooks = []
for r in (news + product)[:4]:
snippet = r.get('snippet', '')
if snippet and len(snippet) > 30:
hooks.append(snippet[:120])
lead['news_headline'] = news[0]['title'] if news else ''
lead['personalization_hook'] = hooks[0] if hooks else ''
lead['recent_context'] = ' | '.join(hooks[:2])
lead['enriched'] = True
return lead
enriched = enrich_lead(leads[0])
print(f'{enriched["company"]}:')
print(f' Headline: {enriched["news_headline"][:60]}')
print(f' Hook: {enriched["personalization_hook"][:80]}')Step 3: Batch enrich and export to CSV
Process all leads with rate limiting and export the enriched data to a new CSV file ready for your email tool.
def batch_enrich(leads: list, output_file: str = 'enriched_leads.csv') -> list:
enriched = []
for i, lead in enumerate(leads):
try:
result = enrich_lead(lead)
enriched.append(result)
print(f'[{i+1}/{len(leads)}] {lead["company"]}: enriched')
except Exception as e:
lead['enriched'] = False
lead['personalization_hook'] = ''
enriched.append(lead)
print(f'[{i+1}/{len(leads)}] {lead["company"]}: failed ({e})')
time.sleep(0.3)
# Export to CSV
if enriched:
keys = enriched[0].keys()
with open(output_file, 'w', newline='') as f:
writer = csv.DictWriter(f, fieldnames=keys)
writer.writeheader()
writer.writerows(enriched)
success = sum(1 for l in enriched if l.get('enriched'))
cost = len(leads) * 0.010
print(f'\nEnriched {success}/{len(leads)} leads')
print(f'Cost: ${cost:.3f}')
print(f'Saved to {output_file}')
return enriched
batch_enrich(leads)Python Example
import os, requests, time
SCAVIO_KEY = os.environ['SCAVIO_API_KEY']
H = {'x-api-key': SCAVIO_KEY, 'Content-Type': 'application/json'}
def enrich_lead(company):
resp = requests.post('https://api.scavio.dev/api/v1/search', headers=H,
json={'query': f'{company} news 2026', 'country_code': 'us', 'num_results': 3})
results = resp.json().get('organic_results', [])
headline = results[0]['title'] if results else 'N/A'
hook = results[0].get('snippet', '')[:100] if results else ''
print(f'{company}: {headline[:50]}')
print(f' Hook: {hook[:70]}')
for co in ['Vercel', 'Linear', 'Resend']:
enrich_lead(co)
time.sleep(0.3)
print(f'\nCost: $0.015 (3 leads x $0.005)')JavaScript Example
const SCAVIO_KEY = process.env.SCAVIO_API_KEY;
async function enrichLead(company) {
const resp = await fetch('https://api.scavio.dev/api/v1/search', {
method: 'POST',
headers: { 'x-api-key': SCAVIO_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({ query: `${company} news 2026`, country_code: 'us', num_results: 3 })
});
const results = (await resp.json()).organic_results || [];
const headline = results[0]?.title || 'N/A';
console.log(`${company}: ${headline.slice(0, 50)}`);
}
(async () => {
for (const co of ['Vercel', 'Linear', 'Resend']) await enrichLead(co);
console.log('Cost: $0.015');
})();Expected Output
[1/3] Vercel: enriched
[2/3] Linear: enriched
[3/3] Resend: enriched
Vercel:
Headline: Vercel Launches v0 2.0 with Full-Stack AI Code Gen
Hook: Vercel announced v0 2.0, its AI-powered code generation tool
Linear:
Headline: Linear Raises $50M Series C for Project Management
Hook: Linear closed a $50M Series C led by Accel to expand its p
Enriched 3/3 leads
Cost: $0.030
Saved to enriched_leads.csv