# Reddit API Scraper (`rl1987/reddit-api-scraper`) Actor

Scrape Reddit posts, comments, search results, subreddits, and user profiles via Reddit's OAuth data API. No login required.

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

## Pricing

from $5.00 / 1,000 dataset rows

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

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are 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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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 API Scraper

**Reddit API Scraper** extracts **posts, comments, search results, subreddit metadata, and user profiles** from [Reddit](https://www.reddit.com) — fast, structured, and without a login. It talks directly to Reddit's official OAuth data API (the same endpoints the Reddit mobile app uses), so you get clean JSON instead of brittle HTML scraping. Point it at a subreddit, a search query, a post URL, or a username and download the results as JSON, CSV, or Excel.

Running on the Apify platform, you also get scheduling, a REST API, webhook and integration support, proxy rotation, and run monitoring out of the box.

### Why use Reddit API Scraper?

- **Market & audience research** — track what communities are discussing around your product, niche, or competitors.
- **Brand & reputation monitoring** — surface every mention of a keyword across Reddit and read the full comment threads.
- **Content & trend discovery** — pull top/hot/rising posts from any subreddit to spot emerging topics.
- **Sentiment & NLP datasets** — collect large, structured post + comment corpora for analysis or model training.
- **Lead and community analysis** — profile users and inspect their posting history.

### How to use Reddit API Scraper

1. Open the Actor and go to the **Input** tab.
2. Fill in **one or more** source fields: **Subreddits**, **Search queries**, **Post URLs / IDs**, or **Usernames**.
3. Optionally set the sort order, time window, item limits, and whether to include comments.
4. Click **Start** and watch the run log.
5. When it finishes, open the **Output** / **Storage** tab and download your data as JSON, CSV, or Excel.

### Input

You can combine any of the source types in a single run. At least one is required.

| Field | Type | Description |
|-------|------|-------------|
| `subreddits` | array | Subreddit names, `r/`-prefixed names, or URLs to pull post listings from. |
| `sort` | enum | Listing sort: `hot`, `new`, `top`, `rising`, `controversial`. |
| `time` | enum | Time window for `top`/`controversial`: `hour`–`all`. |
| `searchQueries` | array | Full-text search queries to run. |
| `searchSort` | enum | Search sort: `relevance`, `hot`, `top`, `new`, `comments`. |
| `searchInSubreddits` | boolean | Restrict each search query to the listed subreddits. |
| `postUrls` | array | Individual post permalinks/IDs — fetches full self-text + comments. |
| `usernames` | array | Users to scrape (profile + history). |
| `userContent` | enum | `overview`, `submitted`, `comments`, or `about`. |
| `includeComments` | boolean | Also fetch comment trees for posts collected from subreddits/searches. |
| `maxComments` | integer | Max comments emitted per post. |
| `commentSort` | enum | Comment sort: `confidence`, `top`, `new`, `controversial`, `old`, `qa`. |
| `maxItemsPerSource` | integer | Max posts per subreddit/search/user (0 = unlimited). |
| `includeNsfw` | boolean | Include NSFW results in search. |
| `proxyConfiguration` | object | Proxy settings (Apify Proxy recommended for larger runs). |

#### Example input

```json
{
    "subreddits": ["programming", "r/python"],
    "sort": "top",
    "time": "week",
    "maxItemsPerSource": 100,
    "includeComments": true,
    "maxComments": 50,
    "searchQueries": ["large language models"],
    "searchSort": "new"
}
```

### Output

Each item is pushed to the dataset with a `type` field (`post`, `comment`, `subreddit`, or `user`). You can download the dataset in various formats such as JSON, HTML, CSV, or Excel.

#### Example output (a post)

```json
{
    "type": "post",
    "id": "1ukim8j",
    "subreddit": "programming",
    "title": "Open source is a thankless job...",
    "author": "swithek",
    "selftext": "",
    "score": 1092,
    "upvoteRatio": 0.97,
    "numComments": 267,
    "createdAt": "2026-07-01T11:09:38+00:00",
    "url": "https://example.com/article",
    "permalink": "https://www.reddit.com/r/programming/comments/1ukim8j/..."
}
```

#### Example output (a comment)

```json
{
    "type": "comment",
    "id": "ouw01y8",
    "postId": "1ukim8j",
    "author": "SP-Niemand",
    "body": "As a user, you get to demand exactly nothing...",
    "score": 453,
    "depth": 0,
    "createdAt": "2026-07-01T12:30:00+00:00"
}
```

#### Data fields

| Field | Applies to | Description |
|-------|-----------|-------------|
| `type` | all | `post`, `comment`, `subreddit`, or `user`. |
| `id` | all | Base-36 Reddit ID. |
| `subreddit` | post, comment | Subreddit name. |
| `title` | post, subreddit | Post title / subreddit title. |
| `author` | post, comment | Username of the author. |
| `selftext` / `body` | post / comment | Full text content. |
| `score`, `ups`, `upvoteRatio` | post, comment | Vote metrics. |
| `numComments` | post | Comment count. |
| `postId`, `parentId`, `depth` | comment | Thread position. |
| `subscribers`, `activeUserCount` | subreddit | Community size. |
| `commentKarma`, `linkKarma`, `totalKarma` | user | Karma breakdown. |
| `createdAt` | all | ISO-8601 UTC creation time. |
| `permalink`, `url` | post, comment | Links. |

### How much does it cost to scrape Reddit?

This Actor uses **pay-per-result** pricing: **$5.00 per 1,000 rows** ($0.005 per row). Every item written to the dataset — a post, a comment, a subreddit, or a user — counts as one row. So a run that collects 500 posts and 5,000 comments (5,500 rows) costs about **$27.50**.

**Platform usage (compute + proxy) is billed on top** of the per-row price at Apify's standard rates. The Actor is lightweight — it calls a JSON API rather than rendering pages — so compute is minimal; the main variable cost is proxy traffic if you enable Apify Proxy. To control spend, set **Max total charge** on the run and/or lower `maxItemsPerSource` and `maxComments`; the Actor stops as soon as the charge cap is reached. Reddit limits each OAuth token to roughly **100 requests per minute**, so very large runs are paced accordingly.

### Tips & advanced options

- **Fewer requests, faster runs:** leave `includeComments` off if you only need post metadata.
- **Targeted comment collection:** put specific posts in `postUrls` — their comments are always fetched.
- **Scoped search:** enable `searchInSubreddits` with a `subreddits` list to search within specific communities.
- **Unlimited collection:** set `maxItemsPerSource` to `0` to page through everything the API returns (Reddit typically caps listings around ~1000 items per source).
- **Scale past rate limits:** run with Apify Proxy and/or split large jobs into scheduled runs.

### FAQ, disclaimers, and support

**Is scraping Reddit legal?** This Actor collects only publicly available data. You are responsible for how you use it — comply with applicable laws (including data-protection law such as GDPR) and avoid collecting personal or sensitive data without a lawful basis.

**Limitations:** Reddit caps listing pagination (~1000 items per source) and comment trees may be truncated for very large threads. Search uses Reddit's REST search endpoint.

**Support:** found a bug or need a field that isn't extracted? Open an issue on the Actor's **Issues** tab. Custom scraping solutions can also be arranged.

# Actor input Schema

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

Subreddits to scrape post listings from. Accepts names (`programming`), `r/`-prefixed names, or full URLs (`https://www.reddit.com/r/programming`).

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

Sort order for subreddit post listings.

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

Time window for the `top` and `controversial` sorts (ignored otherwise).

## `searchQueries` (type: `array`):

Full-text search queries to run against Reddit. Each query is executed and its result posts are pushed to the dataset.

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

Sort order for search results.

## `searchInSubreddits` (type: `boolean`):

When enabled, each search query is restricted to each subreddit listed in the Subreddits field (searches `r/{subreddit}/search` with `restrict_sr=true`). When disabled, searches are global.

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

Individual Reddit posts to fetch (including full self-text and comment threads). Accepts full permalinks, `comments/{id}` URLs, base-36 IDs, or `t3_`-prefixed fullnames.

## `usernames` (type: `array`):

Reddit users to scrape. Fetches the profile and, per the `User content` option, their posts and/or comments. Accepts names, `u/`-prefixed names, or profile URLs.

## `userContent` (type: `string`):

Which content to fetch for each username.

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

Fetch and output the comment tree for every post collected from subreddits and searches (in addition to posts given directly in Post URLs, whose comments are always fetched).

## `maxComments` (type: `integer`):

Upper bound on the number of comments emitted per post. 0 = no comments (post only).

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

Sort order for comment threads.

## `maxItemsPerSource` (type: `integer`):

Maximum posts to collect from each individual subreddit, search query, or user listing. 0 = unlimited (fetch until the API runs out).

## `includeNsfw` (type: `boolean`):

Include NSFW results in search output.

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

Proxy settings. Reddit rate-limits per IP and per OAuth token (~100 req/min); residential or datacenter proxies help distribute load. Recommended for larger runs.

## Actor input object example

```json
{
  "subreddits": [
    "programming",
    "r/news",
    "https://www.reddit.com/r/python"
  ],
  "sort": "hot",
  "time": "all",
  "searchQueries": [
    "large language models",
    "rust vs go"
  ],
  "searchSort": "relevance",
  "searchInSubreddits": false,
  "postUrls": [
    "https://www.reddit.com/r/programming/comments/1ab2cd/title/"
  ],
  "usernames": [
    "spez"
  ],
  "userContent": "overview",
  "includeComments": false,
  "maxComments": 50,
  "commentSort": "confidence",
  "maxItemsPerSource": 100,
  "includeNsfw": false,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `dataset` (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": [
        "programming"
    ]
};

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

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

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/zRbDpEzBHXge8ZvvV/builds/OeXmLDM6Z28jS4bqT/openapi.json
