# Beehiiv Newsletter Scraper (`automation-lab/beehiiv-newsletter-scraper`) Actor

Extract public Beehiiv posts with article text, metadata, authors, dates, images, tags, and outbound links. Supports custom domains, filters, API runs, and scheduled monitoring without a Beehiiv API key.

- **URL**: https://apify.com/automation-lab/beehiiv-newsletter-scraper.md
- **Developed by:** [Stas Persiianenko](https://apify.com/automation-lab) (community)
- **Categories:** News
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

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

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js/docs.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Beehiiv Newsletter Scraper

Extract **public Beehiiv newsletter posts** from publication homepages, archives, sitemaps, and direct post URLs.
Get titles, authors, dates, access status, reading time, full public text, optional HTML, images, tags, and outbound links without a Beehiiv API key.

Use the Actor for scheduled newsletter monitoring, competitive intelligence, sponsorship research, content analysis, and retrieval-augmented generation (RAG) datasets.
It uses fast HTTP requests and Beehiiv's public sitemap and server-rendered post data rather than launching a browser for every page.

> Premium posts are never unlocked. When Beehiiv exposes public preview metadata for a gated post, the Actor records that metadata and marks the post as paywalled without returning its protected body.

### What does Beehiiv Newsletter Scraper do?

Beehiiv Newsletter Scraper turns one or many Beehiiv-powered sites into a structured post dataset.
It accepts regular `*.beehiiv.com` publications and Beehiiv sites hosted on custom domains.

The Actor can:

- 📰 discover post URLs through a publication sitemap;
- 🎯 process a direct `/p/<slug>` post URL without crawling an archive;
- ✍️ extract one or multiple authors and author profile URLs;
- 📅 filter posts with inclusive publication-date boundaries;
- 🔎 match keywords against titles, subtitles, and accessible article text;
- 📄 return clean public article text and an estimated word count;
- 🧩 include article HTML when your downstream pipeline needs formatting;
- 🔗 collect unique external links cited in each post;
- 🔒 identify free and premium content without bypassing access controls;
- ⚡ process multiple publication domains in one run.

The easiest test is the prefilled `https://www.therundown.ai` publication with a three-post limit.

### Who is Beehiiv Newsletter Scraper for?

**Newsletter competitive-intelligence teams**

- Monitor how often competing publishers release content.
- Compare titles, themes, authors, reading time, and cited sources.
- Schedule weekly ingestion across a stable publication watchlist.

**Sponsorship and media buyers**

- Build a reviewable catalog of recent posts before outreach.
- Identify recurring topics and outbound brands in public editions.
- Export newsletter data to Sheets, a CRM, or an internal scoring model.

**Writers, editors, and content strategists**

- Research topic coverage and headline patterns.
- Find public articles that mention products, markets, or competitors.
- Compare editorial cadence across multiple Beehiiv publications.

**AI and data engineering teams**

- Create a public-newsletter corpus for search or RAG.
- Preserve canonical URLs and extraction timestamps for provenance.
- Use text for embeddings and optional HTML for structure-aware parsing.

### Why use this Beehiiv scraper?

- **No Beehiiv API key:** it works with anonymously accessible public pages.
- **Custom-domain support:** input the actual publication URL, not only a Beehiiv subdomain.
- **Low-overhead HTTP extraction:** no browser is launched for normal public posts.
- **Flexible starts:** publication, archive, sitemap, and post URLs share one input field.
- **Full public content:** receive article text, not only archive-card metadata.
- **Paywall-safe behavior:** gated bodies stay omitted and are clearly marked.
- **Useful filters:** reduce exports by publication date and topic keywords.
- **Automation-ready:** run through the Apify API, schedules, webhooks, Make, or Zapier.
- **Standard exports:** download JSON, CSV, Excel, XML, or RSS from Apify datasets.

### What Beehiiv data can you extract?

| Category | Fields |
|---|---|
| Publication | `publicationId`, `publicationName`, `publicationDomain`, `publicationUrl`, `publicationDescription` |
| Post identity | `postId`, `slug`, `url` |
| Editorial metadata | `title`, `subtitle`, `excerpt`, `authors`, `authorUrls` |
| Dates and access | `publishedAt`, `updatedAt`, `audience`, `isPaywalled`, `isAccessibleForFree` |
| Content | `text`, optional `html`, `readingTimeMinutes`, `wordCount` |
| Media and taxonomy | `coverImageUrl`, `tags` |
| Link intelligence | `outboundLinks` |
| Public engagement | `likeCount`, `commentCount` when the page exposes reliable values |
| Provenance | `scrapedAt` |

Optional values are omitted when a publication does not expose them.
The Actor does not fabricate subscriber counts, engagement figures, dates, or authors.

### How much does it cost to scrape Beehiiv newsletters?

This Actor uses **pay-per-event** pricing.
A small start fee covers run initialization, followed by one charge for each Beehiiv post saved to the dataset.
Platform compute is included in the event prices.

Current launch pricing is:

| Event | Free | Starter | Scale | Business |
|---|---:|---:|---:|---:|
| Run start | $0.005 | $0.005 | $0.005 | $0.005 |
| One post | $0.00038987 | $0.00033902 | $0.00026444 | $0.00020341 |

For example, a Starter-plan run that saves 100 posts costs about **$0.0389**: `$0.005 + (100 × $0.00033902)`.
Higher Apify plans receive additional volume discounts.
Always check the live Pricing tab for the current rate.

### How to scrape Beehiiv newsletter posts

1. Open **Beehiiv Newsletter Scraper** on Apify.
2. Add a publication homepage, archive, sitemap, or direct post URL.
3. Keep `Posts per publication` small for your first test.
4. Optionally add a publication-date range or keywords.
5. Enable HTML only when the destination needs article markup.
6. Click **Start** and wait for the run to finish.
7. Open the **Dataset** tab to review the extracted posts.
8. Export results as JSON, CSV, Excel, XML, or RSS.
9. Create an Apify schedule if you want recurring monitoring.

A minimal publication run:

```json
{
  "startUrls": [{ "url": "https://www.therundown.ai" }],
  "maxPostsPerPublication": 10,
  "maxItems": 10
}
````

A direct-post extraction:

```json
{
  "startUrls": [
    { "url": "https://www.therundown.ai/p/nvidia-big-ai-day-at-gtc" }
  ],
  "maxItems": 1,
  "includeHtml": true
}
```

A topic-monitoring run:

```json
{
  "startUrls": [
    { "url": "https://www.therundown.ai" }
  ],
  "maxPostsPerPublication": 50,
  "publishedAfter": "2026-07-01",
  "keywords": ["OpenAI", "Claude", "agent"],
  "includeOutboundLinks": true
}
```

### Input parameters

| Parameter | Type | Default | Description |
|---|---|---:|---|
| `startUrls` | array | required | Beehiiv publication, archive, sitemap, or direct post URLs. |
| `maxPostsPerPublication` | integer | `10` | Maximum newest sitemap posts fetched per publication. |
| `maxItems` | integer | `50` | Total matching posts saved across the run. |
| `publishedAfter` | string | empty | Inclusive lower publication-date bound in ISO format. |
| `publishedBefore` | string | empty | Inclusive upper publication-date bound in ISO format. |
| `keywords` | string array | `[]` | Keep a post when any keyword matches title, subtitle, or public text. |
| `includeHtml` | boolean | `false` | Include cleaned accessible article HTML. |
| `includeOutboundLinks` | boolean | `true` | Extract unique external links from accessible bodies. |
| `proxyConfiguration` | object | proxy off | Optional Apify Proxy retry for protected custom domains. |

`publishedAfter` must be before or equal to `publishedBefore`.
Invalid dates and unsupported URL protocols fail closed with a clear error.

### Output example

A free post can look like this:

```json
{
  "publicationId": "4d03390d-2481-4299-b949-ffd8b38b4c38",
  "publicationName": "The Rundown AI",
  "publicationDomain": "www.therundown.ai",
  "publicationUrl": "https://www.therundown.ai/",
  "postId": "bfe910b3-6e6f-4899-968b-9079f10aebf3",
  "slug": "nvidia-big-ai-day-at-gtc",
  "url": "https://www.therundown.ai/p/nvidia-big-ai-day-at-gtc",
  "title": "Nvidia's big AI day at GTC",
  "subtitle": "PLUS: How to use Grok for free automated research",
  "authors": ["Zach Mink", "Joey Liu", "Rowan Cheung"],
  "publishedAt": "2026-03-17T09:00:00.000Z",
  "updatedAt": "2026-03-17T10:02:53Z",
  "audience": "free",
  "isPaywalled": false,
  "isAccessibleForFree": true,
  "readingTimeMinutes": 13,
  "wordCount": 1640,
  "text": "Public article text...",
  "coverImageUrl": "https://beehiiv-images-production.s3.amazonaws.com/...",
  "tags": [],
  "outboundLinks": ["https://example.com/source"],
  "scrapedAt": "2026-07-20T00:00:00.000Z"
}
```

The example is abbreviated.
Actual author lists, word counts, links, and optional fields depend on the public source page.

### How sitemap and direct-post discovery work

For a publication or archive input, the Actor requests the site's public `sitemap.xml`.
It follows a bounded number of sitemap-index links, keeps canonical `/p/<slug>` URLs, and prioritizes entries with newer `lastmod` values.

For a direct post URL, sitemap discovery is skipped.
The post still passes through the same access, date, keyword, output, and billing rules.
This prevents direct URLs from bypassing filters or product scope.

### How paywalled Beehiiv posts are handled

Beehiiv may expose a premium post's public title, subtitle, author, image, publication date, and canonical URL.
The Actor may save that public metadata when it is available.

For premium or inaccessible posts:

- `isPaywalled` is `true`;
- `isAccessibleForFree` is `false`;
- `text` and `html` are omitted;
- no login, subscription, cookie theft, or paywall bypass is attempted.

This behavior is appropriate for archive monitoring while respecting access controls.

### Keyword and date filtering

Keyword matching is case-insensitive.
A post is retained when **any** supplied keyword appears in its title, subtitle, or accessible body text.

Date filters are inclusive:

- `publishedAfter: "2026-07-01"` keeps posts published on or after that date/time.
- `publishedBefore: "2026-07-31"` keeps posts published on or before that date/time.

If a date filter is active and the source exposes no parseable publication date, that post is excluded.
This fail-closed behavior avoids silently returning records outside a requested window.

### Tips for best results

- 🧪 Start with 3–10 posts before increasing the limit.
- 🎯 Use direct post URLs for one-off extraction and debugging.
- 📅 Use date windows for scheduled monitors to reduce repeated output.
- 🔎 Keep keyword lists focused; any keyword can match.
- 📄 Leave HTML disabled when plain text is enough to reduce dataset size.
- 🔗 Disable outbound links when you do not need citation analysis.
- 🌐 Enter the publication's real custom domain when it has one.
- 🛡️ Enable Apify Proxy only if a custom domain blocks direct requests.
- 🧾 Deduplicate downstream records by `url` or `postId` across scheduled runs.

### Scheduling a Beehiiv newsletter monitor

Apify schedules can run this Actor hourly, daily, weekly, or with a custom cron expression.
A common workflow is:

1. Store a stable list of competitor publication URLs in the Actor input.
2. Set `publishedAfter` to a recent rolling date in your orchestration layer.
3. Keep `maxPostsPerPublication` high enough to cover the interval.
4. Send the resulting dataset to a webhook or automation platform.
5. Deduplicate on canonical `url` before alerting analysts.

The Actor itself does not persist a hidden cross-run cursor.
That keeps each run reproducible from its explicit input.

### Beehiiv scraper integrations

**Beehiiv Newsletter Scraper → Google Sheets**

Export recent posts for editors or media buyers to review titles, authors, dates, and source links.
Use an Apify integration or Make scenario to append only unseen URLs.

**Beehiiv Newsletter Scraper → Slack or Discord**

Schedule a keyword-filtered run and post a webhook message when competitors mention a product, company, or market.
Include the canonical URL and subtitle in the alert.

**Beehiiv Newsletter Scraper → Make or Zapier**

Trigger downstream enrichment after each run.
For example, route outbound domains to a sponsorship-prospect table or send public text to a classifier.

**Beehiiv Newsletter Scraper → vector database**

Chunk the `text` field, keep `publicationName`, `publishedAt`, and `url` as metadata, then write embeddings to Pinecone, Weaviate, Qdrant, or another vector store.

**Beehiiv Newsletter Scraper → data warehouse**

Load JSON or CSV into BigQuery, Snowflake, or PostgreSQL.
Use `postId` where present and canonical `url` as a fallback key.

### Using the Apify API with JavaScript

Install the client:

```bash
npm install apify-client
```

Run the Actor:

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

const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('automation-lab/beehiiv-newsletter-scraper').call({
  startUrls: [{ url: 'https://www.therundown.ai' }],
  maxPostsPerPublication: 10,
  maxItems: 10,
  includeOutboundLinks: true,
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

### Using the Apify API with Python

Install the client:

```bash
pip install apify-client
```

Run the Actor:

```python
import os
from apify_client import ApifyClient

client = ApifyClient(os.environ['APIFY_TOKEN'])
run = client.actor('automation-lab/beehiiv-newsletter-scraper').call(run_input={
    'startUrls': [{'url': 'https://www.therundown.ai'}],
    'maxPostsPerPublication': 10,
    'maxItems': 10,
})

items = client.dataset(run['defaultDatasetId']).list_items().items
print(items)
```

### Using the Apify API with cURL

Start a synchronous run and return dataset items:

```bash
curl -X POST \
  "https://api.apify.com/v2/acts/automation-lab~beehiiv-newsletter-scraper/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "startUrls": [{"url": "https://www.therundown.ai"}],
    "maxPostsPerPublication": 10,
    "maxItems": 10
  }'
