Free toolsWorkflowsPython

Bulk email finder script in Python

A bulk email finder in one Python file with no dependencies. Give it a CSV of company websites and it finds the email addresses on each one, writing a CSV with one row per person or inbox.

100 free credits. No credit card.

Built and tested by ListMiner. Updated November 19, 2026.

Set it up

How to set up the Python email finder

Five steps, about ten minutes.

You need

  • Python 3.9 or newer
  • A ListMiner API key
  • A CSV with two columns: website and company_name
  1. 1

    Get an API key

    Create a free account, open the API Keys section and click Create. Copy the key when it is shown. 100 free credits. No credit card.

  2. 2

    Save the script

    Download it, or copy it into a file called listminer_websites_to_contacts.py.

  3. 3

    Set your key

    In a terminal: export LISTMINER_API_KEY=your_key. On Windows: set LISTMINER_API_KEY=your_key.

  4. 4

    Run it

    python3 listminer_websites_to_contacts.py websites.csv contacts.csv

  5. 5

    Open the result

    contacts.csv has one row per contact. The script prints how many credits the run used and how many are left.

The file

The Python email finder script

Copy it from here, or download it with the button at the top of the page.

listminer_websites_to_contacts.py

#!/usr/bin/env python3
"""Websites in, people and emails out, with the ListMiner API.

    export LISTMINER_API_KEY=your_key
    python3 listminer_websites_to_contacts.py websites.csv contacts.csv

websites.csv needs two columns with a header row: website, company_name.
contacts.csv gets one row per person or inbox found.

Uses only Python's standard library. Edit TITLES and SOURCES below to
change who it looks for. API reference: https://listminer.com/docs/api
"""

import csv
import json
import os
import sys
import time
import urllib.error
import urllib.request

BASE = "https://api.prod.cold-email.softwaredoes.com/api/v1"
KEY = os.environ.get("LISTMINER_API_KEY", "")

# Who to look for, and where.
TITLES = ["Owner", "Founder", "CEO"]
SOURCES = ["LINKEDIN", "TEAM_PAGE", "WEBSITE_EMAILS"]

BATCH = 25  # the most websites one call takes
DONE = {"COMPLETED", "COMPLETED_WITH_ERRORS", "FAILED"}
FIELDS = ["website", "company_name", "full_name", "position", "email", "email_type", "linkedin_url", "found_in"]


def call(method, path, body=None, timeout=60):
    req = urllib.request.Request(
        BASE + path,
        method=method,
        data=json.dumps(body).encode() if body is not None else None,
        headers={"X-API-Key": KEY, "Content-Type": "application/json"},
    )
    try:
        with urllib.request.urlopen(req, timeout=timeout) as res:
            return json.load(res)
    except urllib.error.HTTPError as err:
        sys.exit(f"{method} {path} failed: {err.code} {err.read().decode(errors='replace')[:300]}")


def run_batch(items):
    job = call("POST", "/batch/super", {"items": items, "sources": SOURCES, "titles": TITLES})["job_id"]
    while True:
        state = call("GET", f"/batch/super/{job}?wait_seconds=25")
        if state["status"] in DONE:
            return state
        if state["status"] == "WAITING_LINKEDIN_DATA":
            print("  LinkedIn data is refreshing; checking again in 5 minutes")
            time.sleep(300)


def main():
    if len(sys.argv) != 3:
        sys.exit(__doc__)
    if not KEY:
        sys.exit("Set LISTMINER_API_KEY first. Get a key at https://listminer.com/signup")

    with open(sys.argv[1], newline="", encoding="utf-8-sig") as f:
        sites = [
            {"url": row["website"].strip(), "company_name": (row.get("company_name") or "").strip()}
            for row in csv.DictReader(f)
            if (row.get("website") or "").strip()
        ]
    print(f"{len(sites)} websites")

    found = spent = 0
    with open(sys.argv[2], "w", newline="", encoding="utf-8") as f:
        out = csv.DictWriter(f, fieldnames=FIELDS)
        out.writeheader()
        for start in range(0, len(sites), BATCH):
            state = run_batch(sites[start : start + BATCH])
            if state["status"] == "FAILED":
                sys.exit(f"Batch failed, nothing was charged: {state.get('error')}")
            spent += state.get("tokens_spent") or 0
            for site in state.get("results") or []:
                for line in site.get("results") or []:
                    out.writerow({
                        "website": site["url"],
                        "company_name": site.get("company_name") or "",
                        "full_name": line.get("full_name") or "",
                        "position": line.get("position") or "",
                        "email": line.get("email") or "",
                        "email_type": line.get("email_type") or "",
                        "linkedin_url": line.get("linkedin_url") or "",
                        "found_in": ", ".join(line.get("sources") or []),
                    })
                    found += 1
            f.flush()
            print(f"  {min(start + BATCH, len(sites))} of {len(sites)} websites done")

    balance = call("GET", "/batch/balance")["tokens_remained"]
    print(f"{found} rows written to {sys.argv[2]}. {spent} credits used, {balance} left.")


if __name__ == "__main__":
    main()

The script. Replace YOUR_API_KEY with your own key; never share a file that holds it.

What comes back

What the Python email finder returns

One row per person or inbox.

website
The website the row was found on.
full_name
The person's name. Empty for an inbox such as info@.
position
Their job title, as their profile or the team page gives it.
email
The email address. A person found with no address has this empty and costs nothing.
email_type
Personal for a named person's address, Generic for a company inbox.
linkedin_url
Their LinkedIn profile, when the person was found there.
found_in
Where the row came from: LinkedIn, Team page, Website, or more than one.

Make it yours

How to change job titles and sources

Job titles
Edit TITLES near the top of the file. Each title also finds its longer forms, so Owner finds Co-Owner.
Where it looks
Edit SOURCES: LINKEDIN for people on LinkedIn, TEAM_PAGE for the site's own team page, WEBSITE_EMAILS for addresses the site publishes.
Large files
The script sends 25 websites per batch and writes each batch as it arrives, so a long run that is stopped keeps what it has.

Run it

The workflow needs one thing: a key.

Start with 100 free credits, no credit card. You pay 2 credits for a person with a work email, 1 for an address found on the website, and nothing when no email is found.

Questions

Questions about the Python email finder

How do I find email addresses from a list of websites in Python?

Read the websites from a CSV, send them to an email finder API in batches, wait for each batch, and write the contacts to a second CSV. This script does that with the ListMiner API in about a hundred lines.

Does the Python email finder need any packages?

No. It uses only Python's standard library, so there is nothing to install with pip.

How many websites can the Python script process?

As many as the CSV holds. It works through them 25 at a time, which is the most one batch call takes, and waits for each batch to finish before sending the next.

How much does it cost to find emails in bulk?

The script is free. The API uses credits: 2 for a person with a work email, 1 for an email address found on the website, and nothing for a website where no email is found. A new account starts with 100 free credits.

Why does the script sometimes wait five minutes?

Once a month the LinkedIn data behind the API is refreshed. A batch sent during the refresh waits and then continues by itself, and the script checks back every five minutes.

Can I change which job titles the script looks for?

Yes. Edit TITLES near the top of the file. Each title also finds its longer forms, so Owner finds Co-Owner.

The same job in another tool: n8n email finder.