Tutorial

How to Build a Lead Gen Pipeline with Search API

Automate lead generation from Google search results. Discover prospects, enrich with SERP data, and score leads at $0.015/prospect.

Build an automated lead generation pipeline that discovers prospects from Google search, enriches them with multi-platform context from Reddit and YouTube, and scores leads based on relevance signals. Cost: $0.015/prospect for 3 API queries.

Prerequisites

  • Scavio API key
  • Python 3.8+
  • Target ICP keywords (industry + stage + signals)

Walkthrough

Step 1: Search for prospect companies

Query Google for companies matching your ICP.

Python
import requests, os

H = {'x-api-key': os.environ['SCAVIO_API_KEY'], 'Content-Type': 'application/json'}

def find_prospects(queries):
    prospects = []
    for q in queries:
        data = requests.post('https://api.scavio.dev/api/v1/search',
            headers=H, json={'query': q, 'country_code': 'us'}).json()
        for r in data.get('organic_results', []):
            domain = r.get('link', '').split('/')[2] if r.get('link') else None
            if domain and not any(x in domain for x in ['linkedin.com', 'crunchbase.com']):
                prospects.append({'domain': domain, 'title': r.get('title'),
                    'snippet': r.get('snippet', ''), 'source_query': q})
    return prospects

prospects = find_prospects(['SaaS companies hiring 2026', 'series A startups developer tools'])
print(f'{len(prospects)} prospects found')

Step 2: Score and filter leads

Score prospects based on SERP snippet signals.

Python
def score(prospect):
    s = (prospect.get('snippet') or '').lower()
    score = 0
    if 'series a' in s or 'funding' in s: score += 3
    if 'hiring' in s or 'growing' in s: score += 2
    if 'saas' in s or 'developer' in s: score += 2
    if 'acquired' in s or 'shutdown' in s: score -= 5
    return score

scored = sorted([{**p, 'score': score(p)} for p in prospects],
    key=lambda x: x['score'], reverse=True)
qualified = [p for p in scored if p['score'] >= 3]
print(f'{len(qualified)} qualified leads')

Python Example

Python
import requests, os

H = {'x-api-key': os.environ['SCAVIO_API_KEY'], 'Content-Type': 'application/json'}

def lead_pipeline(queries, min_score=3):
    prospects = []
    for q in queries:
        data = requests.post('https://api.scavio.dev/api/v1/search',
            headers=H, json={'query': q, 'country_code': 'us'}).json()
        for r in data.get('organic_results', []):
            domain = r.get('link', '').split('/')[2] if r.get('link') else None
            if domain and not any(x in domain for x in
                ['linkedin.com', 'crunchbase.com', 'twitter.com', 'github.com']):
                snippet = (r.get('snippet') or '').lower()
                score = sum([3 * ('funding' in snippet),
                    2 * ('hiring' in snippet), 2 * ('saas' in snippet),
                    -5 * ('shutdown' in snippet)])
                if score >= min_score:
                    prospects.append({'domain': domain, 'title': r.get('title'),
                        'snippet': r.get('snippet', ''), 'score': score})
    return sorted(prospects, key=lambda x: x['score'], reverse=True)

leads = lead_pipeline(['SaaS hiring engineers 2026', 'YC W26 startups'])
for l in leads[:5]:
    print(f"{l['domain']}: score={l['score']}")

JavaScript Example

JavaScript
const H = {'x-api-key': process.env.SCAVIO_API_KEY, 'Content-Type': 'application/json'};
async function leadPipeline(queries, minScore = 3) {
  const prospects = [];
  for (const q of queries) {
    const r = await fetch('https://api.scavio.dev/api/v1/search', {
      method: 'POST', headers: H,
      body: JSON.stringify({query: q, country_code: 'us'})
    }).then(r => r.json());
    (r.organic_results || []).forEach(r => {
      const domain = r.link?.split('/')[2];
      if (!domain || ['linkedin.com', 'crunchbase.com'].some(x => domain.includes(x))) return;
      const s = (r.snippet || '').toLowerCase();
      const score = (s.includes('funding') ? 3 : 0) + (s.includes('hiring') ? 2 : 0) + (s.includes('saas') ? 2 : 0);
      if (score >= minScore) prospects.push({domain, title: r.title, score});
    });
  }
  return prospects.sort((a, b) => b.score - a.score);
}
leadPipeline(['SaaS hiring 2026']).then(l => console.log(`${l.length} leads`));

Expected Output

JSON
Scored and filtered lead list with prospect domains, relevance scores, and source queries. Ready for enrichment and outreach.

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.

Scavio API key. Python 3.8+. Target ICP keywords (industry + stage + signals). A Scavio API key gives you 250 free credits per month.

Yes. The free tier includes 250 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

Automate lead generation from Google search results. Discover prospects, enrich with SERP data, and score leads at $0.015/prospect.