# Reddit Post Comments Scraper | Bulk Thread & Reply Export (`clearpath/reddit-post-comments-bulk-scraper`) Actor

Scrape Reddit posts with full comment trees. 6 sort orders, Q\&A filtering, and deep sub-thread expansion. Bulk URLs, CSV upload, any format.

- **URL**: https://apify.com/clearpath/reddit-post-comments-bulk-scraper.md
- **Developed by:** [ClearPath](https://apify.com/clearpath) (community)
- **Categories:** Social media, Automation, Lead generation
- **Stats:** 2 total users, 2 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.99 / 1,000 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/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

## Reddit Post & Comments Scraper | Bulk Thread Export (2026)

<blockquote style="border-left:4px solid #FF4500;background:#FFF5F2;padding:12px 16px">
<span style="font-size:16px;font-weight:700;color:#1C1917">10,000 comments in under 2 minutes</span> <span style="font-size:15px;color:#57534E">— full comment tree expansion, 6 sort orders, bulk processing.</span>
</blockquote>

Paste one post URL or upload thousands. Get back every comment, including deeply nested reply chains, sorted exactly how you need them.

<table style="width:100%">
<tr>
<td colspan="4" style="padding:10px 14px;background:#006D77;border:none;border-radius:4px 4px 0 0">
<span style="color:#FAFAF9;font-size:14px;font-weight:700;letter-spacing:0.5px">Clearpath Reddit Suite</span>
<span style="color:#EDF6F9;font-size:13px">&nbsp;&nbsp;&bull;&nbsp;&nbsp;Search, analyze, and monitor Reddit at scale</span>
</td>
</tr>
<tr>
<td style="padding:12px 16px;border:1px solid #E7E5E4;border-radius:0 0 0 4px;background:#EDF6F9;border-right:none;border-top:none;vertical-align:top;width:25%">
<img src="https://apify-image-uploads-prod.s3.us-east-1.amazonaws.com/DSvMCAwsufMyZeLyt-actor-AcNroNEs63pztgCy6-BEG4cWB3Re-reddit-user-posts-comments-scraper-logo.png" width="24" height="24" style="vertical-align:middle"> &nbsp;<a href="https://apify.com/clearpath/reddit-post-comments-bulk-scraper" style="color:#006D77;text-decoration:none;font-weight:700;font-size:14px">Post & Comments</a><br>
<span style="color:#006D77;font-size:12px;font-weight:600">&#10148; You are here</span>
</td>
<td style="padding:12px 16px;border:1px solid #E7E5E4;border-right:none;border-top:none;vertical-align:top;width:25%">
<img src="https://apify-image-uploads-prod.s3.us-east-1.amazonaws.com/DSvMCAwsufMyZeLyt-actor-LA9VzVDphD8rUCFnW-fLjTXd3OC3-reddit-profile-scraper-logo.png" width="24" height="24" style="vertical-align:middle"> &nbsp;<a href="https://apify.com/clearpath/reddit-profile-scraper" style="color:#1C1917;text-decoration:none;font-weight:700;font-size:14px">Profile Scraper</a><br>
<span style="color:#78716C;font-size:12px">Bulk profile & karma lookup</span>
</td>
<td style="padding:12px 16px;border:1px solid #E7E5E4;border-right:none;border-top:none;vertical-align:top;width:25%">
<img src="https://apify-image-uploads-prod.s3.us-east-1.amazonaws.com/DSvMCAwsufMyZeLyt-actor-REPQBdd4quAa6q7RN-exwLn5TkWz-reddit-user-posts-comments-scraper-logo.png" width="24" height="24" style="vertical-align:middle"> &nbsp;<a href="https://apify.com/clearpath/reddit-user-content-scraper" style="color:#1C1917;text-decoration:none;font-weight:700;font-size:14px">User Content</a><br>
<span style="color:#78716C;font-size:12px">Posts & comments history</span>
</td>
<td style="padding:12px 16px;border:1px solid #E7E5E4;border-radius:0 0 4px 0;border-top:none;vertical-align:top;width:25%">
<img src="https://apify-image-uploads-prod.s3.us-east-1.amazonaws.com/DSvMCAwsufMyZeLyt-actor-38FIguxJePXqDBE5m-PhAqWQIZBb-reddit-answers-api-logo.png" width="24" height="24" style="vertical-align:middle"> &nbsp;<a href="https://apify.com/clearpath/reddit-answers-api" style="color:#1C1917;text-decoration:none;font-weight:700;font-size:14px">Answers API</a><br>
<span style="color:#78716C;font-size:12px">Reddit answers for LLMs</span>
</td>
</tr>
</table>

#### Copy to your AI assistant

Copy this block into ChatGPT, Claude, Cursor, or any LLM to start building with this data.

````

Reddit Post & Comments Scraper (clearpath/reddit-post-comments-bulk-scraper) on Apify scrapes Reddit posts with full comment trees in bulk. Processes multiple posts concurrently. Returns structured data: post metadata (title, subreddit, comment count) plus every comment with author, score, timestamp, depth, parent ID, body text, flair, stickied/locked status, and child count. Supports 6 sort orders: best, top, new, old, controversial, Q\&A. Q\&A/AMA filtering: answered-by-OP only, or unanswered only. Optional deep expansion recursively opens all collapsed reply chains to capture every comment in a thread. Input: single post URL, array of URLs, or uploaded CSV/TXT file. Accepts any format: full URL, short link (redd.it/abc123), or post ID. Max comments per post configurable (default 200, 0 for unlimited). Output: JSON array, one object per post/comment. Pricing: $2.99 per 1,000 posts + $1.00 per 1,000 comments (PPE). Free tier: 5 lifetime runs, 50 comments per run. Apify token required.

````

### Key Features

- **Fast bulk processing** — processes multiple posts concurrently, so bulk runs finish in minutes instead of hours
- **Full comment tree expansion** — optionally scrape every comment in a thread, including deeply nested reply chains that Reddit collapses behind "load more" links
- **6 sort orders** — best, top, new, old, controversial, Q&A. Each sort order returns a different ranking of the same comments
- **Q&A/AMA filtering** — isolate comments answered by the original poster, or find unanswered questions only. Built for extracting structured knowledge from AMA threads
- **Bulk input, any format** — paste URLs one by one, use bulk edit to paste a list, or upload a CSV/TXT file with thousands of post links. Accepts full URLs, short links, and bare post IDs

### How to Scrape Reddit Post Comments

#### Single post, default settings

Paste any Reddit post URL. The actor fetches the post metadata and up to 200 comments sorted by best.

```json
{
    "postUrl": "https://www.reddit.com/r/AskReddit/comments/1k2vnz0/"
}
````

Short links and bare IDs also work:

```json
{
    "postUrl": "redd.it/1k2vnz0"
}
```

```json
{
    "postUrl": "1k2vnz0"
}
```

You can use any of these formats interchangeably. The actor normalizes all inputs before processing.

#### All comments, sorted by top

Set `maxCommentsPerPost` to `0` and enable `expandAllComments` to get the complete comment tree. Use `sort` to control the ordering.

```json
{
    "postUrl": "https://www.reddit.com/r/SeveranceAppleTVPlus/comments/1k2vnz0/",
    "sort": "top",
    "maxCommentsPerPost": 0,
    "expandAllComments": true
}
```

This configuration captures every single comment in the thread, including replies nested 10+ levels deep that Reddit hides behind "continue this thread" links. Expect longer run times for threads with thousands of comments.

#### Multiple posts in one run

Use the `postUrls` array for small batches. Mix any URL format freely.

```json
{
    "postUrls": [
        "https://www.reddit.com/r/AskReddit/comments/1k2vnz0/",
        "redd.it/abc123",
        "t3_xyz789"
    ],
    "sort": "new",
    "maxCommentsPerPost": 500
}
```

The actor processes posts in parallel, so adding more posts doesn't proportionally increase run time.

#### Bulk from file

Upload a `.txt` or `.csv` file through the Apify Console, or point to a hosted file URL. TXT files expect one URL per line. CSV files auto-detect a `url` or `permalink` column.

```json
{
    "postUrlsFile": "https://example.com/my-post-urls.csv",
    "sort": "best",
    "maxCommentsPerPost": 100
}
```

You can also drag and drop a file directly into the "Post URLs file" field in the Apify Console. This is the fastest way to run large batches without writing any code.

#### Q\&A/AMA thread: only OP answers

Use `sort: "qa"` with `filter: "answered"` to get only comments that the original poster replied to. This turns a sprawling AMA with thousands of comments into a clean, structured Q\&A dataset.

```json
{
    "postUrl": "https://www.reddit.com/r/IAmA/comments/abc123/",
    "sort": "qa",
    "filter": "answered",
    "maxCommentsPerPost": 0,
    "expandAllComments": true
}
```

#### Find unanswered questions

The opposite of the above. Set `filter: "unanswered"` to find questions in a Q\&A thread that the OP never responded to.

```json
{
    "postUrl": "https://www.reddit.com/r/IAmA/comments/abc123/",
    "sort": "qa",
    "filter": "unanswered"
}
```

#### Controversial comments only

Get comments sorted by controversy. Reddit's controversial algorithm surfaces comments with a roughly equal number of upvotes and downvotes.

```json
{
    "postUrl": "https://www.reddit.com/r/politics/comments/abc123/",
    "sort": "controversial",
    "maxCommentsPerPost": 50
}
```

#### Chronological order

Sort by `old` to get comments in the order they were posted. Useful for analyzing how a discussion evolved over time.

```json
{
    "postUrl": "https://www.reddit.com/r/worldnews/comments/abc123/",
    "sort": "old",
    "maxCommentsPerPost": 0,
    "expandAllComments": true
}
```

### Input Parameters

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `postUrl` | string | | A single Reddit post URL, short link (`redd.it/abc`), or post ID |
| `postUrls` | string\[] | `[]` | Multiple post URLs or IDs. Use "Bulk edit" to paste a list |
| `postUrlsFile` | string | | Upload a `.txt`/`.csv` file, or paste a URL to a hosted file |
| `sort` | enum | `best` | Comment sort order: `best`, `top`, `new`, `old`, `controversial`, `qa` |
| `filter` | enum | (all) | Comment filter: all comments, `answered` (OP replies only), `unanswered` |
| `maxCommentsPerPost` | integer | `200` | Max comments to scrape per post. Set to `0` for unlimited |
| `expandAllComments` | boolean | `false` | Recursively expand every collapsed reply chain. Slower but captures the full tree |

At least one of `postUrl`, `postUrls`, or `postUrlsFile` is required.

#### Sort order reference

| Value | Behavior |
|-------|----------|
| `best` | Reddit's default. Confidence-weighted ranking that balances score and vote count |
| `top` | Highest score first (upvotes minus downvotes) |
| `new` | Most recent comments first |
| `old` | Oldest comments first (chronological) |
| `controversial` | Comments with roughly equal upvotes and downvotes |
| `qa` | Prioritizes comments from the original poster. Combine with `filter` for Q\&A extraction |

### What Data Can You Extract from Reddit Posts?

![Output Example](https://iili.io/BxSdwtS.gif)

The output contains two row types: **post** rows and **comment** rows. Each post URL you provide produces one post row followed by its comment rows. The `_post_id` field links comments back to their parent post, so you can easily group and filter results when scraping multiple posts.

#### Post row

One post row per URL, containing the thread metadata:

```json
{
    "_type": "post",
    "_post_id": "t3_1k2vnz0",
    "_status": "found",
    "title": "Mark and Helly's relationship is kinda strange",
    "subreddit": "SeveranceAppleTVPlus",
    "commentCount": 227
}
```

#### Comment row (top-level)

Top-level comments have `depth: 0` and `parentId: null`. These are direct replies to the post.

```json
{
    "_type": "comment",
    "_post_id": "t3_1k2vnz0",
    "_status": "found",
    "id": "t1_mnx5qs6",
    "author": "leninzen",
    "score": 1202,
    "createdAt": "2025-04-19T13:03:54.022000+0000",
    "editedAt": null,
    "depth": 0,
    "parentId": null,
    "permalink": "/r/SeveranceAppleTVPlus/comments/1k2vnz0/.../mnx5qs6/",
    "body": "You do see it slowly build tbh. Especially after Mark's response to Helly's hanging attempt...",
    "isStickied": false,
    "isLocked": false,
    "isScoreHidden": false,
    "distinguishedAs": null,
    "authorFlair": null,
    "isDeleted": false,
    "childCount": 11
}
```

#### Comment row (nested reply)

Replies have `depth > 0` and a `parentId` pointing to the comment they're replying to. You can reconstruct the full thread tree from these two fields.

```json
{
    "_type": "comment",
    "_post_id": "t3_1k2vnz0",
    "_status": "found",
    "id": "t1_mnxbiet",
    "author": "Lanky_Perception_136",
    "score": 408,
    "createdAt": "2025-04-19T13:42:11.000000+0000",
    "editedAt": null,
    "depth": 1,
    "parentId": "t1_mnx5qs6",
    "permalink": "/r/SeveranceAppleTVPlus/comments/1k2vnz0/.../mnxbiet/",
    "body": "Like her slight smirk when he tells her he's happy she's here...",
    "isStickied": false,
    "isLocked": false,
    "isScoreHidden": false,
    "distinguishedAs": null,
    "authorFlair": "Mr. Milkshake",
    "isDeleted": false,
    "childCount": 2
}
```

#### Full field reference

**Post fields:**

| Field | Type | Description |
|-------|------|-------------|
| `_type` | string | Always `"post"` |
| `_post_id` | string | Reddit post ID (`t3_` prefixed) |
| `_status` | string | `found`, `not_found`, or `unavailable` |
| `title` | string | Post title text |
| `subreddit` | string | Subreddit name without the `r/` prefix |
| `commentCount` | integer | Total comment count reported by Reddit |

**Comment fields:**

| Field | Type | Description |
|-------|------|-------------|
| `_type` | string | Always `"comment"` |
| `_post_id` | string | Parent post ID (`t3_` prefixed), links this comment to its post |
| `_status` | string | `found`, `not_found`, or `unavailable` |
| `id` | string | Comment ID (`t1_` prefixed) |
| `author` | string | Username of the commenter, or `null` for deleted comments |
| `score` | integer | Upvotes minus downvotes |
| `createdAt` | string | ISO 8601 creation timestamp |
| `editedAt` | string/null | ISO 8601 edit timestamp, or `null` if never edited |
| `depth` | integer | Nesting depth. `0` = top-level reply to the post, `1` = reply to a top-level comment, etc. |
| `parentId` | string/null | Parent comment ID (`t1_` prefixed), or `null` for top-level comments |
| `permalink` | string | Relative URL path to the comment on Reddit |
| `body` | string | Comment text in markdown format |
| `isStickied` | boolean | `true` if pinned by a moderator |
| `isLocked` | boolean | `true` if replies are disabled |
| `isScoreHidden` | boolean | `true` if the score is hidden by subreddit rules (usually for recent comments) |
| `distinguishedAs` | string/null | `"moderator"`, `"admin"`, or `null` for regular users |
| `authorFlair` | string/null | User's flair text in the subreddit, or `null` |
| `isDeleted` | boolean | `true` if the comment was deleted by the author or removed by moderators |
| `childCount` | integer | Number of direct replies to this comment |

### Pricing — Pay Per Event (PPE)

<table>
<tr>
<td style="padding:12px 16px;background:#FFF7ED;border:2px solid #E29578;border-radius:6px">
<span style="font-size:18px;font-weight:700;color:#E29578">$2.99 per 1,000 posts&nbsp;&nbsp;&bull;&nbsp;&nbsp;$1.00 per 1,000 comments</span>
</td>
</tr>
</table>

Charged separately for posts and comments. A run scraping 5 posts with 200 comments each costs ~$1.02.

### Use Cases

**Sentiment analysis.** Scrape comments from product launch posts, company announcements, or brand mentions to analyze public opinion. The `score` field provides a built-in signal for community agreement, and `depth`/`parentId` let you analyze how discussions branch.

**Training data for LLMs.** Extract large volumes of structured discussion data. Comments include the full reply chain hierarchy, so you can build conversation trees for fine-tuning dialogue models. The Q\&A filter is especially useful for extracting clean question-answer pairs from AMA threads.

**Market research.** Monitor how Reddit communities discuss products, services, or trends. Scrape comments from relevant subreddit posts to understand what real users think, what complaints come up repeatedly, and what features people request.

**Academic research.** Study online discourse patterns, community dynamics, or information propagation. The chronological sort (`old`) combined with `depth` and `parentId` lets you reconstruct exactly how conversations developed over time.

**Content curation.** Extract top-rated comments from popular threads to curate highlights, summaries, or "best of" collections. Sort by `top` and set a low `maxCommentsPerPost` to get only the highest-rated responses.

**Competitive intelligence.** Track discussions about competitors, industry news, or market events across multiple subreddits. Upload a CSV of relevant post URLs and scrape them all in one run.

### FAQ

**How many comments can I scrape per post?**
Set `maxCommentsPerPost` to `0` and enable `expandAllComments` to get every comment in a thread. Reddit posts can have tens of thousands of comments. The actor handles all of them, including deeply nested reply chains.

**What does "Expand all sub-threads" actually do?**
Reddit collapses deeply nested reply chains and shows "load more comments" links. When `expandAllComments` is enabled, the actor recursively opens every one of these collapsed chains so you get the complete comment tree. When disabled, you get the comments visible on the default page load, which is faster but incomplete for threads with many replies.

**How fast is it?**
Posts are processed in parallel. A single post with 200 comments finishes in about 3 seconds. Bulk runs with 100 posts at default settings complete in about a minute. Full expansion takes longer proportional to the number of collapsed reply chains.

**What URL formats are accepted?**
Full URLs (`reddit.com/r/sub/comments/abc123/title`), short links (`redd.it/abc123`), bare post IDs (`abc123`), and prefixed IDs (`t3_abc123`). You can mix formats freely in the same run. The actor normalizes everything before processing.

**What happens if a post is deleted or private?**
Deleted, removed, and private posts are included in the output with `"_status": "not_found"` or `"_status": "unavailable"`. You're only charged for posts and comments that were successfully scraped.

**How does the Q\&A filter work?**
Set `sort` to `qa` and `filter` to `answered` to get only comment threads where the original poster replied. Set `filter` to `unanswered` to get threads with no OP response. This works best on AMA threads and support posts where the OP actively responds to questions.

**Can I reconstruct the comment tree from the output?**
Yes. Every comment includes `depth` (0 for top-level, 1 for first reply, etc.) and `parentId` (the ID of the comment it replies to, or `null` for top-level). Walk these two fields to rebuild the full tree structure in any programming language.

**What's the difference between "best" and "top" sort?**
"Top" ranks comments purely by score (upvotes minus downvotes). "Best" uses a confidence-weighted algorithm that accounts for both score and vote count. This means newer comments with fewer but mostly positive votes can rank above older comments with more total votes. "Best" is Reddit's default for good reason: it surfaces quality content that hasn't had time to accumulate raw vote counts.

**How are deleted comments handled?**
Deleted comments appear in the output with `isDeleted: true`, `author: null`, and `body` containing `"[deleted]"` or `"[removed]"`. They're still part of the comment tree and preserve the thread structure. They count toward your comment total and billing.

**Is there a limit on how many posts I can scrape in one run?**
No hard limit. You can process thousands of posts in a single run. The actor scales linearly — doubling the number of posts roughly doubles the run time, not more.

**Can I use this with the Apify API or integrations?**
Yes. Call the actor via the Apify API, schedule recurring runs, or connect it to integrations (webhooks, Zapier, Make, Google Sheets). The output is standard JSON that works with any downstream pipeline.

**What's the output format?**
A flat JSON array. Post rows and comment rows are interleaved: first a post row, then all its comments, then the next post row, and so on. Each row has a `_type` field (`"post"` or `"comment"`) and a `_post_id` field that links comments to their parent post.

### Support

- **Bugs**: Issues tab
- **Features**: Email or issues
- **Email**: max@mapa.slmail.me

### Legal Compliance

Extracts publicly available data. Users must comply with Reddit terms and data protection regulations (GDPR, CCPA).

***

*Bulk Reddit post and comment extraction. Full trees, sorted and filtered, from one URL or thousands.*

# Actor input Schema

## `postUrl` (type: `string`):

A single Reddit post URL, short link, or ID.

## `postUrls` (type: `array`):

Add multiple post URLs or IDs. Use 'Bulk edit' to paste a list, or upload a .txt/.csv file. Any format accepted.

## `postUrlsFile` (type: `string`):

Upload a .txt or .csv file, or paste a URL. TXT: one post URL per line. CSV: auto-detects 'url' or 'permalink' column.

## `sort` (type: `string`):

How to sort comments. 'Best' is Reddit's default ranking.

## `filter` (type: `string`):

Filter for Q\&A/AMA threads. Leave on 'All comments' for normal posts.

## `maxCommentsPerPost` (type: `integer`):

Maximum number of comments to scrape per post. Set to 0 for unlimited.

## `expandAllComments` (type: `boolean`):

When enabled, recursively expands every collapsed reply chain to get all comments. Slower but complete. When disabled, only fetches the top-level comment pages.

## Actor input object example

```json
{
  "postUrl": "https://www.reddit.com/r/AskReddit/comments/1k2vnz0/",
  "postUrls": [],
  "sort": "best",
  "filter": "",
  "maxCommentsPerPost": 200,
  "expandAllComments": false
}
```

# Actor output Schema

## `results` (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 = {
    "postUrl": "https://www.reddit.com/r/AskReddit/comments/1k2vnz0/"
};

// Run the Actor and wait for it to finish
const run = await client.actor("clearpath/reddit-post-comments-bulk-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 = { "postUrl": "https://www.reddit.com/r/AskReddit/comments/1k2vnz0/" }

# Run the Actor and wait for it to finish
run = client.actor("clearpath/reddit-post-comments-bulk-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 '{
  "postUrl": "https://www.reddit.com/r/AskReddit/comments/1k2vnz0/"
}' |
apify call clearpath/reddit-post-comments-bulk-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=clearpath/reddit-post-comments-bulk-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Reddit Post Comments Scraper | Bulk Thread & Reply Export",
        "description": "Scrape Reddit posts with full comment trees. 6 sort orders, Q&A filtering, and deep sub-thread expansion. Bulk URLs, CSV upload, any format.",
        "version": "0.0",
        "x-build-id": "vFaBxmSpF3ltr56Ua"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/clearpath~reddit-post-comments-bulk-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-clearpath-reddit-post-comments-bulk-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/clearpath~reddit-post-comments-bulk-scraper/runs": {
            "post": {
                "operationId": "runs-sync-clearpath-reddit-post-comments-bulk-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/clearpath~reddit-post-comments-bulk-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-clearpath-reddit-post-comments-bulk-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",
                "properties": {
                    "postUrl": {
                        "title": "Post URL or ID",
                        "type": "string",
                        "description": "A single Reddit post URL, short link, or ID."
                    },
                    "postUrls": {
                        "title": "Multiple post URLs or file upload",
                        "type": "array",
                        "description": "Add multiple post URLs or IDs. Use 'Bulk edit' to paste a list, or upload a .txt/.csv file. Any format accepted.",
                        "items": {
                            "type": "string"
                        },
                        "default": []
                    },
                    "postUrlsFile": {
                        "title": "Post URLs file",
                        "type": "string",
                        "description": "Upload a .txt or .csv file, or paste a URL. TXT: one post URL per line. CSV: auto-detects 'url' or 'permalink' column."
                    },
                    "sort": {
                        "title": "Comment sort order",
                        "enum": [
                            "best",
                            "top",
                            "new",
                            "old",
                            "controversial",
                            "qa"
                        ],
                        "type": "string",
                        "description": "How to sort comments. 'Best' is Reddit's default ranking.",
                        "default": "best"
                    },
                    "filter": {
                        "title": "Comment filter",
                        "enum": [
                            "",
                            "answered",
                            "unanswered"
                        ],
                        "type": "string",
                        "description": "Filter for Q&A/AMA threads. Leave on 'All comments' for normal posts.",
                        "default": ""
                    },
                    "maxCommentsPerPost": {
                        "title": "Max comments per post",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Maximum number of comments to scrape per post. Set to 0 for unlimited.",
                        "default": 200
                    },
                    "expandAllComments": {
                        "title": "Expand all sub-threads",
                        "type": "boolean",
                        "description": "When enabled, recursively expands every collapsed reply chain to get all comments. Slower but complete. When disabled, only fetches the top-level comment pages.",
                        "default": 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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
