# Reddit Scraper API - Posts, Comments, Subreddits, Users (`offgrid-labs/reddit-scraper`) Actor

Reddit scraper for posts and full comment trees from subreddits, search, post URLs and user profiles. Your OAuth credentials (official Data API) or keyless public JSON; keyless runs need own proxies or a Reddit app key (Apify shared pools get 403s). $0.50 per 1,000 posts, $0.25 per 1,000 comments.

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

## Pricing

from $0.50 / 1,000 posts

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/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 API: posts and comments from subreddits, search, threads and user profiles

**TL;DR:** Reddit Scraper API reads Reddit posts and full comment trees from **subreddits** (hot, new, top, rising, controversial), **search queries**, **post URLs** and **user profiles** and returns them in one unified schema: title, text, author, subreddit, score, upvote ratio, comment count, timestamps, flair, reply depth, permalink and deleted/removed flags. It reads **Reddit's public JSON endpoints** out of the box, or **Reddit's official Data API** when you add your app credentials, with **built-in proxy routing** (rotation, fail-over, per-proxy health) for reliable access. You pay **$0.50 per 1,000 posts** and **$0.25 per 1,000 comments**; demo mode returns a free, clearly labelled sample.

With credentials, requests go to `oauth.reddit.com` (the [Reddit Data API](https://www.reddit.com/dev/api)) using application-only OAuth. Without credentials, requests go to the public JSON endpoints (`www.reddit.com/*.json`). No logins, no proxies, no IP rotation.

### What data you get

One dataset row per post or comment (`recordType`).

| Field | What it is | Example |
|---|---|---|
| `recordType` | `post` or `comment` (one charged event each) | `comment` |
| `id`, `fullname` | Reddit ID and fullname (`t3_` post, `t1_` comment); `fullname` is the dedupe key | `1abc2de`, `t3_1abc2de` |
| `subreddit`, `author` | Subreddit and author (`null` if deleted) | `webscraping`, `some_user` |
| `title`, `body` | Post title; post self-text or comment text (markdown) | `Best way to use the Reddit API?` |
| `url`, `linkUrl`, `domain` | Permalink, external link of link posts, link domain | `https://www.reddit.com/r/...` |
| `score`, `upvoteRatio`, `numComments` | Score, upvote share (posts), comment count (posts) | `128`, `0.96`, `42` |
| `createdAt`, `createdUtc`, `editedAt` | ISO 8601 / Unix creation time, last edit | `2026-11-03T00:00:00.000Z` |
| `flair`, `over18`, `spoiler`, `stickied`, `locked`, `isSelf`, `isVideo` | Flair and post flags | `Question`, `false` |
| `postId`, `postTitle`, `parentId`, `depth`, `isSubmitter` | Thread position: post, parent (`t3_`/`t1_`), reply depth, written by OP | `t1_c1`, `1`, `true` |
| `isDeleted`, `isRemoved`, `removedBy` | Deleted by author / removed by mods or Reddit, and by whom | `false`, `true`, `moderator` |
| `source`, `sourceUrl` | Input that produced the row and the API endpoint used | `subreddit:webscraping/hot` |
| `demo`, `scrapedAt` | `true` only for the uncharged demo sample; read time | `false` |

Fields that do not apply to a record type are `null`. Run statistics are saved in the key-value store record `RUN_SUMMARY`: posts and comments saved, duplicates/deleted skipped, duration, **records per second**, API requests, retries and HTTP 429 responses.

| Input source | API endpoint | Notes |
|---|---|---|
| Subreddits | `/r/<sub>/{hot,new,top,rising,controversial}` | 100 posts per request; Reddit stops listings at about 1,000 |
| Search queries | `/search` or `/r/<a+b>/search?restrict_sr=1` | Reddit search syntax (`"phrase"`, `title:`, `author:`, `OR`) |
| Post URLs | `/comments/<id>` + `/api/morechildren` | Full comment tree, depth and size limits, "load more" expanded |
| Usernames | `/user/<name>/submitted`, `/user/<name>/comments` | Public profile posts and comments |

### Use cases

- **Market and product research**: collect what a community says about a product category, with scores and full threads.
- **Social listening datasets**: export subreddits or search results on a schedule into Sheets, BigQuery or a data lake.
- **AI and NLP**: build clean, deduplicated post/comment corpora with thread structure (`parentId`, `depth`) for RAG or classification.
- **Academic research**: reproducible pulls with the endpoint stored on every row (`sourceUrl`).
- **Thread archiving**: save a discussion with all comments before it gets locked or removed.

For "only new mentions since the last run" alerts, use the sibling actor **Reddit Keyword Monitor**.

### How to use the Reddit scraper

1. (Optional) To use the official Data API, create a Reddit app at <https://www.reddit.com/prefs/apps> → **create another app** → type **web app** (or script), any redirect URI (e.g. `http://localhost`). Copy the **client ID** (under the app name) and the **secret**, then paste them into **Reddit client ID** and **Reddit client secret**. Leave both empty to use the public JSON path instead.
2. For reliable live access, either add your own proxies under **Proxy routing** (any HTTP/SOCKS list; rotation, fail-over and per-proxy health checks are built in — see [PROXY.md](./PROXY.md)), or create a free Reddit app (step 1, 2 minutes) and use the official Data API.
3. Add sources: **Subreddits**, **Search queries**, **Post URLs** and/or **Usernames**. Pick **Sort** and **Time filter**.
4. Set **Max posts per source**; switch on **Also fetch comments of listed posts** if you want comment trees for listings.
5. Click **Start** and download JSON, CSV, Excel or HTML, or read the dataset via API.

Turn on **Demo mode** to get a small fixed sample (`demo: true`) that shows the output format and is never charged.

### Input example

```json
{
  "clientId": "<optional: your Reddit app client ID>",
  "clientSecret": "<optional: your Reddit app secret>",
  "subreddits": ["webscraping", "datascience"],
  "sort": "top",
  "timeFilter": "week",
  "searchQueries": ["\"reddit api\" pricing"],
  "postUrls": ["https://www.reddit.com/r/redditdev/comments/abc123/example/"],
  "users": ["some_user"],
  "maxItemsPerSource": 100,
  "includeComments": true,
  "maxCommentsPerPost": 200,
  "commentDepth": 5,
  "publicRequestBudget": 300
}
```

### Output example

```json
{
  "recordType": "comment",
  "id": "democ02",
  "fullname": "t1_democ02",
  "subreddit": "demo",
  "author": "demo_user_1",
  "title": null,
  "body": "Thanks, that is helpful. How do you handle rate limits?",
  "url": "https://www.reddit.com/wiki/api/",
  "score": 17,
  "createdAt": "2026-11-03T00:15:00.000Z",
  "postId": "demo001",
  "postTitle": "[DEMO] Which open-source web scraping framework do you use in 2026?",
  "parentId": "t1_democ01",
  "depth": 1,
  "isSubmitter": true,
  "isDeleted": false,
  "isRemoved": false,
  "source": "demo",
  "demo": true,
  "scrapedAt": "2026-11-03T12:00:00.000Z"
}
```

(Shortened demo row; live rows have `demo: false`, real permalinks and the endpoint used in `sourceUrl`. Full samples: `samples/` in the source.)

### Pricing: how much does it cost to scrape Reddit?

Pay per event, flat on every Apify plan:

| Event | Price | Per 1,000 |
|---|---|---|
| Post saved | $0.0005 | **$0.50** |
| Comment saved | $0.00025 | **$0.25** |
| Actor start | $0.00005 | Apify default |

- **1,000 posts** from 10 subreddits = **$0.50**.
- **200 threads with 10,000 comments** = $0.10 + $2.50 = **$2.60**.
- Not charged: demo rows, duplicates (deduplicated by `fullname`), skipped deleted/removed or NSFW items, and failed runs (nothing is saved before an error).
- Set **Maximum cost per run** in the run options; the actor stops saving once the budget is reached.

### Speed and reliability

- **Speed**: Reddit returns up to 100 posts per listing request and up to 500 comments per thread request. With your own OAuth client, Reddit's documented limit is about **100 requests per minute**, so the ceiling is about 10,000 posts per minute. Our own processing overhead is ~41,000 records/s (measured on a local benchmark), and every run reports its real **records per second** in `RUN_SUMMARY`.
- **Public path budget**: when running without credentials, the actor uses a rotating, descriptive User-Agent and a hard per-run request budget (**Public path request budget**, default 300) so a run cannot hammer Reddit's public endpoints. Reaching the budget ends the run cleanly with whatever was collected.
- **Rate limits**: reads `X-Ratelimit-Remaining` / `X-Ratelimit-Reset` on every response when present, pauses before the window runs out, waits for the reset on HTTP 429 and retries 5xx/network errors with exponential back-off (up to 6 attempts). Retries never create duplicate rows or charges.
- **Clean failures**: private, banned or quarantined subreddits are skipped with a note in `RUN_SUMMARY`; if OAuth credentials are rejected, the run falls back to the public path.
- **Monitoring**: health-checked every 6 hours on the Apify platform.

### Proxy & routing

**We tested every Apify proxy pool so you don't have to** (Nov 3, 2026). Reddit currently refuses unauthenticated requests from *all* of Apify's shared pools — datacenter, residential, and Unblocker alike — and a browser User-Agent doesn't change that: the refusal comes back in ~30 ms, straight from the edge. So if you want keyless operation, bring your own premium proxies in `proxyList` — high-end residential pools sit outside Reddit's block ranges, and the router handles rotation, fail-over and per-proxy health for you. The zero-infrastructure route is a free Reddit app key (2 minutes, step 1 above), which talks to the official API and works from any IP. And if every request in a run is refused, the actor says exactly this in the run log and charges you nothing — no silent empty results.

Want requests to leave from your own IPs, or rotate exit IPs to spread load? Both the OAuth and
public-JSON paths route through an optional proxy router (`src/proxy.js`); demo mode stays network-free.

- **Sources (precedence)**: your `proxyList` (`http(s)://user:pass@host:port` or `host:port`, one per line) > Apify-managed proxy (`useApifyProxy` + `proxyGroups`) > direct connection.
- **Rotation**: `round_robin` (default), `random`, or `sticky_window` (hold one proxy for `stickyWindow` requests, default 15).
- **Failover & health**: on `403`/`429`/`5xx`/timeout the request retries on the next healthy proxy (up to `proxyMaxRetries`, default 2); proxies cool down with exponential back-off (base 30 s, cap 10 min) and are blacklisted after `proxyMaxFailures` (default 5) consecutive failures or a proxy-auth rejection (HTTP 407 / 401 with a proxy-auth header).
- **Safety**: proxy credentials are memory-only — the summary shows a masked host:port and an `effective_proxy_count`; credentials are never logged or stored.

All proxy fields are optional; leave them empty for the direct path. Full details: [`PROXY.md`](./PROXY.md).

### How it compares

| Approach | Setup | Output | Cost |
|---|---|---|---|
| **This actor** | Optional app credentials (2 min), or none at all | Unified post + comment schema, thread depth, dedupe, run stats | $0.50 / 1k posts, $0.25 / 1k comments |
| DIY with PRAW / raw API | App + code + hosting + scheduling | Whatever you build | Your time and servers |
| HTML / unauthenticated JSON scraping | None | Breaks when pages change | Varies |
| Data vendors / social listening suites | Contract | Dashboards, often no raw rows | Usually monthly subscriptions |

### FAQ

#### Do I need a Reddit API key to use this Reddit scraper?

No key is required if you bring your own proxies (`proxyList`). Note that we tested Apify's managed proxy pools on Nov 3, 2026 and Reddit currently refuses them all — so the most reliable zero-infrastructure route is a free Reddit app: create one at <https://www.reddit.com/prefs/apps>, paste the client ID and secret, and the actor uses the official Data API from any IP. Demo mode returns a small uncharged sample either way.

#### Can I scrape all comments of a Reddit post?

Yes. Add the post URL; the actor reads the comment tree and expands collapsed "load more comments" branches until **Max comments per post** (up to 10,000) and **Comment depth** are reached.

#### Can I scrape a subreddit's top posts of the week or year?

Yes. Set **Sort** to `top` and **Time filter** to `week`, `month`, `year` or `all`. Reddit stops listings at about 1,000 posts per sort.

#### How do I scrape a Reddit user's posts and comments?

Add the username or profile URL under **Usernames** and choose posts, comments or both. Only public profile content is returned.

#### What happens with deleted or removed posts and comments?

By default they are skipped and not charged. With **Include deleted / removed items** on, they are saved with `body` and `author` set to `null` and `isDeleted` / `isRemoved` / `removedBy` filled, which keeps thread structure intact.

#### Why did my run not use my credentials?

If the supplied client ID / secret is rejected, the actor automatically falls back to the public JSON path so the run still completes. Check the run log for the reason and re-copy both values from <https://www.reddit.com/prefs/apps> if you want the OAuth path.

#### Can an AI agent use this Reddit API?

Yes. Through the Apify MCP server an agent can find it with `search-actors`, read the input schema and call it, for example "get this week's top posts and comments from r/datascience". See **Integrations**.

#### Something wrong?

Open an issue on the Issues tab; we aim to respond within 24 hours.

### Integrations

- **API**: `POST https://api.apify.com/v2/acts/offgrid-labs~reddit-scraper/run-sync-get-dataset-items?token=<YOUR_APIFY_TOKEN>` with the input JSON as the body returns the rows directly (runs under 5 minutes).
- **Python / JavaScript**: `pip install apify-client` / `npm install apify-client`, then `client.actor("offgrid-labs/reddit-scraper").call(run_input={...})`.
- **No-code**: Apify integrations for **Make**, **Zapier** and **n8n**, plus Google Sheets, Slack, webhooks and Schedules.
- **MCP / AI agents**: add `https://mcp.apify.com?tools=offgrid-labs/reddit-scraper` to your MCP client.

### Changelog

- **2026-11-03** · First release: subreddits (hot/new/top/rising/controversial + time filter), search (site-wide or within subreddits), post URLs with full comment trees and "load more" expansion, user profiles, unified schema, dedupe, deleted/removed handling, rate-limit handling with back-off, demo mode, `RUN_SUMMARY` with speed and retry stats. Credentials optional — official OAuth Data API when supplied, public JSON path with a request budget otherwise.

### Related actors

| Actor | What it does |
|---|---|
| Reddit Keyword Monitor | New posts and comments mentioning your brand or keywords since the last run, with highlights, sentiment and alert text |
| Tech Stack Detector | Detect the technologies of companies discussed on Reddit |
| Shopify Scraper | Products and prices from the stores people recommend on Reddit |

***

```
// OFFGRID LABS ─────────────────────────────────────────────
// status: monitored 24/7 by a self-hosted agent swarm
// health checks: every 6h · auto-repair + rollback on failure
// sources: official public APIs and open data only
// support: open an issue — human-reviewed response within 24h
// ───────────────────────────────────────────────────────────
```

# Actor input Schema

## `clientId` (type: `string`):

Optional. Client ID of your own Reddit app (the string under the app name at https://www.reddit.com/prefs/apps). Used only for application-only OAuth (client_credentials grant, read-only). Leave empty with the secret to use the public JSON path. Example: p-jcoLKBynTLew

## `clientSecret` (type: `string`):

Optional. Secret of the same Reddit app (field labelled "secret" at https://www.reddit.com/prefs/apps). Stored encrypted by Apify; never logged. If the ID/secret is rejected, the actor falls back to the public JSON path.

## `appName` (type: `string`):

Name of your Reddit app, sent as a descriptive User-Agent when OAuth credentials are provided, e.g. apify:offgrid-labs-reddit-scraper:0.1 (app: my-research-app). Example: my-research-app

## `redditUsername` (type: `string`):

Optional. The Reddit username that owns the app; appended to the User-Agent as (by /u/<name>) as Reddit recommends. Not used to log in. Example: my_reddit_name

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

Subreddit names or URLs, one per line; posts are read from each subreddit's listing chosen in Sort. Formats: webscraping, r/webscraping, https://www.reddit.com/r/webscraping. all = r/all.

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

Listing used for subreddits and user profiles. top and controversial use the Time filter. Default hot.

## `timeFilter` (type: `string`):

Time window for top/controversial listings and for search (relevance/top/comments sorts). Default day.

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

Optional. Reddit search queries, one per line; each returns matching posts. Reddit search syntax works, e.g. "exact phrase", title:pricing, author:name, OR. Example: "web scraping" api

## `searchInSubreddits` (type: `array`):

Optional. Limit Search queries to these subreddits (searched together). Empty = all of Reddit. Example: python, learnpython

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

Order of search results. Default new.

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

Optional. Reddit post URLs, redd.it links or post IDs; each returns the post plus its comment tree (limited by Max comments per post and Comment depth). Example: https://www.reddit.com/r/AskReddit/comments/abc123/title/

## `users` (type: `array`):

Optional. Reddit usernames or profile URLs, one per line; returns their public posts and/or comments (see User content). Example: spez or https://www.reddit.com/user/spez

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

Which public profile listings to read for Usernames. Default both.

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

Maximum records read from each subreddit, search query or user listing (Reddit's listings stop at about 1,000). One saved record = one charged event. Default 100. Example: 25

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

If true, the comment tree of every post from subreddits and searches is fetched too (one extra API request per post; comments are charged as comment events). Post URLs always include comments. Default false.

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

Maximum comments saved per post (Post URLs, and listed posts when Also fetch comments is on). Collapsed "load more" branches are expanded until this limit. 0 = posts only. Default 100.

## `commentDepth` (type: `integer`):

Maximum reply depth: 0 = top-level comments only, 1 = plus direct replies, and so on. Default 10.

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

Order in which comments are read (matters when Max comments per post cuts the tree). Default confidence (Reddit's "Best").

## `expandMoreComments` (type: `boolean`):

If true (default), collapsed comment branches are expanded via the API's morechildren endpoint until Max comments per post is reached.

## `includeDeleted` (type: `boolean`):

If true, deleted and removed posts/comments are saved (body and author null, isDeleted / isRemoved = true) and charged. Default false: they are skipped and not charged.

## `skipNsfw` (type: `boolean`):

If true, posts and comments marked over_18 are skipped and not charged. Default false.

## `demo` (type: `boolean`):

If true, the actor returns a small fixed sample (demo: true) without contacting Reddit, and never charges. Turn it off for live data (public JSON path or your own OAuth credentials).

## `publicRequestBudget` (type: `integer`):

Maximum HTTP requests the public (no-credential) JSON path may make per run. Reaching it ends the run cleanly with whatever was collected. Ignored when OAuth credentials are used. Default 300.

## `proxyList` (type: `string`):

One proxy per line (or comma-separated), as http(s)://user:pass@host:port or host:port (credentials optional). The actor rotates across them and fails over to the next healthy one on 403/429/5xx/timeout. Leave empty to connect directly (or pair with Use Apify proxy).

## `useApifyProxy` (type: `boolean`):

If true (and no proxy list is supplied), route requests through Apify's managed proxy using the group chosen below. Requires Apify proxy to be enabled for this actor. Default false.

## `proxyGroups` (type: `string`):

Apify proxy pool: DATACENTERS (fastest), RESIDENTIAL (rotating IPs), or UNBLOCKER (most reliable against blocking).

## `proxyRotation` (type: `string`):

How proxies are chosen. round_robin cycles in order (default); random picks uniformly; sticky_window holds one proxy for the configured window then moves on. Default round_robin.

## `stickyWindow` (type: `integer`):

Requests per proxy before rotating, when rotation strategy is sticky_window. Default 15.

## `proxyMaxRetries` (type: `integer`):

How many additional proxies to try after a request fails (403/429/5xx/timeout) before giving up on that request. Default 2.

## `proxyMaxFailures` (type: `integer`):

Consecutive failures after which a proxy is blacklisted (skipped) for the rest of the run. A proxy-auth rejection (407/401) blacklists immediately. Default 5.

## `userAgent` (type: `string`):

Optional. Overrides the default User-Agent sent on the public JSON path (ignored on the official Data API path).

## Actor input object example

```json
{
  "appName": "my-research-app",
  "subreddits": [
    "webscraping",
    "datascience"
  ],
  "sort": "hot",
  "timeFilter": "day",
  "searchSort": "new",
  "userContent": "both",
  "maxItemsPerSource": 5,
  "includeComments": false,
  "maxCommentsPerPost": 100,
  "commentDepth": 10,
  "commentSort": "confidence",
  "expandMoreComments": true,
  "includeDeleted": false,
  "skipNsfw": false,
  "demo": true,
  "publicRequestBudget": 300,
  "useApifyProxy": false,
  "proxyGroups": "RESIDENTIAL",
  "proxyRotation": "round_robin",
  "stickyWindow": 15,
  "proxyMaxRetries": 2,
  "proxyMaxFailures": 5
}
```

# Actor output Schema

## `results` (type: `string`):

Every post and comment record in the unified schema (recordType post|comment), including deleted/removed flags, source and API endpoint.

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

Compact table: type, subreddit, author, title, text, score, comment count, created time, permalink, demo flag.

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

Comment rows with parent post title, author, text, score, reply depth, created time and permalink.

## `summary` (type: `string`):

RUN_SUMMARY record: mode (live/demo), posts/comments saved, skipped duplicates/deleted, charged events, duration, records per second, API requests, retries, HTTP 429 count and per-source notes.

# 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 = {
    "appName": "my-research-app",
    "subreddits": [
        "webscraping",
        "datascience"
    ],
    "maxItemsPerSource": 5,
    "demo": true
};

// Run the Actor and wait for it to finish
const run = await client.actor("offgrid-labs/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 = {
    "appName": "my-research-app",
    "subreddits": [
        "webscraping",
        "datascience",
    ],
    "maxItemsPerSource": 5,
    "demo": True,
}

# Run the Actor and wait for it to finish
run = client.actor("offgrid-labs/reddit-scraper").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 '{
  "appName": "my-research-app",
  "subreddits": [
    "webscraping",
    "datascience"
  ],
  "maxItemsPerSource": 5,
  "demo": true
}' |
apify call offgrid-labs/reddit-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,offgrid-labs/reddit-scraper"
        }
    }
}
```

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/rm4q7GeXcRnsG4BL6/builds/awHdsC5Bqkl2Bn627/openapi.json
