ScavioScavio
ProductPricingDocs
Sign InGet Started
  1. Home
  2. Tutorials
  3. How to Build a Google Maps Lead List with an API
Tutorial

How to Build a Google Maps Lead List with an API

Extract local business leads from Google Maps search results using the Scavio search API. Get business name, address, phone, and rating as structured JSON.

Get Free API KeyAPI Docs

You can extract local business data from Google's local pack by searching service + location via the Scavio API and parsing the local_results field, which returns structured business listings without scraping.

Prerequisites

  • Python 3.9+
  • Scavio API key

Walkthrough

Step 1: Search for local businesses

Include location in the query. The API returns a local_results array with structured business data.

Python
import requests

API_KEY = "your-scavio-api-key"

def search_local(service: str, location: str, num_results: int = 10) -> dict:
    query = f"{service} in {location}"
    r = requests.post(
        "https://api.scavio.dev/api/v1/search",
        json={"query": query, "num_results": num_results},
        headers={"x-api-key": API_KEY},
        timeout=20
    )
    r.raise_for_status()
    return r.json()

data = search_local("plumbers", "Austin TX")
local_results = data.get("local_results", [])
print(f"Found {len(local_results)} local businesses")
for biz in local_results:
    print(biz.get("title"), biz.get("phone"), biz.get("rating"))

Step 2: Parse structured lead fields

Extract all available business fields from the local pack results.

Python
def extract_leads(local_results: list) -> list:
    leads = []
    for biz in local_results:
        leads.append({
            "name":       biz.get("title"),
            "address":    biz.get("address"),
            "phone":      biz.get("phone"),
            "website":    biz.get("website"),
            "rating":     biz.get("rating"),
            "reviews":    biz.get("reviews"),
            "hours":      biz.get("hours"),
            "category":   biz.get("type"),
            "maps_url":   biz.get("link")
        })
    return leads

Step 3: Export to CSV

Write the lead list to a CSV file for use in a CRM or outreach tool.

Python
import csv

def export_leads_csv(leads: list, filename: str):
    if not leads:
        print("No leads to export")
        return
    fields = ["name", "address", "phone", "website", "rating", "reviews", "category"]
    with open(filename, "w", newline="", encoding="utf-8") as f:
        writer = csv.DictWriter(f, fieldnames=fields, extrasaction="ignore")
        writer.writeheader()
        writer.writerows(leads)
    print(f"Exported {len(leads)} leads to {filename}")

# Full run
data = search_local("plumbers", "Austin TX")
leads = extract_leads(data.get("local_results", []))
export_leads_csv(leads, "austin_plumbers.csv")

Step 4: Build a multi-city lead list

Loop over cities and services to generate a large lead database.

Python
SERVICES = ["plumbers", "electricians", "HVAC companies"]
CITIES = ["Austin TX", "Dallas TX", "Houston TX"]
all_leads = []

for service in SERVICES:
    for city in CITIES:
        data = search_local(service, city)
        leads = extract_leads(data.get("local_results", []))
        for lead in leads:
            lead["service"] = service
            lead["city"] = city
        all_leads.extend(leads)
        print(f"{service} in {city}: {len(leads)} leads")

print(f"\nTotal leads: {len(all_leads)}")
export_leads_csv(all_leads, "home_services_leads.csv")

Python Example

Python
import requests
import csv
from datetime import date

API_KEY = "your-scavio-api-key"

def search_local(service: str, location: str) -> list:
    r = requests.post(
        "https://api.scavio.dev/api/v1/search",
        json={"query": f"{service} in {location}", "num_results": 10},
        headers={"x-api-key": API_KEY},
        timeout=20
    )
    r.raise_for_status()
    return r.json().get("local_results", [])

def build_lead_list(services: list, cities: list) -> list:
    leads = []
    for service in services:
        for city in cities:
            results = search_local(service, city)
            for biz in results:
                leads.append({
                    "name": biz.get("title"),
                    "address": biz.get("address"),
                    "phone": biz.get("phone"),
                    "website": biz.get("website"),
                    "rating": biz.get("rating"),
                    "reviews": biz.get("reviews"),
                    "service": service,
                    "city": city
                })
            print(f"{service} / {city}: {len(results)} leads")
    return leads

def export_csv(leads: list, path: str):
    fields = ["name","address","phone","website","rating","reviews","service","city"]
    with open(path, "w", newline="", encoding="utf-8") as f:
        w = csv.DictWriter(f, fieldnames=fields, extrasaction="ignore")
        w.writeheader()
        w.writerows(leads)

if __name__ == "__main__":
    leads = build_lead_list(
        services=["plumbers", "electricians"],
        cities=["Austin TX", "Dallas TX"]
    )
    path = f"leads_{date.today()}.csv"
    export_csv(leads, path)
    print(f"\nExported {len(leads)} leads to {path}")

JavaScript Example

JavaScript
const API_KEY = 'your-scavio-api-key';

async function searchLocal(service, location) {
  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: `${service} in ${location}`, num_results: 10 })
  });
  const data = await res.json();
  return data.local_results ?? [];
}

const leads = await searchLocal('plumbers', 'Austin TX');
for (const biz of leads) {
  console.log(`${biz.title} | ${biz.phone} | Rating: ${biz.rating} (${biz.reviews})`);
}

Expected Output

JSON
plumbers / Austin TX: 8 leads
plumbers / Dallas TX: 10 leads
electricians / Austin TX: 9 leads
electricians / Dallas TX: 10 leads

Exported 37 leads to leads_2026-05-22.csv

Sample row:
Austin Plumbing Co | 512-555-0199 | 123 Main St Austin TX | Rating: 4.8 (342 reviews)

Related Tutorials

  • How to Enrich Leads with a Search API in n8n
  • How to Build a Cold Email Enrichment Pipeline
  • How to Verify Competitor Pricing Claims with SERP

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.9+. Scavio API key. 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

Best Of

Best Google Maps API for Lead Extraction in 2026

Read more
Best Of

Best Google Maps Business Data APIs (May 2026)

Read more
Use Case

Google Maps Local Lead Gen

Read more
Use Case

Google Maps Local Agency Lead Gen

Read more
Solution

Enrich Cold Email Campaigns with Google Maps Business Data

Read more
Solution

Extract Local Business Leads from Google Maps via n8n

Read more

Start Building

Extract local business leads from Google Maps search results using the Scavio search API. Get business name, address, phone, and rating as structured JSON.

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