# Substack Community Chat Scraper (`techiteasy/substack-chat-scraper`) Actor

Scrape posts and comments from a Substack publication's community chat.

- **URL**: https://apify.com/techiteasy/substack-chat-scraper.md
- **Developed by:** [TechiyEasy](https://apify.com/techiteasy) (community)
- **Categories:** Social media
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / 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.

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.md):

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

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.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/platform/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

## Substack Community Chat Scraper

Scrape **posts and comments from a Substack publication's community chat** and get clean, structured JSON — one dataset item per post, with the full comment thread embedded.

Substack "chat" is the conversational feed many publications run (questions, recommendations, discussions). This Actor paginates a publication's chat, pulls each published post, fetches its comments, and returns everything in a predictable schema you can pipe into your own pipeline.

---

### Features

- 📨 **Posts + comments** — every published, non-paywalled post with its embedded comment thread (including threaded replies via `parent_comment_id`).
- 👤 **Author & reaction metadata** — name, handle, bio, role, subscriber tier, plus emoji reaction counts.
- 🔗 **Link previews** — title/description/image for link-type posts.
- 📆 **Date window & limit** — scrape everything or bound by `startDate` / `endDate` / `maxPosts`.
- 🌐 **Apify Proxy support** — route through residential proxies to avoid Cloudflare blocks on datacenter IPs.
- 🧱 **Cloudflare-aware** — uses Chrome TLS/JA3 impersonation so requests look like a real browser.

---

### What you need

#### 1. The publication ID

Open the publication's chat in your browser. The URL looks like:

````

https://substack.com/chat/3643280

````

The number (`3643280`) is the **`publicationId`**.

#### 2. A session cookie (`substack.sid`)

The chat API requires authentication. Sign in to Substack in your browser, open DevTools → Application → Cookies → `substack.com`, and copy the value of the **`substack.sid`** cookie into the `sessionCookie` input. (You can also paste the entire `Cookie:` header string.)

> ⚠️ **Comments are subscriber-gated.** To read a chat's *comments*, the account behind your cookie must be **subscribed** to that publication. If it isn't, the comments endpoint returns **HTTP 402** and posts come back with an empty `comments` list (post bodies still scrape fine).
>
> **Tip:** A **free** subscription is often enough. Subscribe (free) to the publication with the same account, then run the Actor — for many publications the comments unlock immediately. Some publications gate chat comments behind a *paid* subscription; for those you'll need to subscribe at the paid tier.

---

### Input

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `publicationId` | integer | ✅ | Numeric publication id (the number in `https://substack.com/chat/<id>`). |
| `sessionCookie` | string (secret) | ✅ | Your `substack.sid` cookie value, or the full Cookie header. |
| `maxPosts` | integer | — | Max posts to scrape. Omit to scrape all within the date window. |
| `startDate` | string | — | Only posts on/after this date (`YYYY-MM-DD` or ISO-8601). |
| `endDate` | string | — | Only posts on/before this date (`YYYY-MM-DD` or ISO-8601). |
| `proxyConfiguration` | object | — | Apify Proxy settings (residential recommended). |

#### Example input

