# Reddit Scraper — Posts, Comments, Users & Communities (`trakk/reddit-scraper`) Actor

Scrape Reddit at scale without login: posts, comment threads, user profiles, and communities — from URLs, keyword search, or whole subreddits. Sentiment, media downloads, and monitoring included.

- **URL**: https://apify.com/trakk/reddit-scraper.md
- **Developed by:** [DataForge](https://apify.com/trakk) (community)
- **Categories:** Social media, News
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 results

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 web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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/docs.md):

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

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.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/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 Scraper — Posts, Comments, Users & Communities

Turn public Reddit into clean, structured data. Point the Actor at **Reddit URLs, keyword searches, or whole subreddits** and get back rich records for **posts, comment threads, user profiles, and communities** — no Reddit account, no API keys, no login.

Every source flows into one dataset with ready-made views, exportable to **JSON, CSV, Excel, XML, or HTML**, or straight into Google Sheets, Make, Zapier, n8n, or your own app via the API.

---

### ⚡ Quick start (30 seconds)

Paste a subreddit name, press **Start**, done:

```json
{
  "subreddits": ["dataisbeautiful"],
  "sort": "new",
  "maxPostsPerSource": 50
}
````

You get the community details plus its 50 newest posts, each with title, author, score, comments, media, and engagement analytics.

***

### 🔥 What you can collect

| Source | Example input | You get |
|---|---|---|
| 📚 **Subreddits** | `dataisbeautiful` | Community info + posts (Hot / New / Top / Rising / Controversial) |
| 🔎 **Keyword search** | `mechanical keyboards` | Matching **posts, comments, communities, and/or users** |
| 🔗 **Direct URLs** | `reddit.com/r/apple/comments/…` | A post plus its **full comment thread** |
| 👤 **User profiles** | `reddit.com/user/spez` | Profile, karma, and recent posts/comments |

Mix any of them in a single run. Each output row carries a **`dataType`**: `post`, `comment`, `user`, or `community`.

***

### 🚀 Quick start recipes

#### 1️⃣ Newest / top posts from subreddits

```json
{
  "subreddits": ["technology", "gadgets"],
  "sort": "top",
  "time": "week",
  "maxPostsPerSource": 100
}
```

#### 2️⃣ Search Reddit — with comments and sentiment

```json
{
  "searches": ["home espresso"],
  "searchPosts": true,
  "scrapeComments": true,
  "maxCommentsPerPost": 20,
  "sentiment": true,
  "maxItems": 300
}
```

#### 3️⃣ One thread, fully expanded

```json
{
  "startUrls": [{ "url": "https://www.reddit.com/r/AskReddit/comments/abc123/example/" }],
  "scrapeComments": true,
  "maxCommentsPerPost": 500,
  "commentSort": "top"
}
```

#### 4️⃣ A creator's profile and history

```json
{
  "startUrls": [{ "url": "https://www.reddit.com/user/spez/" }],
  "maxPostsPerSource": 100
}
```

#### 5️⃣ Find communities and users about a topic

```json
{
  "searches": ["python"],
  "searchPosts": false,
  "searchCommunities": true,
  "searchUsers": true,
  "maxItems": 100
}
```

#### 6️⃣ Scheduled monitoring — only new posts

```json
{
  "subreddits": ["news"],
  "sort": "new",
  "onlyNewerThan": 1769040000,
  "maxItems": 500
}
```

Set `onlyNewerThan` to your last run's timestamp (or use Apify **Schedules**) to collect only items posted since then.

***

### 🧭 Input reference

#### 🎯 What to scrape

| Field | Description |
|---|---|
| `startUrls` | Reddit URLs — posts, subreddits, users, or search pages. Auto-detected. |
| `searches` | Keywords or phrases. Use quotes for exact phrases. |
| `subreddits` | Subreddit names, `r/name`, or full URLs. |

#### 🔎 Search & sorting

| Field | Description |
|---|---|
| `searchWithinSubreddit` | Limit searches to one subreddit. |
| `searchPosts` / `searchComments` / `searchCommunities` / `searchUsers` | Pick which result types a search returns. |
| `sort` | Relevance · Hot · Top · New · Rising · Comments. |
| `time` | hour · day · week · month · year · all. |
| `includeNSFW` | Include 18+ content (off by default). |

#### 💬 Comments & profiles

| Field | Description |
|---|---|
| `scrapeComments` | For every post found, collect its full comment thread. |
| `maxCommentsPerPost` | Cap on comments per post. |
| `commentSort` | Top · New · Controversial · Old · Q\&A · Best. |
| `skipUserPosts` | Keep a user's profile only (no post/comment history). |
| `skipCommunityInfo` | Skip the community record when scraping a subreddit. |

#### 🗓️ Filters

| Field | Description |
|---|---|
| `postedAfter` / `postedBefore` | Keep posts in a date window (`YYYY-MM-DD`). |
| `commentedAfter` / `commentedBefore` | Same for comments. |
| `onlyWithFlair` | Keep only posts that have a flair. |
| `strictKeywordMatch` | For searches, keep only results containing every keyword. |

#### 📊 Limits & enrichment

| Field | Description |
|---|---|
| `maxItems` | Global cap across everything. `0` = unlimited. |
| `maxPostsPerSource` | Posts per subreddit / search / user. |
| `sentiment` | Add a sentiment score + label to posts and comments. |
| `downloadMedia` | Save post images/videos to storage with permanent links. |
| `downloadAvatars` | Save user avatars to storage with a permanent link. |
| `dedupe` | Save each item once per run (on by default). |
| `onlyNewerThan` | Skip items at/before this Unix timestamp (monitoring). |

> **Mistake-proof:** unknown sorts, out-of-range numbers, or unparseable dates never break a run — they are safely adjusted and noted in the log. An empty input just returns a friendly "add a subreddit, search, or URL" message.

***

### 📤 Output

One dataset, four record types, ready-made views (**Overview · Posts · Comments · Users · Communities**). Stable IDs (`t3_…` for posts, `t1_…` for comments) make dedupe and upserts safe across overlapping runs.

#### 🧾 Example post row

```json
{
  "dataType": "post",
  "id": "t3_1abc234",
  "title": "Modern web frameworks compared [OC]",
  "body": "I benchmarked the top 5 frameworks…",
  "url": "https://www.reddit.com/r/programming/comments/1abc234/…",
  "contentUrl": "https://i.redd.it/xyz.png",
  "postType": "image",
  "flair": "OC",
  "author": "dataforge",
  "subreddit": "programming",
  "subredditSubscribers": 6900000,
  "score": 3421,
  "upVotes": 3421,
  "upvoteRatio": 0.97,
  "numComments": 214,
  "totalAwards": 3,
  "over18": false,
  "imageUrls": ["https://i.redd.it/xyz.png"],
  "hasMedia": true,
  "createdAt": "2026-07-25T14:03:00Z",
  "ageHours": 12.4,
  "scorePerHour": 275.9,
  "commentsPerHour": 17.3,
  "engagementTotal": 3635,
  "isHighEngagement": true,
  "wordCount": 132,
  "sentimentScore": 0.42,
  "sentimentLabel": "positive"
}
```

**Post fields** include identity (`id`, `title`, `body`, `url`, `contentUrl`, `domain`, `postType`, `flair`), author & community (`author`, `authorId`, `subreddit`, `subredditSubscribers`), engagement (`score`, `upVotes`, `upvoteRatio`, `numComments`, `numCrossposts`, `totalAwards`), flags (`over18`, `spoiler`, `locked`, `pinned`, `stickied`, `edited`, `removedByCategory`), media (`imageUrls`, `videoUrls`, `hasMedia`), and analytics (`ageHours`, `scorePerHour`, `commentsPerHour`, `engagementTotal`, `isHighEngagement`, `wordCount`).

#### 💬 Example comment row

```json
{
  "dataType": "comment",
  "id": "t1_kdef567",
  "body": "This matches my experience — great write-up.",
  "url": "https://www.reddit.com/r/programming/comments/1abc234/…/kdef567/",
  "parentId": "t3_1abc234",
  "postId": "t3_1abc234",
  "depth": 0,
  "isSubmitter": false,
  "author": "curious_dev",
  "subreddit": "programming",
  "score": 128,
  "controversiality": 0,
  "postTitle": "Modern web frameworks compared [OC]",
  "createdAt": "2026-07-25T15:10:00Z",
  "scorePerHour": 11.5,
  "wordCount": 8,
  "sentimentLabel": "positive"
}
```

**Comment fields** capture thread structure (`parentId`, `postId`, `depth`, `isSubmitter`), author, engagement (`score`, `controversiality`, `totalAwards`), post context (`postTitle`, `postUrl`), and per-comment analytics.

#### 👤 Example user row

```json
{
  "dataType": "user",
  "username": "spez",
  "url": "https://www.reddit.com/user/spez",
  "description": "How's my driving?",
  "totalKarma": 940207,
  "linkKarma": 152340,
  "commentKarma": 690112,
  "isGold": true,
  "isMod": true,
  "isEmployee": true,
  "verified": true,
  "followersCount": 0,
  "userIcon": "https://styles.redditmedia.com/…/avatar.png",
  "createdAt": "2005-06-06T00:00:00Z"
}
```

**User fields** include the full karma breakdown (`totalKarma`, `linkKarma`, `commentKarma`, `awardeeKarma`, `awarderKarma`), status flags (`isGold`, `isMod`, `isEmployee`, `verified`, `hasVerifiedEmail`), `followersCount`, visuals (`userIcon`, `bannerImg`), and account age.

#### 🏘️ Example community row

```json
{
  "dataType": "community",
  "name": "programming",
  "title": "programming",
  "url": "https://www.reddit.com/r/programming/",
  "description": "Computer programming",
  "membersCount": 6904370,
  "onlineUsersCount": 3120,
  "subredditType": "public",
  "over18": false,
  "rules": [
    { "shortName": "Keep submissions on topic", "kind": "link", "priority": 0 }
  ],
  "allowImages": true,
  "allowVideos": true,
  "communityIcon": "https://styles.redditmedia.com/…/icon.png",
  "createdAt": "2008-01-25T00:00:00Z"
}
```

**Community fields** cover activity (`membersCount`, `onlineUsersCount`), full `rules[]`, posting & content policies (`subredditType`, `submissionType`, `allowImages/Videos/Galleries/Polls`), visuals, and NSFW flag.

***

### ✨ Enrichment & media add-ons

- 🧠 **Sentiment** (`sentiment: true`) — adds `sentimentScore` (−1…1) and `sentimentLabel` (positive / neutral / negative) to posts and comments. Great for filtering and trend tracking at scale.
- 📊 **Engagement analytics** — every post carries `scorePerHour`, `commentsPerHour`, `engagementTotal`, and `isHighEngagement`, so you can spot what's taking off *right now*, not just all-time winners.
- 🖼️ **Permanent media** (`downloadMedia` / `downloadAvatars`) — Reddit's own image/video/avatar URLs expire. Enable these to save copies to storage and get links that keep working (`mediaStorageUrls`, `userIconStorageUrl`).

***

### 🧪 Recipes — what people use it for

- 📈 **Trend & virality tracking** — pull `new` posts hourly and sort by `scorePerHour` to catch rising content early.
- 💬 **Brand & product sentiment** — search your brand across Reddit with `sentiment: true` and analyze positive vs. negative mentions.
- 🧵 **Full-thread research** — scrape a mega-thread with `scrapeComments` and `maxCommentsPerPost: 1000` for complete discussion data.
- 🎯 **Lead & creator discovery** — search users/communities in a niche, then enrich profiles for outreach.
- 🏘️ **Community benchmarking** — compare subreddit size, activity, and rules across competitors.
- 🎓 **Datasets** — build labeled corpora for NLP, recommendation, or academic research.

***

### 💳 Pricing & budget

Pay per result — set **`maxItems`** to cap a run. Reddit's ~1,000-per-listing limit is handled for you, and any failed, private, or filtered source is written to the **Issues** dataset — **never** billed as a result. All-in cost, no surprise add-ons.

***

### ❓ FAQ

**Do I need a Reddit account or API key?**
No. You never sign in, register an app, or supply a key or token — the Actor handles authenticated access to **public** Reddit for you and returns clean data.

**My run returned nothing — why?**
The log always tells you. If items were **filtered**, they were excluded by NSFW/date/flair/keyword rules — enable `includeNSFW` or relax the filters. If there were **issues**, a source was private/removed or Reddit briefly throttled the run; just run it again. Otherwise, double-check the subreddit/user names and search terms. (An empty input never errors — it returns a friendly reminder.)

**How far back can I go?**
Reddit caps each listing at ~1,000 items. For older content, narrow with keywords, a specific subreddit, or date filters.

**Why is a comment body empty?**
Deleted or removed comments have no public text; the row is still returned with all of its metadata.

**Are moderator-only fields available?**
No — fields only mods can see (exact removal reasons, ban details) stay empty for public scraping.

**Can I export to Excel / Google Sheets?**
Yes. Every dataset downloads as JSON, CSV, Excel, XML, or HTML, and integrates with Google Sheets, Make, Zapier, n8n, webhooks, and the Apify API.

**Can I schedule it?**
Yes — pair `onlyNewerThan` with Apify Schedules to collect only fresh items on each run.

***

### 🏷️ Keywords

`reddit scraper` · `reddit api` · `subreddit scraper` · `reddit posts` · `reddit comments` · `reddit user data` · `reddit search` · `social media scraping` · `sentiment analysis` · `community data` · `reddit monitoring` · `no login`

# Actor input Schema

## `startUrls` (type: `array`):

Direct Reddit URLs — posts, subreddits, user profiles, or search pages. Each is auto-detected.

## `searches` (type: `array`):

Keywords or phrases to search across Reddit (use quotes for exact phrases).

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

Subreddits to scrape in full — accepts a name, r/name, or full URL.

## `searchWithinSubreddit` (type: `string`):

Limit keyword searches to one subreddit (name or r/name). Leave empty to search all of Reddit.

## `searchPosts` (type: `boolean`):

Include posts in search results.

## `searchComments` (type: `boolean`):

Include comments in search results.

## `searchCommunities` (type: `boolean`):

Include subreddits in search results.

## `searchUsers` (type: `boolean`):

Include user profiles in search results.

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

Ordering for listings and search.

## `time` (type: `string`):

Time window for Top / Controversial / search results.

## `includeNSFW` (type: `boolean`):

Include adult / over-18 content.

## `scrapeComments` (type: `boolean`):

For every post found, also collect its comment thread (deep, with collapsed replies expanded).

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

Cap on comments collected per post.

## `commentSort` (type: `string`):

Ordering used when collecting a post's comment thread.

## `skipUserPosts` (type: `boolean`):

When scraping a user profile, skip their post/comment history (keep profile only).

## `skipCommunityInfo` (type: `boolean`):

When scraping a subreddit, skip the community info/rules record.

## `postedAfter` (type: `string`):

Keep only posts created on/after this date (YYYY-MM-DD or ISO-8601).

## `postedBefore` (type: `string`):

Keep only posts created on/before this date.

## `commentedAfter` (type: `string`):

Keep only comments created on/after this date.

## `commentedBefore` (type: `string`):

Keep only comments created on/before this date.

## `onlyWithFlair` (type: `boolean`):

Keep only posts that have a link flair.

## `strictKeywordMatch` (type: `boolean`):

For searches, keep only results whose title/body contain every keyword.

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

Global cap across all sources and data types. 0 = unlimited.

## `maxPostsPerSource` (type: `integer`):

Posts pulled per subreddit / search / user (Reddit lists cap near 1000).

## `sentiment` (type: `boolean`):

Add a sentiment score and label to posts and comments.

## `downloadMedia` (type: `boolean`):

Save post images/videos to storage and add permanent links (Reddit media URLs can rotate).

## `downloadAvatars` (type: `boolean`):

Save user avatars to storage and add a permanent link.

## `dedupe` (type: `boolean`):

Save each post/comment/user/community only once per run.

## `onlyNewerThan` (type: `integer`):

Skip items created at/before this Unix timestamp — useful for scheduled monitoring.

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

Defaults to fast, low-cost datacenter proxies. The scraper automatically escalates to residential IPs only if Reddit rate-limits the run.

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

Sources processed at once.

## `maxRetries` (type: `integer`):

Retries for a failed Reddit request.

## `requestTimeoutSecs` (type: `integer`):

Maximum time for one request.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.reddit.com/r/dataisbeautiful/"
    }
  ],
  "searchPosts": true,
  "searchComments": false,
  "searchCommunities": false,
  "searchUsers": false,
  "sort": "new",
  "time": "all",
  "includeNSFW": false,
  "scrapeComments": false,
  "maxCommentsPerPost": 10,
  "commentSort": "top",
  "skipUserPosts": false,
  "skipCommunityInfo": false,
  "onlyWithFlair": false,
  "strictKeywordMatch": false,
  "maxItems": 20,
  "maxPostsPerSource": 20,
  "sentiment": false,
  "downloadMedia": false,
  "downloadAvatars": false,
  "dedupe": true,
  "onlyNewerThan": 0,
  "proxyConfiguration": {
    "useApifyProxy": true
  },
  "maxConcurrency": 8,
  "maxRetries": 5,
  "requestTimeoutSecs": 30
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

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

No description

## `comments` (type: `string`):

No description

## `users` (type: `string`):

No description

## `communities` (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 = {
    "startUrls": [
        {
            "url": "https://www.reddit.com/r/dataisbeautiful/"
        }
    ],
    "maxItems": 20,
    "maxPostsPerSource": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("trakk/reddit-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 = {
    "startUrls": [{ "url": "https://www.reddit.com/r/dataisbeautiful/" }],
    "maxItems": 20,
    "maxPostsPerSource": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("trakk/reddit-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 '{
  "startUrls": [
    {
      "url": "https://www.reddit.com/r/dataisbeautiful/"
    }
  ],
  "maxItems": 20,
  "maxPostsPerSource": 20
}' |
apify call trakk/reddit-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Reddit Scraper — Posts, Comments, Users & Communities",
        "description": "Scrape Reddit at scale without login: posts, comment threads, user profiles, and communities — from URLs, keyword search, or whole subreddits. Sentiment, media downloads, and monitoring included.",
        "version": "1.0",
        "x-build-id": "XjwygyJcAetiq4rmY"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/trakk~reddit-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-trakk-reddit-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/trakk~reddit-scraper/runs": {
            "post": {
                "operationId": "runs-sync-trakk-reddit-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/trakk~reddit-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-trakk-reddit-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": {
                    "startUrls": {
                        "title": "🔗 Reddit URLs",
                        "type": "array",
                        "description": "Direct Reddit URLs — posts, subreddits, user profiles, or search pages. Each is auto-detected.",
                        "items": {
                            "type": "object",
                            "required": [
                                "url"
                            ],
                            "properties": {
                                "url": {
                                    "type": "string",
                                    "title": "URL of a web page",
                                    "format": "uri"
                                }
                            }
                        }
                    },
                    "searches": {
                        "title": "🔎 Search keywords",
                        "type": "array",
                        "description": "Keywords or phrases to search across Reddit (use quotes for exact phrases).",
                        "items": {
                            "type": "string"
                        }
                    },
                    "subreddits": {
                        "title": "📚 Subreddits",
                        "type": "array",
                        "description": "Subreddits to scrape in full — accepts a name, r/name, or full URL.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "searchWithinSubreddit": {
                        "title": "Restrict search to subreddit",
                        "type": "string",
                        "description": "Limit keyword searches to one subreddit (name or r/name). Leave empty to search all of Reddit."
                    },
                    "searchPosts": {
                        "title": "Search posts",
                        "type": "boolean",
                        "description": "Include posts in search results.",
                        "default": true
                    },
                    "searchComments": {
                        "title": "Search comments",
                        "type": "boolean",
                        "description": "Include comments in search results.",
                        "default": false
                    },
                    "searchCommunities": {
                        "title": "Search communities",
                        "type": "boolean",
                        "description": "Include subreddits in search results.",
                        "default": false
                    },
                    "searchUsers": {
                        "title": "Search users",
                        "type": "boolean",
                        "description": "Include user profiles in search results.",
                        "default": false
                    },
                    "sort": {
                        "title": "Sort by",
                        "enum": [
                            "relevance",
                            "hot",
                            "top",
                            "new",
                            "rising",
                            "comments"
                        ],
                        "type": "string",
                        "description": "Ordering for listings and search.",
                        "default": "new"
                    },
                    "time": {
                        "title": "Time range",
                        "enum": [
                            "all",
                            "hour",
                            "day",
                            "week",
                            "month",
                            "year"
                        ],
                        "type": "string",
                        "description": "Time window for Top / Controversial / search results.",
                        "default": "all"
                    },
                    "includeNSFW": {
                        "title": "Include NSFW (18+)",
                        "type": "boolean",
                        "description": "Include adult / over-18 content.",
                        "default": false
                    },
                    "scrapeComments": {
                        "title": "💬 Scrape comment threads",
                        "type": "boolean",
                        "description": "For every post found, also collect its comment thread (deep, with collapsed replies expanded).",
                        "default": false
                    },
                    "maxCommentsPerPost": {
                        "title": "Max comments per post",
                        "minimum": 0,
                        "maximum": 100000,
                        "type": "integer",
                        "description": "Cap on comments collected per post.",
                        "default": 10
                    },
                    "commentSort": {
                        "title": "Comment sort",
                        "enum": [
                            "top",
                            "new",
                            "controversial",
                            "old",
                            "qa",
                            "confidence"
                        ],
                        "type": "string",
                        "description": "Ordering used when collecting a post's comment thread.",
                        "default": "top"
                    },
                    "skipUserPosts": {
                        "title": "Skip user posts",
                        "type": "boolean",
                        "description": "When scraping a user profile, skip their post/comment history (keep profile only).",
                        "default": false
                    },
                    "skipCommunityInfo": {
                        "title": "Skip community info",
                        "type": "boolean",
                        "description": "When scraping a subreddit, skip the community info/rules record.",
                        "default": false
                    },
                    "postedAfter": {
                        "title": "Posts after",
                        "type": "string",
                        "description": "Keep only posts created on/after this date (YYYY-MM-DD or ISO-8601)."
                    },
                    "postedBefore": {
                        "title": "Posts before",
                        "type": "string",
                        "description": "Keep only posts created on/before this date."
                    },
                    "commentedAfter": {
                        "title": "Comments after",
                        "type": "string",
                        "description": "Keep only comments created on/after this date."
                    },
                    "commentedBefore": {
                        "title": "Comments before",
                        "type": "string",
                        "description": "Keep only comments created on/before this date."
                    },
                    "onlyWithFlair": {
                        "title": "Only posts with flair",
                        "type": "boolean",
                        "description": "Keep only posts that have a link flair.",
                        "default": false
                    },
                    "strictKeywordMatch": {
                        "title": "Strict keyword match",
                        "type": "boolean",
                        "description": "For searches, keep only results whose title/body contain every keyword.",
                        "default": false
                    },
                    "maxItems": {
                        "title": "Max results",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Global cap across all sources and data types. 0 = unlimited.",
                        "default": 100
                    },
                    "maxPostsPerSource": {
                        "title": "Max posts per source",
                        "minimum": 1,
                        "maximum": 1000,
                        "type": "integer",
                        "description": "Posts pulled per subreddit / search / user (Reddit lists cap near 1000).",
                        "default": 25
                    },
                    "sentiment": {
                        "title": "🧠 Sentiment analysis",
                        "type": "boolean",
                        "description": "Add a sentiment score and label to posts and comments.",
                        "default": false
                    },
                    "downloadMedia": {
                        "title": "🖼️ Download post media",
                        "type": "boolean",
                        "description": "Save post images/videos to storage and add permanent links (Reddit media URLs can rotate).",
                        "default": false
                    },
                    "downloadAvatars": {
                        "title": "🧑 Download user avatars",
                        "type": "boolean",
                        "description": "Save user avatars to storage and add a permanent link.",
                        "default": false
                    },
                    "dedupe": {
                        "title": "Remove duplicates",
                        "type": "boolean",
                        "description": "Save each post/comment/user/community only once per run.",
                        "default": true
                    },
                    "onlyNewerThan": {
                        "title": "⏱️ Only newer than (Unix time)",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Skip items created at/before this Unix timestamp — useful for scheduled monitoring.",
                        "default": 0
                    },
                    "proxyConfiguration": {
                        "title": "🌐 Proxy",
                        "type": "object",
                        "description": "Defaults to fast, low-cost datacenter proxies. The scraper automatically escalates to residential IPs only if Reddit rate-limits the run.",
                        "default": {
                            "useApifyProxy": true
                        }
                    },
                    "maxConcurrency": {
                        "title": "Parallel sources",
                        "minimum": 1,
                        "maximum": 50,
                        "type": "integer",
                        "description": "Sources processed at once.",
                        "default": 8
                    },
                    "maxRetries": {
                        "title": "Request retries",
                        "minimum": 0,
                        "maximum": 10,
                        "type": "integer",
                        "description": "Retries for a failed Reddit request.",
                        "default": 5
                    },
                    "requestTimeoutSecs": {
                        "title": "Request timeout (s)",
                        "minimum": 5,
                        "maximum": 120,
                        "type": "integer",
                        "description": "Maximum time for one request.",
                        "default": 30
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
