# Newsletter to Markdown (Substack, Ghost, beehiiv) (`vellumlabs/newsletter-to-markdown`) Actor

Export Substack, Ghost and beehiiv newsletter archives as clean Markdown with YAML front matter: title, authors, date, tags, paywall flag, word count. Built for LLM wikis, RAG and research. Only public content; paywalled posts return the free preview. Pay per post.

- **URL**: https://apify.com/vellumlabs/newsletter-to-markdown.md
- **Developed by:** [Vellum Kasane](https://apify.com/vellumlabs) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 full-text posts

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## Newsletter to Markdown (Substack, Ghost, beehiiv)

Export a **Substack, Ghost or beehiiv newsletter archive as clean, LLM-ready Markdown**. Give the Actor a newsletter URL (custom domains work) and it returns one record per post: title, subtitle, authors, publish date, tags, paywall flag, word count, and the **post body as GitHub-flavoured Markdown**, plus a ready-to-save `.md` file with **YAML front matter**. Useful for RAG, LLM wikis, Obsidian vaults, research and competitive monitoring.

**Price: $0.002 per full-text post**, $0.0005 per metadata-only / paywalled post, $0.005 per run. 1,000 free posts cost about $2.

Example output (one item, shortened):

```json
{
    "platform": "substack",
    "publication_name": "Simon Willison’s Newsletter",
    "url": "https://simonw.substack.com/p/conceptual-integrity-and-counting",
    "title": "Conceptual integrity and counting lines of code",
    "subtitle": "Plus Bun 1.4 and the latest on Anthropic’s revenue",
    "authors": ["Simon Willison"],
    "published": "2026-08-23T20:57:32.675Z",
    "tags": ["anthropic", "llms", "ai"],
    "audience": "free",
    "paywalled": false,
    "word_count": 3116,
    "content_markdown": "In this newsletter:\n\n- Conceptual integrity and counting lines of code\n...",
    "markdown_file": "---\ntitle: \"Conceptual integrity and counting lines of code\"\n...\n---\n\n# Conceptual integrity ...",
    "full_text": true
}
```

### What does Newsletter to Markdown do?

- **One Actor, three platforms.** The platform is detected from the home page (Substack, Ghost, beehiiv), including publications on their own domain. Anything else falls back to the site's `sitemap.xml` or RSS feed.
- **The whole archive, not just the feed.** RSS feeds usually hold the last 10–20 posts. This Actor lists posts from the **Substack archive API** and from **sitemaps** on Ghost and beehiiv, newest first, so you can export hundreds of posts in one run.
- **Clean Markdown.** Post bodies are converted with headings, lists, links, images, code blocks and tables kept; subscribe boxes, share bars and footers are removed.
- **Front matter included.** `markdown_file` is a complete Markdown document (title, publication, authors, dates, tags, paywall flag, content hash) you can save straight into an Obsidian vault, a Claude Code / LLM wiki `raw/` folder or a vector index.
- **Honest about paywalls.** Only public content is exported. Paid posts are flagged `paywalled: true` and contain the free preview, billed at the cheaper metadata price.
- **New posts only, on a schedule.** Set a **State key** and scheduled runs return only posts not exported before.

### Who is it for

- **RAG and LLM pipelines** that need newsletter posts as clean text with reliable metadata.
- **Researchers and analysts** following industry newsletters (AI, product, finance, policy) who want a searchable local archive.
- **Knowledge-base builders** pushing new posts into Obsidian, Notion or a Claude Code wiki every week (n8n, Make, Zapier via Apify integrations).
- **AI agents** using the [Apify MCP server](https://mcp.apify.com): call the Actor with a newsletter URL and read the Markdown from the dataset.

### How to export a newsletter to Markdown

1. Paste one or more newsletter URLs into **Newsletter URLs** (e.g. `https://simonw.substack.com`, `https://www.platformer.news`, `https://www.superhuman.ai`).
2. Set **Max posts per newsletter** (5 for a quick test, 500+ for a full archive).
3. Optional: **Only posts from the last N days**, and a **State key** for scheduled runs.
4. Click **Start**. Download the dataset as JSON, CSV, Excel or HTML, or use the **Markdown files** view.

### Input

| Field                    | Type     | Default  | Notes                                                                           |
| ------------------------ | -------- | -------- | ------------------------------------------------------------------------------- |
| `publications`           | string\[] | required | Newsletter home page URLs. Custom domains and bare hosts are accepted.          |
| `maxPostsPerPublication` | integer  | 50       | Newest posts kept per newsletter after filtering and dedupe. Caps cost.         |
| `fetchContent`           | boolean  | `true`   | Convert post bodies to Markdown. Off = metadata only (cheaper event).           |
| `sinceDays`              | integer  | 0        | `0` = no date filter.                                                           |
| `platform`               | string   | `auto`   | Force `substack`, `ghost`, `beehiiv` or `other` if auto-detection is wrong.     |
| `stateKey`               | string   | `""`     | Named key-value store that remembers exported posts between runs.               |
| `respectRobotsTxt`       | boolean  | `true`   | Skip URLs disallowed by the newsletter's robots.txt.                            |
| `maxConcurrency`         | integer  | 3        | Parallel page requests (Substack API calls are limited to 2 in parallel).       |
| `proxyConfiguration`     | object   | no proxy | Enable Apify Proxy only if a site blocks you.                                   |

Example input:

```json
{
    "publications": ["https://simonw.substack.com", "https://www.platformer.news", "https://www.superhuman.ai"],
    "maxPostsPerPublication": 5
}
```

### Output

One dataset item per post. Main fields:

| Field                                   | Description                                                                 |
| --------------------------------------- | --------------------------------------------------------------------------- |
| `platform`                              | `substack`, `ghost`, `beehiiv` or `other`                                   |
| `publication_name`, `publication_url`   | Newsletter name and origin                                                  |
| `url`, `slug`, `title`, `subtitle`      | Post identity                                                               |
| `authors`, `published`, `updated`, `tags` | Metadata (Substack: bylines and post tags; Ghost/beehiiv: page meta tags) |
| `audience`, `paywalled`                 | `free` / `paid` / `unknown`, and whether only the preview was available     |
| `content_markdown`, `word_count`        | Post body as Markdown                                                       |
| `markdown_file`                         | Front matter + title + body, ready to save as `<slug>.md`                   |
| `content_hash`, `url_hash`              | SHA-256 for change detection and dedupe                                     |
| `likes`, `comments`                     | Substack reaction and comment counts                                        |
| `full_text`                             | True when the full public body was exported (billed as `post-full-text`)    |
| `extraction_error`                      | Why the body could not be exported, if anything went wrong                  |

A run summary (posts per newsletter, detected platform, source used, skipped posts) is saved as `SUMMARY.json` in the key-value store.

### How much does it cost to export a newsletter?

Pay per event, no subscription:

| Event            | Price   | When                                                                      |
| ---------------- | ------- | ------------------------------------------------------------------------- |
| Actor start      | $0.005  | Once per run                                                              |
| `post-full-text` | $0.002  | A free post exported with its full body as Markdown                       |
| `post-metadata`  | $0.0005 | Metadata only (`fetchContent` off), or a paywalled post's public preview  |

Examples: 50 recent posts from one newsletter ≈ $0.105; a 1,000-post archive ≈ $2.005. Posts skipped by the date filter or the state key are never charged. Set a maximum cost per run in the run options and the Actor stops cleanly when it is reached.

### Tips

- **Weekly digest:** schedule the Actor with `sinceDays: 8` and a `stateKey`, then send the dataset to Slack, Notion or your wiki with an Apify integration.
- **Full archive:** set `maxPostsPerPublication` to the archive size. Substack is paged through its archive API; Ghost and beehiiv use the sitemap, sorted by last modification.
- **Only the metadata** (for a list of posts and dates): turn off `fetchContent`.
- **Save files:** use the `markdown_file` field and the `slug` as the file name.

### Limits and fair use

- Only **public** content is exported. The Actor does not log in and does not bypass paywalls; paid posts return the preview the publisher shows to everyone.
- robots.txt is respected by default and requests are rate-limited (Substack API: 2 in parallel with a short pause).
- Newsletter posts are copyrighted by their authors. Use the output for personal research, analysis and indexing, and check the publisher's terms before republishing.
- Substack custom domains that hide their platform markers can be forced with `platform: "substack"`.

### Verified

Tested on 2026-09-23 with the example input: 15 posts (Substack 5, Ghost 5, beehiiv 5), 0 failures, about 10 seconds. Paywalled Ghost posts were flagged and billed as metadata.

### Changelog

- 0.1 (2026-09-23): first release — Substack archive API, Ghost and beehiiv sitemaps, RSS fallback, paywall flag, front matter, dedupe across runs.

### Support

Found a newsletter that does not export correctly? Open an issue in the **Issues** tab with the URL; we reply within one business day. Need a custom export (other platforms, scheduled delivery)? Mention it in the issue.

# Actor input Schema

## `publications` (type: `array`):

Home page URLs of the newsletters, e.g. `https://simonw.substack.com`, `https://www.platformer.news`, `https://www.superhuman.ai`. Custom domains work. Bare hosts are accepted.

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

Newest posts kept per newsletter after date filtering and deduplication. Each stored post is one billing event, so this caps your cost.

## `fetchContent` (type: `boolean`):

Convert each post body to Markdown (`post-full-text` event for free posts). When off, only metadata is stored (`post-metadata` event).

## `sinceDays` (type: `integer`):

`0` = no date filter.

## `platform` (type: `string`):

Leave on auto-detect unless detection picks the wrong platform for a custom domain.

## `stateKey` (type: `string`):

Name of a key-value store used to remember exported post URLs, e.g. `newsletters-weekly`. With a state key, scheduled runs return only posts not seen before.

## `respectRobotsTxt` (type: `boolean`):

Skip URLs disallowed by the newsletter's robots.txt.

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

Parallel page requests (Substack API calls are limited to 2 in parallel).

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

Most newsletters need no proxy; enable Apify Proxy only if you get blocked.

## Actor input object example

```json
{
  "publications": [
    "https://simonw.substack.com",
    "https://www.platformer.news",
    "https://www.superhuman.ai"
  ],
  "maxPostsPerPublication": 5,
  "fetchContent": true,
  "sinceDays": 0,
  "platform": "auto",
  "stateKey": "",
  "respectRobotsTxt": true,
  "maxConcurrency": 3,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

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

No description

## `summary` (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 = {
    "publications": [
        "https://simonw.substack.com",
        "https://www.platformer.news",
        "https://www.superhuman.ai"
    ],
    "maxPostsPerPublication": 5
};

// Run the Actor and wait for it to finish
const run = await client.actor("vellumlabs/newsletter-to-markdown").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 = {
    "publications": [
        "https://simonw.substack.com",
        "https://www.platformer.news",
        "https://www.superhuman.ai",
    ],
    "maxPostsPerPublication": 5,
}

# Run the Actor and wait for it to finish
run = client.actor("vellumlabs/newsletter-to-markdown").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 '{
  "publications": [
    "https://simonw.substack.com",
    "https://www.platformer.news",
    "https://www.superhuman.ai"
  ],
  "maxPostsPerPublication": 5
}' |
apify call vellumlabs/newsletter-to-markdown --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,vellumlabs/newsletter-to-markdown"
        }
    }
}
```

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/a9VK3IgFMFSaEH89s/builds/fi3sa57NhthWKaU4o/openapi.json