```json
{
  "publicationId": 3643280,
  "sessionCookie": "s%3A...your-substack.sid...",
  "maxPosts": 50,
  "proxyConfiguration": { "useApifyProxy": true, "apifyProxyGroups": ["RESIDENTIAL"] }
}
````

***

### Output

One dataset item per post. Example:

```json
{
  "id": "0179ee7b-3151-4e87-b3ed-0cdc55bf06dd",
  "publication_id": 3643280,
  "created_at": "2026-05-02T14:30:00+00:00",
  "updated_at": "2026-05-02T15:00:00+00:00",
  "status": "published",
  "type": "text",
  "body": "Where are you going? What cities would you like to DO SEE EAT and DRINK in?",
  "link_url": null,
  "is_paywalled": false,
  "comment_count": 2,
  "reaction_count": 12,
  "reactions": { "🔥": 8, "❤": 4 },
  "audience": "everyone",
  "author": {
    "id": 98765, "name": "DO. SEE. EAT. DRINK.", "handle": "dosee",
    "photo_url": "https://...", "bio": null, "pub_role": "admin",
    "subscriber_tier": null, "is_bestseller": false
  },
  "link_metadata": null,
  "comments": [
    {
      "id": "c-1", "post_id": "0179ee7b-...", "body": "What about Sedona, Arizona?",
      "created_at": "2026-05-02T15:10:00+00:00",
      "author": { "id": 9002, "name": "Q El Crosby", "handle": "qelc" },
      "reactions": {}, "parent_comment_id": null
    }
  ],
  "scraped_at": "2026-05-03T02:00:00+00:00"
}
```

***

### Pricing — pay per event

This Actor uses the **pay-per-event** model:

| Event | When | Price (USD) |
|-------|------|-------------|
| `actor-start` | Once per run | $0.01 |
| `post-scraped` | Per post returned to the dataset | $0.004 |

A 50-post run therefore costs about **$0.01 + 50 × $0.004 = $0.21**. (Final prices are set on the Apify Console at publish time.)

***

### Limitations

- **Comments require a subscription** to the target publication (see above); paywalled chats need a paid subscription.
- Only **published, non-paywalled** posts are returned; deleted/draft and paywalled posts are skipped.
- This is a bounded full scrape — there is no incremental/delta mode.

# Actor input Schema

## `publicationId` (type: `integer`):

Numeric Substack publication id. It is the number in the chat URL: https://substack.com/chat/\<PUBLICATION\_ID>

## `sessionCookie` (type: `string`):

Your `substack.sid` cookie value (or the full Cookie header string). To read comments you must be subscribed (free or paid) to the publication — otherwise the comments endpoint returns HTTP 402 and posts come back without replies.

## `maxPosts` (type: `integer`):

Maximum number of posts to scrape. Leave empty to scrape all posts within the date window.

## `startDate` (type: `string`):

Only scrape posts created on or after this date (YYYY-MM-DD or ISO-8601). Optional.

## `endDate` (type: `string`):

Only scrape posts created on or before this date (YYYY-MM-DD or ISO-8601). Optional.

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

Apify Proxy settings. Residential proxies are recommended because Substack sits behind Cloudflare and may block datacenter IPs.

## Actor input object example

```json
{
  "publicationId": 3643280,
  "maxPosts": 50,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

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

Community chat posts with embedded comments, one item per post.

# 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 = {
    "publicationId": 3643280,
    "maxPosts": 50,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("techiteasy/substack-chat-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 = {
    "publicationId": 3643280,
    "maxPosts": 50,
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("techiteasy/substack-chat-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 '{
  "publicationId": 3643280,
  "maxPosts": 50,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call techiteasy/substack-chat-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Substack Community Chat Scraper",
        "description": "Scrape posts and comments from a Substack publication's community chat.",
        "version": "0.1",
        "x-build-id": "vDzHZnhVnTsrtSTCp"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/techiteasy~substack-chat-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-techiteasy-substack-chat-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/techiteasy~substack-chat-scraper/runs": {
            "post": {
                "operationId": "runs-sync-techiteasy-substack-chat-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/techiteasy~substack-chat-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-techiteasy-substack-chat-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": [
                    "publicationId",
                    "sessionCookie"
                ],
                "properties": {
                    "publicationId": {
                        "title": "Publication ID",
                        "type": "integer",
                        "description": "Numeric Substack publication id. It is the number in the chat URL: https://substack.com/chat/<PUBLICATION_ID>"
                    },
                    "sessionCookie": {
                        "title": "Session cookie (substack.sid)",
                        "type": "string",
                        "description": "Your `substack.sid` cookie value (or the full Cookie header string). To read comments you must be subscribed (free or paid) to the publication — otherwise the comments endpoint returns HTTP 402 and posts come back without replies."
                    },
                    "maxPosts": {
                        "title": "Max posts",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Maximum number of posts to scrape. Leave empty to scrape all posts within the date window."
                    },
                    "startDate": {
                        "title": "Start date",
                        "type": "string",
                        "description": "Only scrape posts created on or after this date (YYYY-MM-DD or ISO-8601). Optional."
                    },
                    "endDate": {
                        "title": "End date",
                        "type": "string",
                        "description": "Only scrape posts created on or before this date (YYYY-MM-DD or ISO-8601). Optional."
                    },
                    "proxyConfiguration": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Apify Proxy settings. Residential proxies are recommended because Substack sits behind Cloudflare and may block datacenter IPs."
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