```

For production integrations, send the token in an authorization header or secret manager instead of committing it to source control.

### Use Beehiiv Newsletter Scraper with AI agents via MCP

Beehiiv Newsletter Scraper can be called by AI assistants through Apify's hosted [Model Context Protocol integration](https://docs.apify.com/platform/integrations/mcp).

For Claude Code:

```bash
claude mcp add --transport http apify "https://mcp.apify.com?tools=automation-lab/beehiiv-newsletter-scraper"
```

For Claude Desktop, Cursor, or VS Code, add this MCP server configuration:

```json
{
  "mcpServers": {
    "apify": {
      "url": "https://mcp.apify.com?tools=automation-lab/beehiiv-newsletter-scraper"
    }
  }
}
```

Your client will ask you to authenticate with Apify.

#### Example prompts

After setup, try asking:

- “Use `automation-lab/beehiiv-newsletter-scraper` to extract the latest 10 public posts from The Rundown AI.”
- “Scrape this Beehiiv post and return its authors, publication date, full public text, and outbound sources.”
- “Monitor these Beehiiv publications for posts mentioning Claude or AI agents since July 1.”

### Is it legal to scrape Beehiiv newsletters?

Scraping publicly available website data is generally permitted in many jurisdictions, but the rules depend on your location, purpose, and the data involved.
You are responsible for complying with applicable laws, Beehiiv and publication terms, copyright, privacy rights, and contractual restrictions.

Use the Actor ethically:

- collect only data you have a lawful reason to process;
- do not attempt to bypass authentication or payment controls;
- avoid redistributing copyrighted article bodies without permission;
- respect deletion, access, and objection rights when personal data is involved;
- use conservative limits and avoid disrupting publication websites.

This documentation is not legal advice.
Consult a qualified professional for your specific use case.

### Limitations

- The Actor covers Beehiiv-powered sites that expose public sitemaps and post pages.
- A publisher can disable indexing, remove old posts, or change its custom-domain behavior.
- Some custom domains may block direct HTTP and require an Apify Proxy configuration.
- Posts omitted from every public sitemap cannot be discovered from a homepage input; use a direct URL when known.
- Premium content is not extracted beyond public metadata and preview fields.
- Engagement fields are omitted unless the page exposes values that can be interpreted reliably.
- Date filtering requires a parseable public publication date.
- HTML reflects public rendered content and may include publication-specific layout elements.

### Troubleshooting

**Why did the run say no `/p/` post URLs were found?**

Confirm that the input is a Beehiiv-powered publication and that its public sitemap is reachable at `/sitemap.xml`.
If you know a post URL, submit that direct `/p/<slug>` URL instead.

**Why was a custom domain blocked?**

Some publishers add their own CDN or bot protection.
Configure Apify Proxy in the Advanced input section and retry a small run.
The Actor retries blocked direct requests once through the configured proxy.

**Why are `text` and `html` missing?**

The post may be premium, inaccessible, or rendered without the expected public content container.
Check `isPaywalled` and `isAccessibleForFree` first.
HTML is also omitted unless `includeHtml` is enabled.

**Why did keyword filtering return no rows?**

Keywords use any-match logic but only inspect the public title, subtitle, and accessible text.
Check spelling, remove overly narrow phrases, and test without keywords to inspect the available public content.

### FAQ

**Does this Actor need a Beehiiv account or API key?**

No.
It reads anonymously accessible publication sitemaps and public post pages.

**Can it scrape Beehiiv custom domains?**

Yes, when the custom domain exposes standard Beehiiv public surfaces.
Provide the complete domain URL in `startUrls`.

**Can it scrape every post in a publication?**

It can process posts exposed in the public sitemap up to your configured limits.
Set a proportionate limit and check the sitemap if an expected URL is absent.

**How fast is the Beehiiv scraper?**

Normal runs use direct HTTP and avoid browser startup.
Duration depends on publication response times, number of posts, retries, and dataset size.

**How does it compare with the Beehiiv API?**

Beehiiv's authenticated API serves publication owners and requires credentials.
This Actor is for public web posts and works without the publication owner's API key.

**Does it bypass newsletter paywalls?**

No.
Premium posts are marked as paywalled, and protected body text and HTML are omitted.

**Can I extract only one post?**

Yes.
Use the direct `/p/<slug>` URL and set `maxItems` to `1`.

**Can I monitor several publications in one run?**

Yes.
Add multiple publication URLs and set per-publication and total limits.

### Related newsletter and content scrapers

Continue a newsletter or creator-intelligence workflow with these Automation Labs actors:

- [Substack Scraper](https://apify.com/automation-lab/substack-scraper) — extract Substack publications and posts.
- [Substack Leaderboard Scraper](https://apify.com/automation-lab/substack-leaderboard-scraper) — discover ranked publications by category.
- [Substack Comments Scraper](https://apify.com/automation-lab/substack-comments-scraper) — collect public discussion around Substack posts.
- [Substack People Scraper](https://apify.com/automation-lab/substack-people-scraper) — research authors and creator profiles.
- [Substack Notes Search & Author Monitor](https://apify.com/automation-lab/substack-notes-search-author-monitor) — track shorter-form creator posts.
- [Medium Scraper](https://apify.com/automation-lab/medium-scraper) — extract public Medium articles.
- [Reddit Scraper](https://apify.com/automation-lab/reddit-scraper) — add community discussion to topic research.
- [YouTube Transcript](https://apify.com/automation-lab/youtube-transcript) — turn public video speech into analysis-ready text.

### Support

If a valid public Beehiiv page fails, open an issue from the Actor page and include:

- the source URL;
- a small reproducible input;
- the failed run ID;
- whether proxy use was enabled;
- the expected public field or post.

Do not share private credentials, subscriber cookies, or paid content in an issue.

# Actor input Schema

## `startUrls` (type: `array`):

Add one or more public Beehiiv-powered URLs. Custom publication domains are supported.

## `maxPostsPerPublication` (type: `integer`):

Set the maximum number of newest sitemap posts fetched from each publication.

## `maxItems` (type: `integer`):

Stop after this many matching posts have been saved across all publications.

## `publishedAfter` (type: `string`):

Keep posts published on or after this ISO date. Leave empty for no lower bound.

## `publishedBefore` (type: `string`):

Keep posts published on or before this ISO date. Leave empty for no upper bound.

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

Keep posts whose title, subtitle, or accessible body contains any keyword (case-insensitive).

## `includeHtml` (type: `boolean`):

Add cleaned public article HTML to each free-post record. Text is included automatically.

## `includeOutboundLinks` (type: `boolean`):

Extract unique external HTTP links from each accessible post body.

## `proxyConfiguration` (type: `object`):

Optionally retry protected custom domains through Apify Proxy.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.therundown.ai"
    }
  ],
  "maxPostsPerPublication": 3,
  "maxItems": 3,
  "keywords": [],
  "includeHtml": false,
  "includeOutboundLinks": true,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `posts` (type: `string`):

No description

# 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 = {
    "startUrls": [
        {
            "url": "https://www.therundown.ai"
        }
    ],
    "maxPostsPerPublication": 3,
    "maxItems": 3,
    "includeHtml": false,
    "includeOutboundLinks": true
};

// Run the Actor and wait for it to finish
const run = await client.actor("automation-lab/beehiiv-newsletter-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 = {
    "startUrls": [{ "url": "https://www.therundown.ai" }],
    "maxPostsPerPublication": 3,
    "maxItems": 3,
    "includeHtml": False,
    "includeOutboundLinks": True,
}

# Run the Actor and wait for it to finish
run = client.actor("automation-lab/beehiiv-newsletter-scraper").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "startUrls": [
    {
      "url": "https://www.therundown.ai"
    }
  ],
  "maxPostsPerPublication": 3,
  "maxItems": 3,
  "includeHtml": false,
  "includeOutboundLinks": true
}' |
apify call automation-lab/beehiiv-newsletter-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=automation-lab/beehiiv-newsletter-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Beehiiv Newsletter Scraper",
        "description": "Extract public Beehiiv posts with article text, metadata, authors, dates, images, tags, and outbound links. Supports custom domains, filters, API runs, and scheduled monitoring without a Beehiiv API key.",
        "version": "0.1",
        "x-build-id": "8IsKgxGiB3yLdSCH0"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/automation-lab~beehiiv-newsletter-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-automation-lab-beehiiv-newsletter-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/automation-lab~beehiiv-newsletter-scraper/runs": {
            "post": {
                "operationId": "runs-sync-automation-lab-beehiiv-newsletter-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/automation-lab~beehiiv-newsletter-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-automation-lab-beehiiv-newsletter-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "startUrls"
                ],
                "properties": {
                    "startUrls": {
                        "title": "Publication or post URLs",
                        "type": "array",
                        "description": "Add one or more public Beehiiv-powered URLs. Custom publication domains are supported.",
                        "items": {
                            "type": "object",
                            "required": [
                                "url"
                            ],
                            "properties": {
                                "url": {
                                    "type": "string",
                                    "title": "URL of a web page",
                                    "format": "uri"
                                }
                            }
                        }
                    },
                    "maxPostsPerPublication": {
                        "title": "Posts per publication",
                        "minimum": 1,
                        "maximum": 1000,
                        "type": "integer",
                        "description": "Set the maximum number of newest sitemap posts fetched from each publication.",
                        "default": 10
                    },
                    "maxItems": {
                        "title": "Total post limit",
                        "minimum": 1,
                        "maximum": 10000,
                        "type": "integer",
                        "description": "Stop after this many matching posts have been saved across all publications.",
                        "default": 50
                    },
                    "publishedAfter": {
                        "title": "Published after",
                        "type": "string",
                        "description": "Keep posts published on or after this ISO date. Leave empty for no lower bound."
                    },
                    "publishedBefore": {
                        "title": "Published before",
                        "type": "string",
                        "description": "Keep posts published on or before this ISO date. Leave empty for no upper bound."
                    },
                    "keywords": {
                        "title": "Keywords",
                        "type": "array",
                        "description": "Keep posts whose title, subtitle, or accessible body contains any keyword (case-insensitive).",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "includeHtml": {
                        "title": "Include article HTML",
                        "type": "boolean",
                        "description": "Add cleaned public article HTML to each free-post record. Text is included automatically.",
                        "default": false
                    },
                    "includeOutboundLinks": {
                        "title": "Include outbound links",
                        "type": "boolean",
                        "description": "Extract unique external HTTP links from each accessible post body.",
                        "default": true
                    },
                    "proxyConfiguration": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Optionally retry protected custom domains through Apify Proxy.",
                        "default": {
                            "useApifyProxy": false
                        }
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
