> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spidra.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Get local business leads with emails

> Build a lead list of local businesses from Google Maps, with phone, website, rating, and emails and social profiles found on each business's website.

Google Maps has the phone, website and rating of every local business, but not their email. This guide uses the **Google Maps leads** [template](https://docs.spidra.io/templates.md) with its second step switched on: Spidra visits each business's website and contact page and adds the emails and social profiles it finds. The result is a CSV you can load into a CRM.

You need Python with `requests`, and your API key in `SPIDRA_API_KEY`.

## 1. Choose the search

The template takes a business type and one or more areas. `findContacts` turns on the website step:

```python theme={null}
inputs = {"query": "dentist", "areas": ["Lekki, Lagos"], "findContacts": True}
```

Each area is one Google Maps search with up to 20 places. Add more areas, or `"pages": 2` for 20 more per area.

## 2. Run it and write the CSV

```python theme={null}
# leads.py
import csv
import os
import time

import requests

API = "https://api.spidra.io/api"
HEADERS = {"Authorization": f"Bearer {os.environ['SPIDRA_API_KEY']}"}
inputs = {"query": "dentist", "areas": ["Lekki, Lagos"], "findContacts": True}

# 1. Check the cost
estimate = requests.post(f"{API}/templates/google-maps-leads/estimate", json={"inputs": inputs}).json()
print("Estimate:", estimate["credits"], "credits +", estimate["note"])

# 2. Start the run
run = requests.post(f"{API}/templates/google-maps-leads/runs", headers=HEADERS, json={"inputs": inputs}).json()["run"]

# 3. Wait for it, including the website step
while run["status"] == "running":
    time.sleep(5)
    run = requests.get(f"{API}/template-runs/{run['runId']}", headers=HEADERS, params={"rows": "false"}).json()["run"]
run = requests.get(f"{API}/template-runs/{run['runId']}", headers=HEADERS).json()["run"]
print(run["status"], run["rowCount"], "places,", run["creditsUsed"], "credits")

# 4. Write the leads
columns = ["title", "phone", "website", "emails", "instagram", "facebook", "linkedin", "rating", "address"]
with open("leads.csv", "w", newline="") as f:
    writer = csv.DictWriter(f, fieldnames=columns, extrasaction="ignore")
    writer.writeheader()
    for row in run["rows"]:
        socials = row.get("socials") or {}
        writer.writerow({
            **row,
            "emails": ", ".join(row.get("emails") or []),
            "instagram": socials.get("instagram"),
            "facebook": socials.get("facebook"),
            "linkedin": socials.get("linkedin"),
        })

with_email = sum(1 for r in run["rows"] if r.get("emails"))
print(f"{with_email} of {len(run['rows'])} places have an email")
```

```text theme={null}
Estimate: 1 credits + plus up to 40 extra credits to check websites (1 per page loaded; pages that fail are free)
completed 20 places, 36 credits
12 of 20 places have an email
```

Two rows of `leads.csv`:

```text theme={null}
title,phone,website,emails,instagram,facebook,linkedin,rating,address
Toothmine Dental Clinic - Lekki,(432) 287-2064,http://www.toothminedental.com/,hello@toothminedental.com,https://www.instagram.com/toothminedentalng,,,4.9,"1 Theophilus Oji Street, Lekki Phase 1, Lagos 105102, Lagos, Nigeria"
Zoom Exclusive Dental Care Lagos,+234 815 555 9878,https://zoomexclusive.com/,"support@zoomexclusive.com, lagos@zoomexclusive.com, abuja@zoomexclusive.com, ph@zoomexclusive.com",https://www.instagram.com/zoomexclusiveng,https://www.facebook.com/profile.php?id=100076053879554,https://www.linkedin.com/company/zoom-36-dental-care,4.8,"Local Government, 29B Admiralty Wy, opposite Debonairs Pizza, beside Zenith Bank, Lekki Phase 1, Eti Osa 105102, Lagos, Nigeria"
```

The run cost 36 credits: 1 for the search and 35 for the website pages it loaded (up to 2 per business).

## What you get

Each row has every Google Maps field (phone, website, rating, review count, address, hours, category, coordinates and more) plus:

* `emails`: every email found on the website and its contact page.
* `socials`: Instagram, Facebook, LinkedIn, X, TikTok and YouTube profiles linked from the site.
* `phones`: any other numbers on the site.

Only what's written on those pages is found. Businesses with no website, or a website that only links a contact form, have no email. Here 12 of 20 had one.

## Scale it up

* **More areas:** `"areas": ["Lekki, Lagos", "Ikeja, Lagos", "Victoria Island, Lagos"]` (up to 25). Places that show up in more than one area appear once.
* **A whole city:** the **Google Maps leads for a whole area** template covers an area with a grid of searches.
* **The same search every week:** save it as a [preset](https://docs.spidra.io/presets.md), or [watch it](https://docs.spidra.io/monitors.md) with `alertOn: "new"` to get only the new businesses.
* **In the dashboard:** open **Templates**, pick **Google Maps leads**, switch on **Find emails and social links**, and download the CSV.

## Good to know

* The website step checks up to 200 websites per run, 1 credit per page loaded; pages that fail are free.
* Email addresses of businesses are often personal data under laws such as GDPR. Check what's allowed where you and your leads are before you contact them.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.