# Substack Public Publication Posts Scraper (`w3crawler/substack-newsletter-scraper`) Actor

Collect public newsletter posts from supplied Substack publication roots.

- **URL**: https://apify.com/w3crawler/substack-newsletter-scraper.md
- **Developed by:** [w3crawler](https://apify.com/w3crawler) (community)
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.99 / 1,000 newsletter posts

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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 Public Publication Posts Scraper

Collect public posts from one or more Substack publication roots. The Actor opens each HTTPS root in Playwright and reads the publication's same-origin public `/api/v1/posts` response, so records come from Substack's public publication API rather than page-layout selectors. Each row keeps the public post identity, title, excerpt, byline and publication metadata, engagement counts, body-availability state, and provenance.

### What it does

For each supplied publication root, the Actor makes a browser-based, same-origin request to the public `/api/v1/posts` endpoint, follows its cursor for additional pages, and writes one dataset row per unique public post. No login, subscriber session, or paywall bypass is used. Optional public body HTML is converted to plain text only when `includeBodyText` is enabled; restricted posts keep metadata and an excerpt with an explicit body-availability state.

### Get started

1. Open the [Actor Store page](https://apify.com/w3crawler/substack-newsletter-scraper) and select **Try for free** or open the **Input** tab.
2. Add one or more publication roots to `publicationUrls`, such as `https://www.lennysnewsletter.com/`. Each entry must be an origin with an optional trailing slash, not a post or archive URL.
3. Set `maxItems` and `maxPostsPerPublication`. Enable `includeBodyText` only when you need public body text converted to plain text.
4. Start the Actor, open the dataset, and export the saved records as JSON, CSV, or Excel. Open **Run summary** (`OUTPUT`) to check the outcome and body-availability counts.

### Input

`publicationUrls` is required; the other fields are optional and use the defaults below. Unsupported field names and out-of-range values are rejected before requests start.

| Field | Type | Required? | Default | Meaning |
| --- | --- | --- | --- | --- |
| `publicationUrls` | object array | Required | Not supplied | One to 50 HTTPS publication roots. Each item is `{ "url": "https://example.substack.com/" }`; only an origin and optional trailing slash are accepted. |
| `maxItems` | integer | Optional | `50` | Global cap on unique posts saved across all publications, from 1 to 200. |
| `maxPostsPerPublication` | integer | Optional | `50` | Per-publication cap on posts read from the public posts response, from 1 to 200. |
| `includeBodyText` | boolean | Optional | `false` | Convert public `body_html` to capped plain text when the public response exposes it. |
| `proxyConfiguration` | object | Optional | `{"useApifyProxy":false}` | Optional standard Apify Proxy configuration for the Playwright request. |

Default input for the optional fields:

```json
{
  "maxItems": 50,
  "maxPostsPerPublication": 50,
  "includeBodyText": false,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

`publicationUrls` has no default; supply at least one root before running.

The Actor reads public data from Substack. Optional `proxyConfiguration` uses the standard Apify Proxy settings. Requests are made through a browser session so the same-origin `/api/v1/posts` response can be read; no login, cookie, or subscriber session is used.

### Output

The dataset contains one row per unique public post. Optional information appears only when the public response publishes it; missing values are omitted rather than inferred. No diagnostic or placeholder rows are written.

| Field | Type | Availability | Meaning |
| --- | --- | --- | --- |
| `recordId` | string | Always | Deterministic row ID built from the public post ID and a short hash. |
| `recordType` | string enum | Always | Row discriminator; always `substackPost`. |
| `postId` | string | Always | Public Substack post ID. |
| `title` | string | Always | Public post title. |
| `subtitle` | string | When published | Public post subtitle. |
| `description` | string | When published | Public post description from the posts response. |
| `excerpt` | string | When published | Public excerpt or truncated body preview. |
| `bodyText` | string | When `includeBodyText` is enabled and the body is public | Plain text converted from public `body_html`, capped in length. |
| `bodyRequested` | boolean | Always | Whether the run requested public body extraction; `true` in normal runs. |
| `bodyAvailability` | string enum | Always | Body state: `extracted`, `not_requested`, `restricted`, or `unavailable`. |
| `contentCompleteness` | string enum | Always | Content level in the row: `body_text`, `excerpt_only`, or `metadata_only`. |
| `bodyAccessReason` | string enum | Always | Bounded reason for the body state, such as `public_body_extracted`, `subscriber_only_or_paywalled`, or `public_api_did_not_return_body`. |
| `slug` | string | When published | Public post slug. |
| `canonicalUrl` | string | Always | Canonical public post URL. Rows without one are skipped. |
| `publishedAt` | string | When published | Public post publication time in ISO UTC. |
| `updatedAt` | string | When published | Public post update time in ISO UTC. |
| `publicationId` | string | When published | Public publication ID. |
| `publicationName` | string | When published | Public publication display name. |
| `publicationSubdomain` | string | When published | Substack subdomain when the publication has one. |
| `customDomain` | string | When published | Custom publication domain when one is configured. |
| `publicationUrl` | string | Always | Public publication homepage URL derived from the custom domain, subdomain, or supplied root. |
| `publicationResolvedUrl` | string | Always | HTTPS publication root reached by the browser. |
| `publicationHeroText` | string | When published | Public publication hero text. |
| `publicationLogo` | string | When published | Public publication logo URL. |
| `publicationWideLogo` | string | When published | Public wide-logo URL. |
| `publicationLanguage` | string | When published | Publication language when the public response exposes it. |
| `authorId` | string | When published | Public byline identifier. |
| `authorName` | string | When published | Public byline name. |
| `authorHandle` | string | When published | Public byline handle. |
| `authorPhoto` | string | When published | Public author photo URL. |
| `authorBio` | string | When published | Public author biography. |
| `postType` | string | When published | Public post type, such as `newsletter`. |
| `audience` | string | When published | Public audience classification, such as `only_paid`. |
| `wordCount` | number | When published | Public word-count metadata; it is not evidence that the body was extracted. |
| `reactionCount` | number | When published | Public reaction count. |
| `commentCount` | number | When published | Public comment count. |
| `restacks` | number | When published | Public restack count. |
| `coverImage` | string | When published | Public cover image URL. |
| `language` | string | When published | Public post language. |
| `tags` | string array | When published | Public post tag names. |
| `podcastUrl` | string | When published | Public podcast URL when the post has one. |
| `podcastDuration` | number | When published | Public podcast duration metadata. |
| `audioItems` | object array | When published | Public audio metadata such as `type`, `status`, `audioUrl`, and `voiceId`. |
| `source` | string | Always | Stable public source identifier; `public_substack_posts_api`. |
| `provenance` | string | Always | Extraction lineage identifier for the public posts contract. |
| `sourceUrl` | string | Always | Publication root used for the public posts request. |
| `extractionMethod` | string | Always | Bounded transport and parser label; `substack_posts_api_v1` in normal runs. |
| `position` | integer | Always | One-based output position across collected posts. |
| `scrapedAt` | string | Always | Time the row was written, in ISO UTC. |

The example below is a complete saved row from the 2026-09-09 run. The post was paid-only, so the row contains an excerpt but no `bodyText`; the run requested body text with `includeBodyText: true`.

```json
{
  "recordId": "substack_newsletter_post_212023427_182d4283a6cc",
  "recordType": "substackPost",
  "postId": "212023427",
  "title": "How to figure out your next career move",
  "subtitle": "Six essential questions to help you navigate change",
  "description": "Six essential questions to help you navigate change",
  "excerpt": "👋 Hey there, I’m Lenny. Each week, I share deeply researched product, growth, and career advice. For more: Lenny’s Jobs | Lenny’s Podcast | Lennybot | How I AI | Become an AI-Native Builder and my other favorite AI/PM courses",
  "bodyRequested": true,
  "bodyAvailability": "restricted",
  "contentCompleteness": "excerpt_only",
  "bodyAccessReason": "subscriber_only_or_paywalled",
  "slug": "how-to-figure-out-your-next-career",
  "canonicalUrl": "https://www.lennysnewsletter.com/p/how-to-figure-out-your-next-career",
  "publishedAt": "2026-08-25T13:04:15.691Z",
  "updatedAt": "2026-08-25T13:13:54.310Z",
  "publicationId": "10845",
  "publicationUrl": "https://www.lennysnewsletter.com/",
  "publicationResolvedUrl": "https://www.lennysnewsletter.com/",
  "authorId": "409162791",
  "authorName": "Cliff Maxwell",
  "authorHandle": "cliffmaxwell1",
  "authorPhoto": "https://substack-post-media.s3.amazonaws.com/public/images/6427c4c5-c7ec-406f-b15f-b287cb631355_1904x1904.jpeg",
  "authorBio": "CEO of Vocation, an AI-powered career coach built on a decade of research at Harvard. Former Chief of Staff to Clay Christensen.",
  "postType": "newsletter",
  "audience": "only_paid",
  "wordCount": 4860,
  "reactionCount": 457,
  "commentCount": 1,
  "restacks": 24,
  "coverImage": "https://substack-post-media.s3.amazonaws.com/public/images/1a88a225-3e0f-4c00-b34f-3bdcabd91bb3_1456x970.png",
  "language": "en",
  "tags": [
    "Career"
  ],
  "audioItems": [
    {
      "type": "tts",
      "status": "paywalled",
      "voiceId": "en-US-AlloyTurboMultilingualNeural"
    }
  ],
  "source": "public_substack_posts_api",
  "provenance": "public_publication_api_v2_posts_body_contract",
  "sourceUrl": "https://www.lennysnewsletter.com/",
  "extractionMethod": "substack_posts_api_v1",
  "position": 2,
  "scrapedAt": "2026-09-09T06:11:17.159Z"
}
```

### Run summary

**Run summary** is stored separately from the dataset in the run's key-value store under `OUTPUT`. It records the counts and body-state distributions; diagnostic details stay in the Actor log.

| Field | Meaning |
| --- | --- |
| `recordType` | Summary artifact discriminator; `substack_newsletter_run_summary`. |
| `status` | Run outcome. The archived example records `success`; current builds write `SUCCEEDED` or `FAILED` in the same field. |
| `dataAvailable` | Whether at least one normal post row was written. |
| `sourceUrl` | First supplied publication root. |
| `requestUrl` | Publication root requested for the public posts response. |
| `requestedPublicationCount` | Number of validated publication roots in the run. |
| `requestedMaxItems` | Global post limit requested. |
| `requestedMaxPostsPerPublication` | Per-publication post limit requested. |
| `includeBodyText` | Whether public body-text conversion was requested. |
| `itemsEmitted` | Number of normal post rows written. |
| `itemCount` | Compatibility count equal to `itemsEmitted`. |
| `diagnosticCount` | Number of operational issues logged for the run. |
| `duplicateCount` | Duplicate public post IDs skipped across publication roots. |
| `failureCount` | Publication or summary-write failures recorded. |
| `failedPublicationUrls` | Publication roots that failed, when any. |
| `bodyAvailabilityCounts` | Counts for each `bodyAvailability` value. |
| `contentCompletenessCounts` | Counts for each `contentCompleteness` value. |
| `bodyAccessReasonCounts` | Counts for each bounded `bodyAccessReason` value. |
| `filters` | Validated publication roots, limits, body setting, and whether proxy was used. |
| `source` | Public source identifier. |
| `provenance` | Extraction lineage identifier. |
| `completedAt` | Time the summary was written, in ISO UTC. |

| Status | Meaning |
| --- | --- |
| `SUCCEEDED` | Current builds: the run completed and at least one post row was written, or the source completed cleanly with no results. The archived example records the older lowercase `success`. |
| `FAILED` | A fatal error occurred before any usable post row was written. |

Current builds also write `runStatus`, `dataStatus`, and `outputWriteFailureCount`; the archived example below predates those fields.

Example `OUTPUT` from the saved run:

```json
{
  "recordType": "substack_newsletter_run_summary",
  "status": "success",
  "dataAvailable": true,
  "sourceUrl": "https://www.lennysnewsletter.com/",
  "requestUrl": "https://www.lennysnewsletter.com/",
  "requestedPublicationCount": 1,
  "requestedMaxItems": 2,
  "requestedMaxPostsPerPublication": 2,
  "includeBodyText": true,
  "itemsEmitted": 2,
  "itemCount": 2,
  "diagnosticCount": 0,
  "duplicateCount": 0,
  "failureCount": 0,
  "failedPublicationUrls": [],
  "bodyAvailabilityCounts": {
    "extracted": 0,
    "not_requested": 0,
    "restricted": 2,
    "unavailable": 0
  },
  "contentCompletenessCounts": {
    "body_text": 0,
    "excerpt_only": 2,
    "metadata_only": 0
  },
  "bodyAccessReasonCounts": {
    "public_body_extracted": 0,
    "body_extraction_not_requested": 0,
    "geoblocked": 0,
    "free_unlock_required": 0,
    "subscriber_only_or_paywalled": 2,
    "unpublished": 0,
    "public_api_did_not_return_body": 0
  },
  "filters": {
    "publicationUrls": [
      "https://www.lennysnewsletter.com/"
    ],
    "maxItems": 2,
    "maxPostsPerPublication": 2,
    "includeBodyText": true,
    "proxyUsed": false
  },
  "source": "public_substack_posts_api",
  "provenance": "public_publication_api_v2_posts_body_contract",
  "completedAt": "2026-09-09T06:11:17.325Z"
}
```

### Storage

Dataset rows are public post records only; no diagnostic or placeholder rows are written. The **Run summary** (`OUTPUT`) and `SOURCE_METADATA` are stored as separate records in the run's default key-value store. `OUTPUT` holds counts, limits, filters, and status, while `SOURCE_METADATA` discloses the public endpoints, transport, and access-boundary flags. Failure details stay in the Actor log.

### Coverage and limitations

The Actor reads public data from Substack. It does not log in, bypass paywalls, or guarantee a post body. Paid-only, geoblocked, unpublished, or otherwise restricted posts can produce metadata or an excerpt with `bodyAvailability: "restricted"` and no `bodyText`. A public `body_html` value is converted only when `includeBodyText` is enabled; a word count in the public response is not proof that body text was extracted.

Only publication roots are accepted, and each root must resolve to the same-origin public posts response. Posts without a title or canonical URL are skipped. `maxPostsPerPublication` limits what is read per root and `maxItems` caps the combined output. Optional fields are omitted when Substack does not publish them; values are not inferred. Source availability can change, and blocked, empty, or partial responses are counted in `OUTPUT` rather than written as data rows.

### Usage and support

Use the [Actor Issues page](https://apify.com/w3crawler/substack-newsletter-scraper/issues) to report a problem. Include the run ID, the input used, and the `OUTPUT` summary; do not include tokens, cookies, or private data. This Actor is not affiliated with Substack. Use it only for public data and in accordance with the source's terms, robots guidance, and applicable law. Public posts can contain personal information; do not use the output for unauthorized profiling or contact.

### Runtime and cost

Cost depends on Apify compute, one browser-based request per supplied publication root, and the number of posts processed. Start with one root and small limits, inspect the dataset and `OUTPUT`, then scale. See the Actor's Pricing tab for current account rates.

### FAQ

**Why does a row have no `bodyText`?** Public body HTML is converted only when `includeBodyText` is enabled and the public response exposes it. Paid-only, geoblocked, unpublished, or otherwise restricted posts can produce metadata or an excerpt with `bodyAvailability: "restricted"` and no body text. A word count in the public response is not proof that a body was extracted.

**What URLs are accepted?** Only HTTPS publication roots (origin and optional trailing slash), not individual post or archive URLs. Roots that fail to resolve to the public posts response are counted in `OUTPUT` rather than written as data rows.

### Local validation

Run `npm test` for contract checks, `npm run lint` for syntax checks, `npm run validate` for dataset/schema validation after a local run, and `npx apify validate-schema` for Actor schema validation. Use small limits and a dedicated local storage directory so validation runs stay isolated.

### Disclaimer

This Actor is not affiliated with Substack. It reads only public data, does not log in, bypass paywalls, or solve access challenges. Use it in accordance with the source's terms, robots guidance, and applicable law. Do not use output for unauthorized profiling or contact.

# Changelog

This Actor's version history is a separate document: https://apify.com/w3crawler/substack-newsletter-scraper/changelog.md

# Actor input Schema

## `publicationUrls` (type: `array`):

One or more HTTPS publication root URLs. Each URL must contain only the origin and an optional trailing slash.

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

Maximum posts from 1 to 200.

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

Maximum posts per publication from 1 to 200.

## `includeBodyText` (type: `boolean`):

Convert public HTML post bodies to capped plain text.

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

Optional Apify proxy configuration.

## Actor input object example

```json
{
  "maxItems": 50,
  "maxPostsPerPublication": 50,
  "includeBodyText": false,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `dataset` (type: `string`):

Dataset API URL containing post records, diagnostic records, and the run summary.

## `runSummary` (type: `string`):

Key-value record with counts, limits, failures, and run status.

## `sourceMetadata` (type: `string`):

Public source, transport, proxy use, and access-boundary disclosures.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("w3crawler/substack-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 = {}

# Run the Actor and wait for it to finish
run = client.actor("w3crawler/substack-newsletter-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 '{}' |
apify call w3crawler/substack-newsletter-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,w3crawler/substack-newsletter-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/y7HvDNewsWreeWy0N/builds/Y8KqK4LqQVEtbKRzN/openapi.json
