# Reddit Scraper - Markdown for AI & n8n (`clearpath/reddit-to-llm-api`) Actor

Extract Reddit posts and comments as LLM-ready Markdown. No API key needed. Direct n8n/Make integration—connect output to AI nodes instantly. 20x faster than browser scrapers. Perfect for lead gen, product validation, and market research workflows.

- **URL**: https://apify.com/clearpath/reddit-to-llm-api.md
- **Developed by:** [ClearPath](https://apify.com/clearpath) (community)
- **Categories:** Agents, Automation, AI
- **Features:** Limited permissions
- **Stats:** 40 total users, 0 monthly users, 88.9% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.80 / 1,000 post scrapeds

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

Learn more: https://docs.apify.com/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

## 🔥 Reddit Scraper for LLM & RAG | Posts, Comments & Images (2026)

[![REDDIT THREADS. READY FOR YOUR AI. POSTS. REPLIES. SOURCE LINKS.](https://api.apify.com/v2/key-value-stores/pJ7iaZsTFhR3k9tjV/records/reddit-to-llm-api-readme-hero-v1.png)](https://console.apify.com/actors/l4upHwD1mhF3MdvgX/input)

Built by <strong>Clearpath</strong>, with <strong>150,000+ combined lifetime runs</strong> across <a href="https://apify.com/clearpath/reddit-search-scraper">Reddit Search</a>, <a href="https://apify.com/clearpath/reddit-post-comments-bulk-scraper">Post & Comments</a> and <a href="https://apify.com/clearpath/reddit-subreddit-posts-scraper">Subreddit Posts</a>. A specialist suite for Reddit research.

### Why choose this actor?

<strong>Give your AI the discussion, with its context.</strong> Get post text and collected replies as readable Markdown, with authors, scores, dates, reply nesting and a link to the original thread. Use it for product research, feedback analysis or your own knowledge base.

<strong>Keep the structured data too.</strong> Each post includes JSON alongside Markdown, with comments and subreddit details such as member counts and descriptions. Enable image downloads when your research also needs visual content.

<strong>Collect more comments at the same per-post price.</strong> Posts with comments are billed per post, not per reply. Choose how many comments to collect; optional image downloads are charged separately.

<a href="https://console.apify.com/actors/l4upHwD1mhF3MdvgX/input"><img src="https://api.apify.com/v2/key-value-stores/pJ7iaZsTFhR3k9tjV/records/reddit-to-llm-api-readme-cta-v1.svg" width="240" height="48" alt="Get AI-ready threads"/></a>

### Quick start

Try three popular posts from r/SaaS, with up to 50 comments per post.

```json
{
  "mode": "subreddit_feed",
  "subreddits": [
    "SaaS"
  ],
  "subredditSort": "top",
  "subredditTimeFilter": "week",
  "subredditLimit": 3,
  "includeComments": true,
  "commentsLimit": 50,
  "scrapeImages": false
}
```

<a href="https://console.apify.com/actors/l4upHwD1mhF3MdvgX/input">Open actor input</a> to choose your communities, search keywords or specific post URLs. Each result contains a <code>markdown</code> field plus structured JSON for your workflow.

Available comments and replies depend on the thread and your settings. Free-tier accounts have a cumulative allowance of 5,000 comments. Image downloads are optional and billed separately.

#### Copy to your AI assistant

Copy this block into ChatGPT, Claude, Cursor, or any LLM to start using this actor.

```
clearpath/reddit-to-llm-api on Apify. Call: ApifyClient("TOKEN").actor("clearpath/reddit-to-llm-api").call(run_input={...}), then client.dataset(run["defaultDatasetId"]).list_items().items for results. Key inputs: mode (string: "subreddit"|"search"|"post"), subreddits (array), searchKeywords (array). Full actor spec (input schema with all params/enums/defaults, output dataset fields, README): GET https://api.apify.com/v2/acts/clearpath~reddit-to-llm-api/builds/default (Bearer TOKEN) → inputSchema, actorDefinition.storages.dataset, readme. Pricing: pay-per-event, $0.001/post, $0.003/post with comments, $0.0005/image. Get token: https://console.apify.com/account/integrations
```

### Why This Actor?

Most Reddit scrapers give you raw JSON that needs heavy transformation before LLMs can use it. This Actor outputs **pre-formatted Markdown** alongside structured JSON. Feed it directly to an AI node without writing a single line of code.

#### Perfect for n8n Workflows

**Lead Generation from Pain Points**

```
reddit-to-llm (search: "looking for", "need help with")
  → LLM qualify leads
  → CRM/Email sequence
```

Find people actively seeking solutions you provide.

**Product Validation Pipeline**

```
Webhook (new idea)
  → reddit-to-llm (search related subreddits)
  → LLM analyze: demand signals, objections, existing solutions
  → Structured report
```

Before building, validate if people actually want it. The markdown format lets LLMs deeply analyze threaded discussions.

***

### ⚡ Key Features

#### Lightning Fast Extraction

- **Parallel processing** - Process multiple posts simultaneously
- **Automatic deduplication** - No duplicate posts across modes

#### 🎯 Three Collection Modes

- **Search** - Global or subreddit-restricted keyword search
- **Subreddit Feeds** - Hot, new, top, rising posts
- **Direct URLs** - Scrape specific posts by URL

#### 🤖 LLM-Ready Output

- **Markdown field** - Formatted for direct AI consumption
- **Flat comments with depth** - Easy to process, depth signals conviction
- **Whole threads** - Replies Reddit tucks behind "load more replies" and "continue this thread" are collected too, each under its parent
- **OP markers** - Know when the author replies

#### 📸 Optional Image Extraction

- Preview images, galleries, direct links (i.redd.it, imgur)
- Stored to Apify Key-Value Store with public URLs
- Ready for vision models (GPT-4V, Claude)

***

### 💰 Pricing (Pay Per Event)

Transparent, predictable pricing. Only pay for what you extract.

| Event | Price |
|-------|-------|
| Post scraped (without comments) | $0.001 |
| Post scraped (with comments) | $0.003 |
| Image scraped | $0.0005 |

**Flat rate per post** - Whether a post has 1 comment or 500 comments, the price is the same ($0.003).

**Fair on partial results** - If a post's comments can't be fully loaded, you still get the comments that loaded and pay the without-comments price; images are charged only when they are saved. A thread too large for one dataset item (several thousand comments) is delivered with as many comments as fit and is also charged the without-comments price. The run's status message says what could not be loaded.

#### Cost Examples

| Scenario | Posts | Comments? | Images | Total Cost |
|----------|-------|-----------|--------|------------|
| Posts only | 100 | No | 0 | **$0.10** |
| Posts + comments | 100 | Yes (any count) | 0 | **$0.30** |
| Deep dive | 500 | Yes (any count) | 0 | **$1.50** |
| With images | 100 | Yes | 500 | **$0.55** |

**Cost optimization tips:**

- Set `includeComments: false` if you only need post titles/content (3x cheaper)
- Comment count doesn't affect price - get as many as you need!
- Filter by subreddit to avoid irrelevant posts

***

### Input Configuration

#### Search Mode

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `searchKeywords` | string\[] | `[]` | Keywords to search (joined with spaces) |
| `searchInSubreddits` | string\[] | `[]` | Limit search to specific subreddits |
| `searchSort` | enum | `relevance` | `relevance`, `new`, `top`, `comments` |
| `searchLimit` | integer | `25` | Max posts (1-1000) |

#### Subreddit Feed Mode

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `subreddits` | string\[] | `["indiehackers"]` | Subreddits to scrape |
| `subredditSort` | enum | `hot` | `hot`, `new`, `top`, `rising` |
| `subredditTimeFilter` | enum | - | For `top`: `hour`, `day`, `week`, `month`, `year`, `all` |
| `subredditLimit` | integer | `25` | Max posts per subreddit (1-1000) |

#### Direct URLs Mode

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `postUrls` | string\[] | `[]` | Reddit post URLs or redd.it short links |

#### Output Settings

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `includeComments` | boolean | `true` | Fetch comments for each post |
| `commentsLimit` | integer | `500` | Max comments per post, replies included (0 = all, max 50,000) |
| `scrapeImages` | boolean | `false` | Extract and store images |

***

### Output Schema

Each dataset item is one Reddit post and carries **every field Reddit exposes for that post** (media, image previews, galleries, awards, full flair, crosspost data, content and moderation flags) plus a full subreddit profile, the comment thread, and the LLM-ready Markdown. The example below is trimmed for readability; large nested objects (`preview`, `media`, `all_awardings`) are shown abbreviated.

```json
{
  "id": "1prkwnx",
  "title": "Product Developer (15y SaaS/Apps) seeking Marketing/Sales co-builder",
  "author": "ManuelWenner",
  "author_fullname": "t2_8xk2p",
  "created_utc": "2025-12-20T18:18:21+00:00",
  "created_utc_epoch": 1766254701,
  "permalink": "/r/indiehackers/comments/1prkwnx/product_developer_15y_saasapps_seeking/",
  "url": "https://www.reddit.com/r/indiehackers/comments/1prkwnx/...",
  "domain": "self.indiehackers",
  "selftext": "Hey folks,\n\nI've been building digital products for ~15 years...",
  "score": 2,
  "ups": 2,
  "upvote_ratio": 0.75,
  "num_comments": 8,
  "num_crossposts": 0,
  "view_count": null,
  "subreddit": "indiehackers",
  "subreddit_id": "t5_3i9si",
  "subreddit_subscribers": 140617,
  "is_self": true,
  "is_video": false,
  "over_18": false,
  "spoiler": false,
  "stickied": false,
  "locked": false,
  "archived": false,
  "edited": false,
  "gilded": 0,
  "total_awards_received": 0,
  "all_awardings": [],
  "distinguished": null,
  "post_hint": null,
  "thumbnail": "self",
  "link_flair_text": "General Question",
  "link_flair_background_color": "#0079d3",
  "is_nsfw": false,
  "is_spoiler": false,
  "media": null,
  "preview": { "images": [ { "source": { "url": "https://preview.redd.it/...", "width": 1200, "height": 630 }, "resolutions": ["..."] } ] },
  "subreddit_details": {
    "id": "3i9si",
    "fullname": "t5_3i9si",
    "name": "indiehackers",
    "display_name_prefixed": "r/indiehackers",
    "title": "Independent developers building their own way",
    "description": "IndieHackers is a subreddit focused on people who bootstrap their way to success.",
    "sidebar_description": "# Welcome\n\nFull community rules and resources...",
    "subscribers": 140617,
    "active_users": null,
    "created_utc": "2016-09-26T12:05:56+00:00",
    "over_18": false,
    "subreddit_type": "public",
    "lang": "en",
    "icon_img": "https://b.thumbs.redditmedia.com/....png",
    "community_icon": "https://styles.redditmedia.com/....png",
    "banner_background_image": "https://styles.redditmedia.com/....jpg",
    "primary_color": "#0079d3",
    "key_color": "#222222",
    "submission_type": "any",
    "allow_images": true,
    "allow_videos": true,
    "allow_galleries": true,
    "spoilers_enabled": true,
    "wiki_enabled": true,
    "url": "https://www.reddit.com/r/indiehackers/"
  },
  "comments": [
    {
      "id": "nv30qrn",
      "body": "How do people find Matchplan?",
      "author": "scarfwizard",
      "author_id": "t2_5h2k9",
      "author_flair": "Bootstrapper",
      "author_type": "USER",
      "score": 1,
      "depth": 0,
      "child_count": 1,
      "created_utc": "2025-12-20T20:02:18+00:00",
      "edited_at": null,
      "parent_id": "t3_1prkwnx",
      "permalink": "/r/indiehackers/comments/1prkwnx/.../nv30qrn/",
      "is_submitter": false,
      "distinguished": null,
      "is_stickied": false,
      "language_code": "en"
    },
    {
      "id": "nv33n4g",
      "body": "Currently I'm in such an early stage...",
      "author": "ManuelWenner",
      "score": 1,
      "depth": 1,
      "parent_id": "t1_nv30qrn",
      "is_submitter": true
    }
  ],
  "images": [],
  "comments_complete": true,
  "comments_incomplete_reason": null,
  "markdown": "# Product Developer seeking Marketing/Sales co-builder\n\n**2 upvotes** | 8 comments | u/ManuelWenner | 2025-12-20\n\nHey folks...\n\n---\n\n## Comments\n\n**[1] u/scarfwizard** How do people find Matchplan?\n> **[1] u/ManuelWenner (OP)** Currently I'm in such an early stage...\n"
}
```

#### Output Fields

**Post data:** every field the post exposes, including identity (`id`, `title`, `author`, `author_fullname`, `permalink`, `url`, `domain`), content (`selftext`, `is_self`, `is_video`, `media`, `preview`, gallery data, `thumbnail`, `post_hint`), engagement (`score`, `ups`, `upvote_ratio`, `num_comments`, `num_crossposts`, `view_count`, `gilded`, `total_awards_received`, `all_awardings`), state (`edited`, `stickied`, `pinned`, `locked`, `archived`, `distinguished`, `over_18`, `spoiler`, `removed_by_category`), flair (`link_flair_text` + color/css/type), and subreddit context (`subreddit`, `subreddit_id`, `subreddit_subscribers`). Timestamps come as both ISO (`created_utc`) and epoch (`created_utc_epoch`).

**subreddit_details:** full subreddit profile: descriptions, subscriber count, icons and banners, theme colors, content policy (`submission_type`, `allow_images`/`allow_videos`/`allow_galleries`/`allow_polls`, `spoilers_enabled`, `wiki_enabled`), and timestamps.

**Comments:** flat list in thread order (each comment followed by its replies, collapsed reply threads included), with text, author (`author`, `author_id`, `author_flair`, `author_type`), `score`, `depth` (0 = top-level), `child_count`, timestamps (`created_utc`, `edited_at`), `parent_id`, `permalink`, `is_submitter` (marks OP replies), plus `distinguished`, `is_stickied`/`is_locked`/`is_removed`, `removed_by_category`, and `language_code`.

**Comment completeness:** `comments_complete` is `true` when the post carries every comment Reddit shows for it, `false` when it does not, and `null` when comments were not requested. When it is `false`, `comments_incomplete_reason` says why: `comment_limit` (the post has more comments than your `commentsLimit`; still charged as a post with comments), `dataset_item_size` (more comments than fit in one dataset item), `free_tier_allowance` (cut to the free plan's comment allowance), `run_time_limit` (the run's time limit stopped the reading) or `not_fully_loaded` (some comments could not be loaded; run again to get them).

**Markdown:** Pre-formatted for LLM consumption with nested blockquotes for replies.

***

### Example Inputs

#### Search Mode (Global)

```json
{
  "searchKeywords": ["indiehacker", "pain points"],
  "searchSort": "relevance",
  "searchLimit": 50,
  "includeComments": true,
  "commentsLimit": 100
}
```

#### Subreddit Feed

```json
{
  "subreddits": ["indiehackers", "SaaS", "startups"],
  "subredditSort": "top",
  "subredditTimeFilter": "week",
  "subredditLimit": 100
}
```

#### Direct URLs

```json
{
  "postUrls": [
    "https://www.reddit.com/r/indiehackers/comments/abc123/...",
    "https://redd.it/xyz789"
  ],
  "includeComments": true,
  "commentsLimit": 500
}
```

#### Combined (All Modes)

```json
{
  "searchKeywords": ["product feedback"],
  "subreddits": ["SaaS"],
  "postUrls": ["https://redd.it/abc123"],
  "includeComments": true,
  "commentsLimit": 100
}
```

***

### Use Cases

#### For Product Teams

- **Voice of Customer** - Extract feature requests and complaints from product subreddits
- **Competitor Intelligence** - Monitor what users say about alternatives
- **Product Validation** - Search for demand signals before building

#### For Marketers

- **Content Research** - Find top-performing topics in your niche
- **Lead Generation** - Identify users seeking solutions you provide
- **Brand Monitoring** - Track mentions and sentiment

#### For Researchers

- **Qualitative Analysis** - Reddit comments as interview transcripts
- **Trend Detection** - Early signals from rising posts
- **Sentiment Analysis** - Community reactions with depth context

***

### Limitations

- **Size limits**: Max 1,000 posts per mode and 50,000 comments per post. A post with more comments than fit in one dataset item (several thousand) keeps as many as fit
- **Comment structure**: Flat list with `depth` field (not nested JSON tree)
- **Images**: Common sources supported (preview, i.redd.it, imgur, galleries). Videos not downloaded.
- **Reliability**: Temporary issues are handled automatically

***

### FAQ

**Q: Do I need a Reddit account or API key?**
A: No. The Actor extracts publicly available data without authentication.

**Q: How fast is it?**
A: Very fast. 100 posts with comments typically complete in under 60 seconds.

**Q: Why is the markdown field useful?**
A: LLMs process it directly without transformation. Perfect for n8n/Make workflows where you connect Actor output → AI node.

**Q: Can I scrape private subreddits?**
A: No. Only public subreddits and posts are accessible.

**Q: What if a post is deleted?**
A: The Actor returns `null` and continues with other posts.

**Q: How do I reduce costs?**
A: Set `includeComments: false` if you only need posts (3x cheaper: $0.001 vs $0.003). Comment count doesn't affect price, so no need to limit `commentsLimit` for cost reasons. Use it only to reduce processing time.

***

### More Clearpath scrapers for Reddit

**🔍 Search & discovery**

- <img src="https://apify-image-uploads-prod.s3.us-east-1.amazonaws.com/DSvMCAwsufMyZeLyt-actor-5LOwKe4dIDEJ64I58-RDxgtg9AKM-reddit-profile-scraper-logo.png" width="16" height="16" style="vertical-align:middle;border-radius:3px"> **[Reddit Search Scraper](https://apify.com/clearpath/reddit-search-scraper)**<br><span style="color:#78716C;font-size:13px">Keyword search across all of Reddit</span>
- <img src="https://apify-image-uploads-prod.s3.us-east-1.amazonaws.com/DSvMCAwsufMyZeLyt-actor-9SchRh78ZcQprr5V8-D4wuc5kLga-reddit-user-posts-comments-scraper-logo.png" width="16" height="16" style="vertical-align:middle;border-radius:3px"> **[Reddit Subreddit Posts Scraper](https://apify.com/clearpath/reddit-subreddit-posts-scraper)**<br><span style="color:#78716C;font-size:13px">Full subreddit feeds: hot, new, top, rising</span>

**💬 Threads & comments**

- <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="16" height="16" style="vertical-align:middle;border-radius:3px"> **[Reddit Post Comments Scraper](https://apify.com/clearpath/reddit-post-comments-bulk-scraper)**<br><span style="color:#78716C;font-size:13px">Full comment trees and nested replies from any post URL</span>

**👤 Users**

- <img src="https://apify-image-uploads-prod.s3.us-east-1.amazonaws.com/DSvMCAwsufMyZeLyt-actor-LA9VzVDphD8rUCFnW-fLjTXd3OC3-reddit-profile-scraper-logo.png" width="16" height="16" style="vertical-align:middle;border-radius:3px"> **[Reddit Profile Scraper](https://apify.com/clearpath/reddit-profile-scraper)**<br><span style="color:#78716C;font-size:13px">Bulk username, karma, and account lookup</span>
- <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="16" height="16" style="vertical-align:middle;border-radius:3px"> **[Reddit User Posts & Comments Scraper](https://apify.com/clearpath/reddit-user-content-scraper)**<br><span style="color:#78716C;font-size:13px">A single user's full post and comment history</span>

**🤖 AI & LLM tools**

- <img src="https://apify-image-uploads-prod.s3.us-east-1.amazonaws.com/DSvMCAwsufMyZeLyt-actor-nckWiP0hDfAhfSqIP-a7kh9CcAjF-reddit-to-llm-logo.png" width="16" height="16" style="vertical-align:middle;border-radius:3px"> **[Reddit MCP Server](https://apify.com/clearpath/reddit-mcp)**<br><span style="color:#78716C;font-size:13px">Live Reddit search inside your AI assistant</span>
- <img src="https://apify-image-uploads-prod.s3.us-east-1.amazonaws.com/DSvMCAwsufMyZeLyt-actor-38FIguxJePXqDBE5m-PhAqWQIZBb-reddit-answers-api-logo.png" width="16" height="16" style="vertical-align:middle;border-radius:3px"> **[Reddit Answers API](https://apify.com/clearpath/reddit-answers-api)**<br><span style="color:#78716C;font-size:13px">Reddit's AI answer engine for any question</span>

### Support

- 📧 **Email**: max@mapa.slmail.me
- 🐛 **Bugs**: Use the Issues tab
- 💡 **Feature requests**: Email or Issues

***

### Legal

This Actor extracts publicly available Reddit data. Users are responsible for compliance with Reddit's Terms of Service and applicable data protection regulations (GDPR, CCPA).

***

[🚀 **Start Extracting Reddit Data Now**](https://console.apify.com/actors/l4upHwD1mhF3MdvgX)

*Turn Reddit discussions into AI-ready insights in minutes, not hours.*

# Actor input Schema

## `mode` (type: `string`):

Pick one mode. Each mode works differently - read the descriptions above to choose. Only fill in the fields for your selected mode.

## `subreddits` (type: `array`):

FOR BROWSE MODE: Enter the subreddits you want to get posts from. We'll grab the hot/new/top posts from each one. You can enter them in any format - we'll figure it out. Examples: 'Python' or '/r/Python' or 'https://reddit.com/r/Python' all work.

## `subredditSort` (type: `string`):

Choose which posts to get: 'hot' = trending now, 'new' = newest first, 'top' = highest voted, 'rising' = getting popular fast

## `subredditTimeFilter` (type: `string`):

If you selected 'top' above, choose the time range. For example, 'week' gets the top posts from the last 7 days. Ignored if you didn't select 'top'.

## `subredditLimit` (type: `integer`):

Maximum posts to get from each subreddit. For example, if you enter 3 subreddits and set this to 50, you'll get up to 150 posts total (50 from each).

## `searchKeywords` (type: `array`):

FOR SEARCH MODE: Enter words or phrases. Posts must contain ALL keywords you enter (AND logic). Examples: Enter 'API' + 'problem' to find posts about API problems. Or enter 'pain point' + 'SaaS' to find SaaS pain points.

## `restrictToSubreddits` (type: `array`):

Leave empty to search ALL of Reddit. Or enter specific subreddits to only search within them. Example: To find pain points, enter 'SaaS' + 'startups' to search only in r/SaaS and r/startups. Same format as above - 'Python' or '/r/Python' or URLs all work.

## `searchSort` (type: `string`):

Choose how to order search results: 'relevance' = best matches first, 'new' = newest first, 'top' = highest voted, 'comments' = most discussed

## `searchLimit` (type: `integer`):

Maximum number of posts to return from the search. Example: Set to 100 to get the top 100 matching posts.

## `urls` (type: `array`):

FOR SCRAPE URLs MODE: Paste the full URLs of Reddit posts you want to scrape. Get these by copying the URL from your browser when viewing a post. Example: 'https://reddit.com/r/Python/comments/abc123/my_post_title/'

## `includeComments` (type: `boolean`):

Check this to scrape comments on each post. Uncheck to only get the post itself (faster but less info).

## `commentsLimit` (type: `integer`):

Maximum comments to get for each post, replies included (also the replies Reddit tucks behind "load more replies"). Set to 0 for every comment Reddit shows. Higher numbers = longer scraping time.

## `scrapeImages` (type: `boolean`):

Check this to extract and store images from posts (like uploaded images, galleries). Warning: This will use more storage space.

## Actor input object example

```json
{
  "mode": "subreddit_feed",
  "subreddits": [
    "indiehackers"
  ],
  "subredditSort": "hot",
  "subredditLimit": 25,
  "searchKeywords": [],
  "restrictToSubreddits": [],
  "searchSort": "relevance",
  "searchLimit": 25,
  "urls": [],
  "includeComments": true,
  "commentsLimit": 500,
  "scrapeImages": 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 = {
    "subreddits": [
        "indiehackers"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("clearpath/reddit-to-llm-api").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 = { "subreddits": ["indiehackers"] }

# Run the Actor and wait for it to finish
run = client.actor("clearpath/reddit-to-llm-api").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 '{
  "subreddits": [
    "indiehackers"
  ]
}' |
apify call clearpath/reddit-to-llm-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,clearpath/reddit-to-llm-api"
        }
    }
}
```

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/l4upHwD1mhF3MdvgX/builds/T1c8X5wuMpr3daXQP/openapi.json
