# Substack Email Scraper (`leads-scraper/substack-email-scraper`) Actor

Substack Email Scraper SD - Substack Email Scraper is a lead generation tool that extracts leads with public contact emails, account names and profile URLs from Substack results by keyword, location and email domain - Substack email extractor.

- **URL**: https://apify.com/leads-scraper/substack-email-scraper.md
- **Developed by:** [Leads Scraper](https://apify.com/leads-scraper) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.49 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

### Substack Email Scraper

The **Substack Email Scraper** extracts publicly indexed contact emails from Substack newsletters, publication pages and posts, and returns them as a structured dataset ready for JSON or CSV export.

Substack is where independent writing became a business: macro and finance analysts, political and culture commentators, local news operators, fiction serialists, health and fitness coaches, niche B2B newsletters with tiny lists and enormous influence.

Almost all of them want to hear from sponsors. The Substack Email Scraper finds the address they published to make that happen — building keyword-driven Google searches against `substack.com`, parsing each result block structurally, and keeping only emails on the domains you specify.

This is contact discovery through public search results. The Substack Email Scraper does not log in to Substack, does not use a Substack API, and does not open the Substack website — no browser, no JavaScript rendering, no authentication, no cookies.

#### Who needs a Substack newsletter email finder

Media buyers and newsletter ad networks, sponsorship teams, PR and book publicists, cross-promotion partners, recruiters hiring writers, and researchers mapping the independent media landscape.

Newsletter sponsorship is a manual, relationship-driven market. The Substack Email Scraper removes the part that was never worth doing by hand.

***

### Key Features of the Substack Email Scraper

Everything below is genuinely implemented in the Substack Email Scraper. No roadmap items.

| Feature | What it does |
|---|---|
| Google SERP data collection | Builds `site:substack.com` queries and fetches result pages through the Apify GOOGLE\_SERP proxy |
| Subdomain coverage | Because publications live at `name.substack.com`, the `site:` operator reaches individual newsletters, not just the root domain |
| Query expansion | Base, quoted and `intitle:` variants plus one variant per modifier, to get past Google's per-query result ceiling |
| Domain filtering | Only emails ending in your listed domains survive (`@gmail.com`, `@yahoo.com` by default) |
| Global deduplication | One row per unique email across every query, page and keyword in the run |
| Email normalisation | Understands `name [at] domain [dot] com`, `name (at) domain`, `name @ domain.com`, `domain .com`, zero-width characters and the full-width `＠` |
| Junk filter | Rejects placeholders such as `email@`, `yourname@`, `test@`, `xxx@` and single-character locals |
| Boundary-correct matching | `@gmail.com` never matches inside `@gmail.company` or `@gmail.com.br` |
| Soft-wrap repair | Discards a hit that is only the tail of another email in the same result block |
| Concurrency control | An `asyncio` worker pool runs queries in parallel with a shared stop signal on `maxEmails` |
| Retry logic | Up to 3 attempts per page with exponential backoff and a fresh proxy session per request |
| Block detection | CAPTCHA, "unusual traffic" and consent pages are detected and retried, never counted as empty |
| Resumable state | Progress persists in the key-value store, saved on `PERSIST_STATE`, `MIGRATING` and `ABORTING` |
| Structural parser | Locates the `<h3>` title then the smallest surrounding block, rather than trusting Google's CSS class names |
| Whole-page fallback | A markup change degrades the crawler to "emails without account details", never to "no emails" |
| Streaming dataset writes | Every lead is pushed to the Apify dataset the moment it is found |

***

### How the Substack Email Scraper Works

The Substack Email Scraper pipeline has six stages and no hidden state.

1. **Read input.** Keywords, optional location, email domains, limits and concurrency.
2. **Build queries.** Each keyword pairs with each domain into a `site:substack.com` search, e.g. `site:substack.com fintech newsletter "@gmail.com" "London"`.
3. **Expand queries.** With `expandQueries` on, quoted and `intitle:` phrasings also run, plus one variant per modifier. Base queries always go first.
4. **Fetch result pages.** Asynchronous `aiohttp` requests through the Apify GOOGLE\_SERP proxy, with pagination up to `maxPagesPerQuery`.
5. **Parse blocks.** The parser reads the result title, the Substack site label and the post snippet as metadata for each candidate lead.
6. **Extract, deduplicate, store.** A domain-filtered regex pulls addresses from the block text; new ones stream into the dataset, duplicates are dropped.

Everything the Substack Email Scraper returns was already visible to anyone running the same search manually.

***

### What Data Does the Substack Email Scraper Extract

Each item carries the same 14 fields, so the output schema of the Substack Email Scraper never shifts between runs.

| Field | Meaning |
|---|---|
| `network` | Platform name |
| `keyword` | The keyword that produced the lead |
| `query` | The exact Google query used |
| `title` | Raw result title |
| `accountName` | Account label Google prints |
| `fullName` | Display name parsed from a profile-style title; empty for post snippets |
| `username` | URL-safe publication handle when one is exposed; otherwise `null` |
| `profileUrl` | Canonical newsletter URL when a handle is known; otherwise empty |
| `url` | Direct Substack link when exposed, else the profile URL |
| `description` | Bio or post snippet, cleaned of labels and engagement counters |
| `email` | Lower-cased email address |
| `emailDomain` | The matched domain, e.g. `@gmail.com` |
| `possiblyTruncated` | `true` when Google's snippet ellipsis touched the email |
| `foundAt` | ISO 8601 UTC timestamp |

Substack publications are subdomains, so a populated `username` produces a `profileUrl` of the form `https://handle.substack.com/`.

***

### Input Fields

Nine fields drive the Substack Email Scraper. Only `keywords` is required.

| Field | Type | Default | Description |
|---|---|---|---|
| `keywords` | array (required) | `["newsletter", "writer"]` | Search terms: niche, job title, industry |
| `location` | string | `""` | Optional location phrase added to every query |
| `customDomains` | array | `["@gmail.com", "@yahoo.com"]` | Only emails on these domains are kept; the `@` is optional |
| `maxEmails` | integer 1–10000 | `20` | Stop after this many unique emails |
| `countryCode` | string | `""` | Two-letter country for the search proxy (US, GB, DE…) |
| `expandQueries` | boolean | `true` | Search each keyword × domain pair in several phrasings |
| `queryModifiers` | array | `["email", "contact", "sponsor", "advertise", "partnership"]` | Extra words combined with each keyword when expansion is on |
| `maxPagesPerQuery` | integer 1–50 | `30` | Pagination cap per query |
| `maxConcurrency` | integer 1–20 | `5` | Parallel queries |

#### JSON input example

```json
{
  "keywords": ["fintech newsletter", "climate newsletter", "local news"],
  "location": "London",
  "customDomains": ["@gmail.com", "@protonmail.com"],
  "maxEmails": 300,
  "countryCode": "GB",
  "expandQueries": true,
  "queryModifiers": ["email", "contact", "sponsor", "advertise", "partnership"],
  "maxPagesPerQuery": 30,
  "maxConcurrency": 5
}
```

***

### Output Schema and Dataset Export

The Substack Email Scraper writes leads to the Apify dataset as they are discovered, so results accumulate visibly during the run.

#### JSON output example

```json
{
  "network": "Substack",
  "keyword": "fintech newsletter",
  "query": "site:substack.com fintech newsletter \"@gmail.com\" \"London\"",
  "title": "Macro Margins | Daniel Okereke | Substack",
  "accountName": "macromargins",
  "fullName": "Daniel Okereke",
  "username": "macromargins",
  "profileUrl": "https://macromargins.substack.com/",
  "url": "https://macromargins.substack.com/",
  "description": "Weekly fintech and payments analysis from London. Sponsorship and partnership enquiries: macromargins.ads@gmail.com",
  "email": "macromargins.ads@gmail.com",
  "emailDomain": "@gmail.com",
  "possiblyTruncated": false,
  "foundAt": "2026-08-31T13:05:41.118Z"
}
```

Export the Substack Email Scraper dataset as JSON, CSV, XLSX or XML from the Apify console, or read it over the API into your CRM.

***

### How to Run It

1. Open the Substack Email Scraper on Apify and click **Try for free**.
2. Replace the default keywords with the newsletter category you are targeting — `crypto newsletter`, `parenting newsletter`, `B2B SaaS newsletter`, `film criticism`.
3. Set the email domains you want. A narrow list produces a cleaner dataset than a broad one.
4. Optionally add a `location` and a `countryCode` — essential for local news and regional newsletters.
5. Choose `maxEmails` and start the run.
6. Follow the live log: it reports pages fetched, blocked pages, retries and emails per page.
7. Export the dataset, or chain the Substack Email Scraper into a workflow through the Apify API.

#### Tips for a better yield

Feed the Substack Email Scraper a topic plus the word "newsletter". `writer` is broad; `supply chain newsletter` is a query that converts.

Leave query expansion on. The `sponsor`, `advertise` and `partnership` modifiers are tuned for exactly how Substack writers phrase their ad pages.

If a niche runs dry, change `customDomains` before you change the keyword — many publishers run a dedicated ads inbox on a different provider.

***

### Use Cases for the Substack Email Scraper

| Use case | How the Substack Email Scraper helps |
|---|---|
| Newsletter sponsorship buying | Build a category-specific list of publishers open to advertising |
| Ad network supply sourcing | Recruit independent newsletters into a network or marketplace |
| PR and book publicity | Pitch reviews and interviews to writers covering your subject |
| Cross-promotion and swaps | Find newsletters of comparable size in an adjacent niche |
| Recruiting writers | Source proven independent writers for contract or staff roles |
| Media and market research | Map who publishes in a vertical and how they describe their audience |
| CRM enrichment | Append newsletter URLs and bio snippets to existing contact records |
| Podcast and event booking | Invite domain experts who already publish regularly |

***

### Why Choose This Actor

Substack has no exportable publisher directory with contact details, and its own discovery pages surface recommendations rather than emails.

The Substack Email Scraper automates the tedious half of newsletter lead generation — searching, paginating, copying, deduplicating — and leaves the qualification to you.

Because the Substack Email Scraper parses structurally instead of by CSS class name, and because a whole-page fallback exists, a Google layout change degrades result quality rather than breaking the run.

It also complements its siblings. Independent writers rarely stay on one platform: pair the Substack Email Scraper with the [Medium Email Scraper](https://apify.com/leads-scraper/medium-email-scraper) for the ones still publishing there, and with the [Patreon Email Scraper](https://apify.com/leads-scraper/patreon-email-scraper) for creators monetising through memberships instead.

For the audience layer around a newsletter, the [X Email Scraper](https://apify.com/leads-scraper/x-email-scraper) covers where most Substack writers promote, the [Reddit Email Scraper](https://apify.com/leads-scraper/reddit-email-scraper) reaches the communities that share their posts, and the [LinkedIn Email Scraper](https://apify.com/leads-scraper/linkedin-email-scraper) is stronger for B2B newsletter operators.

***

### Limitations

These constraints on the Substack Email Scraper are real. Read them before your first run.

- **Only publicly indexed emails.** The Substack Email Scraper finds addresses Google has already crawled. A publisher who never published an email will not appear.
- **Google's result cap.** A single query returns roughly 300 results at most. That is precisely why query expansion exists — leave it enabled.
- **`possiblyTruncated`.** When Google's snippet ellipsis touches an address, the row is flagged `true`. Verify those before outreach.
- **Apify GOOGLE\_SERP proxy required.** The Substack Email Scraper cannot run without Apify proxy credentials.
- **Free-plan cap.** Free Apify plans are limited to 100 emails per run; paid plans are uncapped.
- **`username` and `profileUrl` availability.** These are populated only when Substack exposes a publication handle in Google's result. Individual post results sometimes print only a display name, so those rows keep `accountName` and `fullName` but have an empty `username` and `profileUrl`. That is a Google limitation, not a bug.
- **Variable yield.** Output depends on keywords, domains and location. No volume is guaranteed.

***

### Example: a full run

A typical Substack Email Scraper run with three keywords, two domains, expansion on and `maxEmails: 300`.

The Substack Email Scraper issues base queries first (`site:substack.com climate newsletter "@gmail.com"`), then quoted and `intitle:` variants, then one variant per modifier — `email`, `contact`, `sponsor`, `advertise`, `partnership`.

Five queries run concurrently, each paginating until it runs dry or reaches `maxPagesPerQuery`. Addresses are normalised, domain-filtered, deduplicated globally and streamed to the dataset until the 300th unique email trips the shared stop signal.

Blocked or failed queries are re-queued once at the end of the run, so a transient CAPTCHA does not quietly cost you an entire keyword.

***

### Related Actors

The Substack Email Scraper belongs to a family of contact-discovery Actors that share this engine and output schema.

| Actor | What it collects |
|---|---|
| [Substack Email and Phone Number Scraper](https://apify.com/leads-scraper/substack-email-and-phone-number-scraper) | Emails and phone numbers from Substack |
| [Substack Phone Number Scraper](https://apify.com/leads-scraper/substack-phone-number-scraper) | Public phone numbers from Substack |
| [Behance Email Scraper](https://apify.com/leads-scraper/behance-email-scraper) | Public contact emails from Behance |
| [Bigo Live Email Scraper](https://apify.com/leads-scraper/bigo-live-email-scraper) | Public contact emails from Bigo Live |
| [Bluesky Email Scraper](https://apify.com/leads-scraper/bluesky-email-scraper) | Public contact emails from Bluesky |
| [Bumble Email Scraper](https://apify.com/leads-scraper/bumble-email-scraper) | Public contact emails from Bumble |
| [Clubhouse Email Scraper](https://apify.com/leads-scraper/clubhouse-email-scraper) | Public contact emails from Clubhouse |
| [Dailymotion Email Scraper](https://apify.com/leads-scraper/dailymotion-email-scraper) | Public contact emails from Dailymotion |
| [DeviantArt Email Scraper](https://apify.com/leads-scraper/deviantart-email-scraper) | Public contact emails from DeviantArt |
| [Discord Email Scraper](https://apify.com/leads-scraper/discord-email-scraper) | Public contact emails from Discord |
| [Dribbble Email Scraper](https://apify.com/leads-scraper/dribbble-email-scraper) | Public contact emails from Dribbble |
| [Facebook Email Scraper](https://apify.com/leads-scraper/facebook-email-scraper) | Public contact emails from Facebook |
| [Goodreads Email Scraper](https://apify.com/leads-scraper/goodreads-email-scraper) | Public contact emails from Goodreads |
| [Hinge Email Scraper](https://apify.com/leads-scraper/hinge-email-scraper) | Public contact emails from Hinge |
| [Instagram Email Scraper](https://apify.com/leads-scraper/instagram-email-scraper) | Public contact emails from Instagram |
| [KakaoTalk Email Scraper](https://apify.com/leads-scraper/kakaotalk-email-scraper) | Public contact emails from KakaoTalk |
| [Kick Email Scraper](https://apify.com/leads-scraper/kick-email-scraper) | Public contact emails from Kick |
| [Lemon8 Email Scraper](https://apify.com/leads-scraper/lemon8-email-scraper) | Public contact emails from Lemon8 |
| [Likee Email Scraper](https://apify.com/leads-scraper/likee-email-scraper) | Public contact emails from Likee |
| [LINE Email Scraper](https://apify.com/leads-scraper/line-email-scraper) | Public contact emails from LINE |
| [LinkedIn Email Scraper](https://apify.com/leads-scraper/linkedin-email-scraper) | Public contact emails from LinkedIn |
| [Mastodon Email Scraper](https://apify.com/leads-scraper/mastodon-email-scraper) | Public contact emails from Mastodon |
| [Medium Email Scraper](https://apify.com/leads-scraper/medium-email-scraper) | Public contact emails from Medium |
| [Mixcloud Email Scraper](https://apify.com/leads-scraper/mixcloud-email-scraper) | Public contact emails from Mixcloud |
| [Patreon Email Scraper](https://apify.com/leads-scraper/patreon-email-scraper) | Public contact emails from Patreon |
| [Pinterest Email Scraper](https://apify.com/leads-scraper/pinterest-email-scraper) | Public contact emails from Pinterest |
| [Quora Email Scraper](https://apify.com/leads-scraper/quora-email-scraper) | Public contact emails from Quora |
| [Reddit Email Scraper](https://apify.com/leads-scraper/reddit-email-scraper) | Public contact emails from Reddit |
| [Rumble Email Scraper](https://apify.com/leads-scraper/rumble-email-scraper) | Public contact emails from Rumble |
| [Snapchat Email Scraper](https://apify.com/leads-scraper/snapchat-email-scraper) | Public contact emails from Snapchat |
| [SoundCloud Email Scraper](https://apify.com/leads-scraper/soundcloud-email-scraper) | Public contact emails from SoundCloud |
| [Telegram Email Scraper](https://apify.com/leads-scraper/telegram-email-scraper) | Public contact emails from Telegram |
| [Threads Email Scraper](https://apify.com/leads-scraper/threads-email-scraper) | Public contact emails from Threads |
| [TikTok Email Scraper](https://apify.com/leads-scraper/tiktok-email-scraper) | Public contact emails from TikTok |
| [Tinder Email Scraper](https://apify.com/leads-scraper/tinder-email-scraper) | Public contact emails from Tinder |
| [Tumblr Email Scraper](https://apify.com/leads-scraper/tumblr-email-scraper) | Public contact emails from Tumblr |
| [Twitch Email Scraper](https://apify.com/leads-scraper/twitch-email-scraper) | Public contact emails from Twitch |
| [Vimeo Email Scraper](https://apify.com/leads-scraper/vimeo-email-scraper) | Public contact emails from Vimeo |
| [VK Email Scraper](https://apify.com/leads-scraper/vk-email-scraper) | Public contact emails from VK |
| [WeChat Email Scraper](https://apify.com/leads-scraper/wechat-email-scraper) | Public contact emails from WeChat |
| [Weibo Email Scraper](https://apify.com/leads-scraper/weibo-email-scraper) | Public contact emails from Weibo |
| [X Email Scraper](https://apify.com/leads-scraper/x-email-scraper) | Public contact emails from X |

### FAQ

#### What is the Substack Email Scraper?

An Apify Actor that extracts publicly indexed contact emails from Substack newsletters, publication pages and posts via Google search results, and writes them to a structured dataset.

#### Does the Substack Email Scraper log in to Substack?

No. The Substack Email Scraper does not log in, does not call a Substack API, and does not open substack.com. It reads Google search results only.

#### Does it find subscriber emails?

No, and it never could. The Substack Email Scraper only sees addresses a publisher chose to publish on a public page — typically a sponsorship or contact inbox.

#### Where do the emails come from?

Titles, snippets and site labels in Google's public index, usually from an about page, an advertise page, or the footer of a post.

#### Can I choose which email providers are returned?

Yes. `customDomains` filters the Substack Email Scraper's extraction step. Defaults are `@gmail.com` and `@yahoo.com`, and the leading `@` is optional.

#### Why is `username` empty on some rows?

Google sometimes prints only a display name for an individual post. Where no publication handle is exposed, `username` is `null` and `profileUrl` is empty, while `accountName` and `fullName` remain populated.

#### What does `possiblyTruncated: true` mean?

Google's snippet ellipsis touched the address, so it may be cut off. Treat those rows as unverified before sending anything.

#### How many Substack newsletter emails will one run return?

It depends on keywords, domains and location — no volume is guaranteed. Free Apify plans stop at 100 emails per run; paid plans are uncapped.

#### Do I need a proxy?

Yes. The Substack Email Scraper requires the Apify GOOGLE\_SERP proxy and will not run without Apify proxy credentials.

#### Should I leave query expansion on?

Almost always. Google caps a single query near 300 results, and expansion is how the Substack Email Scraper works around that ceiling.

#### Does the output schema ever change?

No. Every item the Substack Email Scraper writes carries the same 14 fields, which keeps downstream mapping stable.

#### Can I export to CSV or schedule recurring runs?

Yes. Export as JSON, CSV, XLSX or XML, and use Apify Schedules to run the Substack Email Scraper on a recurring basis into the same dataset.

***

### Leave a review

If the Substack Email Scraper saved you time, please leave a star rating and a short review on
the Actor page.

Reviews are how other buyers judge whether a tool works, and they tell us which features to
build next.

If something did not work, email <neurodata.apify@gmail.com>
instead - bugs get fixed faster than they get complained about.

### Support

Questions about the Substack Email Scraper, feature requests, or need a custom build? Email **neurodata.apify@gmail.com**.

Not affiliated with, endorsed by, or officially connected to Substack. Use collected data in line with applicable privacy and anti-spam law.

# Actor input Schema

## `keywords` (type: `array`):

Search terms describing the Substack accounts you want (niche, job title, industry).

## `location` (type: `string`):

Optional location phrase added to every query (e.g. "New York").

## `customDomains` (type: `array`):

Only emails ending with one of these domains are collected. With or without the leading @. Each domain is searched separately, so more domains means more results but a longer run - remove some for a faster, narrower search, or add your own (e.g. @company.com).

## `maxEmails` (type: `integer`):

Stop once this many unique emails have been collected.

## `countryCode` (type: `string`):

Two-letter country code for the search proxy (e.g. US, GB, DE). Empty for any.

## `expandQueries` (type: `boolean`):

Search each keyword x domain pair with several phrasings. Recommended - Google caps a single query at ~300 results.

## `queryModifiers` (type: `array`):

Extra words combined with each keyword when Expand queries is on. Tuned for Substack.

## `maxPagesPerQuery` (type: `integer`):

Google rarely returns more than ~30 pages for one query.

## `maxConcurrency` (type: `integer`):

How many queries run in parallel.

## Actor input object example

```json
{
  "keywords": [
    "newsletter",
    "writer"
  ],
  "location": "",
  "customDomains": [
    "@gmail.com",
    "@yahoo.com"
  ],
  "maxEmails": 20,
  "countryCode": "",
  "expandQueries": true,
  "queryModifiers": [
    "email",
    "contact",
    "sponsor",
    "advertise",
    "partnership"
  ],
  "maxPagesPerQuery": 30,
  "maxConcurrency": 5
}
```

# Actor output Schema

## `results` (type: `string`):

Records produced by Substack Email Scraper, stored in the run's default dataset.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "keywords": [
        "newsletter",
        "writer"
    ],
    "location": "",
    "customDomains": [
        "@gmail.com",
        "@yahoo.com"
    ],
    "countryCode": "",
    "queryModifiers": [
        "email",
        "contact",
        "sponsor",
        "advertise",
        "partnership"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("leads-scraper/substack-email-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "keywords": [
        "newsletter",
        "writer",
    ],
    "location": "",
    "customDomains": [
        "@gmail.com",
        "@yahoo.com",
    ],
    "countryCode": "",
    "queryModifiers": [
        "email",
        "contact",
        "sponsor",
        "advertise",
        "partnership",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("leads-scraper/substack-email-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "keywords": [
    "newsletter",
    "writer"
  ],
  "location": "",
  "customDomains": [
    "@gmail.com",
    "@yahoo.com"
  ],
  "countryCode": "",
  "queryModifiers": [
    "email",
    "contact",
    "sponsor",
    "advertise",
    "partnership"
  ]
}' |
apify call leads-scraper/substack-email-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,leads-scraper/substack-email-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/UdQEoxbWEbsgdnu5z/builds/wDRvTV3RMSJTY2FgF/openapi.json
